WINDEX
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
wex::gui Class Reference

The base class for all windex gui elements. More...

#include <wex.h>

Inheritance diagram for wex::gui:
wex::button wex::checkbox wex::choice wex::com wex::datebox wex::drop wex::editbox wex::gauge wex::inputbox wex::label wex::list wex::multiline wex::panel wex::plot::plot wex::propertyGrid wex::radiobutton wex::slider wex::table wex::tcp

Public Member Functions

 gui ()
 Construct top level window with no parent. More...
 
 gui (gui *parent, const char *window_class="windex", unsigned long style=WS_CHILD, unsigned long exstyle=WS_EX_CONTROLPARENT)
 Construct child of a parent. More...
 
void child (gui *w)
 register child on this window
 
children_t & children ()
 get vector of children
 
guiparent ()
 
guifind (int id)
 find child window with specified id
 
void focus ()
 
void bgcolor (int color)
 Change background color. More...
 
void nobgerase ()
 
void enable (bool f=true)
 Enable/Disable, default enable.
 
bool isEnabled () const
 
void fontHeight (int h)
 Change font height for this and all child windows.
 
void fontName (const std::string &name)
 
void icon (const std::string &iconfilename)
 Change icon. More...
 
void cursor (char *cursorID)
 
int id ()
 
int bgcolor () const
 
void textColor (int c)
 Set text color. More...
 
void text (const std::string &text)
 
std::string text () const
 
void scroll (bool fHoriz=true)
 Add scrollbars. More...
 
void scrollRange (int width, int height)
 Set the scrolling range. More...
 
sMouse getMouseStatus ()
 Get mouse status. More...
 
void run ()
 Run the windows message loop. More...
 
void tooltip (const std::string &text, int width=0)
 Add tooltip that pops up helpfully when mouse cursor hovers over widget. More...
 
virtual LRESULT WindowMessageHandler (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
virtual void show (bool f=true)
 Show window and all children.
 
void showModal (gui &appWindow)
 Show this window and suspend all other windows interactions until this is closed. More...
 
void endModal ()
 Stop modal interaction and close window.
 
void update ()
 force widget to redraw completely More...
 
void move (const std::vector< int > &r)
 Move the window. More...
 
void size (int w, int h)
 Change size without moving top left corner. More...
 
void move (int x, int y)
 Change position without changing size. More...
 
void move (int x, int y, int w, int h)
 
std::vector< int > size ()
 Size of window client area. More...
 
std::vector< int > lefttop ()
 
eventhandlerevents ()
 Get event handler.
 
HWND handle ()
 get window handle
 
void delete_list (std::vector< HWND > *list)
 set delete list for when gui is detroyed
 
void setfont (LOGFONT &logfont, HFONT &font)
 change font for this and all child windows
 
void setAsyncReadCompleteMsgID (int id)
 

Protected Member Functions

void Create (HWND parent, const char *window_class, DWORD style, DWORD exstyle=0, int id=0)
 Create the managed window. More...
 
void font (LOGFONT &logfont, HFONT &font)
 get font details More...
 
void createNewFont ()
 Replace font used by this and child windows from logfont.
 
virtual void draw (PAINTSTRUCT &ps)
 
int NewID ()
 Create new, unique ID for gui element. More...
 
int scrollMove (SCROLLINFO &si, int code)
 

Protected Attributes

HWND myHandle
 
guimyParent
 
eventhandler myEvents
 
int myBGColor
 
int myTextColor
 
HBRUSH myBGBrush
 
LOGFONT myLogFont
 
HFONT myFont
 
std::vector< HWND > * myDeleteList
 
std::string myText
 
int myID
 
std::vector< gui * > myChild
 gui elements to be displayed in this window
 
bool myfModal
 true if element is being shown as modal
 
bool myfEnabled
 true if not disabled
 
bool myfnobgerase
 
HWND myToolTip
 
unsigned int myAsyncReadCompleteMsgID
 handle to tooltip control for this gui element
 
char * myCursorID
 
bool myfScrollHoriz
 

Detailed Description

The base class for all windex gui elements.

Constructor & Destructor Documentation

◆ gui() [1/2]

wex::gui::gui ( )
inline

Construct top level window with no parent.

Application code should NOT use this constructor directly, nor that of any specilaization classes. Intead use maker::make().

◆ gui() [2/2]

wex::gui::gui ( gui parent,
const char *  window_class = "windex",
unsigned long  style = WS_CHILD,
unsigned long  exstyle = WS_EX_CONTROLPARENT 
)
inline

Construct child of a parent.

Application code should NOT use this constructor directly, nor that of any sepecilaization classes. Intead use maker::make().

Member Function Documentation

◆ bgcolor()

void wex::gui::bgcolor ( int  color)
inline

Change background color.

Parameters
[in]colorin BGR format eg 0x0000FF for red

◆ Create()

void wex::gui::Create ( HWND  parent,
const char *  window_class,
DWORD  style,
DWORD  exstyle = 0,
int  id = 0 
)
inlineprotected

Create the managed window.

Parameters
[in]parenthandle of parent window
[in]window_classcontrols which callback function handles window messages
[in]style
[in]exstyle
[in]ididentifies which control generated notification

◆ font()

void wex::gui::font ( LOGFONT &  logfont,
HFONT &  font 
)
inlineprotected

get font details

Parameters
[out]logfontlogical font
[out]fontUsed by child window constructor to inherit font from parent.

◆ getMouseStatus()

sMouse wex::gui::getMouseStatus ( )
inline

Get mouse status.

Returns
sMouse structure containing x and y positions, etc

◆ icon()

void wex::gui::icon ( const std::string &  iconfilename)
inline

Change icon.

Parameters
[in]iconfilenameUse to set the application icon in the taskbar

◆ move() [1/2]

void wex::gui::move ( const std::vector< int > &  r)
inline

Move the window.

Parameters
[in]rspecify location and size r contains 4 values, { x, y, width, height }

◆ move() [2/2]

void wex::gui::move ( int  x,
int  y 
)
inline

Change position without changing size.

Parameters
[in]xleft
[in]ytop

◆ NewID()

int wex::gui::NewID ( )
inlineprotected

Create new, unique ID for gui element.

The first ID will be 1, and is assumed to be the application window which causes the application to quit when destroyed

◆ run()

void wex::gui::run ( )
inline

Run the windows message loop.

This waits for events to occur and runs the requested event handler when they do.

It does not return until the application window ( that is the first top level window created ) is closed

◆ scroll()

void wex::gui::scroll ( bool  fHoriz = true)
inline

Add scrollbars.

Parameters
[in]fHoriztrue if horizontal scroll reuired, default true

◆ scrollRange()

void wex::gui::scrollRange ( int  width,
int  height 
)
inline

Set the scrolling range.

Parameters
[in]widthof the underlying window to be scrolled over
[in]heightof the underlying window to be scrolled over

This sets how far scrolling can move horixonatally and vertically. The width and height should be set to the maximum locations to be shown when scrolled to the limits.

This should be called again if the window size changes.

◆ showModal()

void wex::gui::showModal ( gui appWindow)
inline

Show this window and suspend all other windows interactions until this is closed.

Parameters
appWindowapplication window to disable while modal runs

◆ size() [1/2]

std::vector<int> wex::gui::size ( )
inline

Size of window client area.

Returns
vector [0] width of window in pixels [1] height of window in pixels

◆ size() [2/2]

void wex::gui::size ( int  w,
int  h 
)
inline

Change size without moving top left corner.

Parameters
[in]wwidth
[in]hheight

◆ textColor()

void wex::gui::textColor ( int  c)
inline

Set text color.

Parameters
ccolor 0xBBGGRR e.g. 0x0000FF for red If not called, defaults to black children do not inherit this

◆ tooltip()

void wex::gui::tooltip ( const std::string &  text,
int  width = 0 
)
inline

Add tooltip that pops up helpfully when mouse cursor hovers over widget.

Parameters
[in]textof tooltip
[in]widthof multiline tooltip, default single line

◆ update()

void wex::gui::update ( )
inline

force widget to redraw completely

Windex makes no effort to auto update the screen display. If application code alters something and the change should be seen immediatly then update() should be called, either on the widget that has changed or the top level window that contains the changed widgets.


The documentation for this class was generated from the following file: