version 2.8
Window

Detailed Description

The basic window implementation (base class).

GWIN provides a basic window manager which allows it to easily create and destroy different windows at runtime. Each window will have it's own properties such as colors as well as it's own drawing origin.

Precondition
GFX_USE_GWIN must be set to TRUE in your gfxconf.h

Data Structures

struct  GWindowObject
 A window object structure. More...
 
struct  GWindowInit
 The structure to initialise a GWIN. More...
 

Functions

void gwinSetWindowManager (struct GWindowManager *gwm)
 Set the window manager for the GWIN system. More...
 
void gwinClearInit (GWindowInit *pwi)
 Clear a GWindowInit structure to all zero's. More...
 
void gwinSetDefaultColor (color_t clr)
 Set the default foreground color for all new GWIN windows. More...
 
color_t gwinGetDefaultColor (void)
 Get the default foreground color for all new GWIN windows. More...
 
void gwinSetDefaultBgColor (color_t bgclr)
 Set the default background color for all new GWIN windows. More...
 
color_t gwinGetDefaultBgColor (void)
 Get the default background color for all new GWIN windows. More...
 
void gwinSetDefaultFont (font_t font)
 Set the default font for all new GWIN windows. More...
 
font_t gwinGetDefaultFont (void)
 Get the current default font. More...
 
GHandle gwinGWindowCreate (GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit)
 Create a basic window. More...
 
void gwinDestroy (GHandle gh)
 Destroy a window (of any type). Releases any dynamically allocated memory. More...
 
const char * gwinGetClassName (GHandle gh)
 Get the real class name of the GHandle. More...
 
void gwinSetVisible (GHandle gh, bool_t visible)
 Sets whether a window is visible or not. More...
 
bool_t gwinGetVisible (GHandle gh)
 Gets the visibility of a window. More...
 
void gwinSetEnabled (GHandle gh, bool_t enabled)
 Enable or disable a window. More...
 
bool_t gwinGetEnabled (GHandle gh)
 Gets the enabled state of a window. More...
 
void gwinMove (GHandle gh, coord_t x, coord_t y)
 Move a window. More...
 
void gwinResize (GHandle gh, coord_t width, coord_t height)
 Resize a window. More...
 
void gwinRedraw (GHandle gh)
 Redraw a window. More...
 
void gwinRedrawDisplay (GDisplay *g, bool_t preserve)
 Redraw a display. More...
 
void gwinSetMinMax (GHandle gh, GWindowMinMax minmax)
 Minimize, Maximize or Restore a window. More...
 
GWindowMinMax gwinGetMinMax (GHandle gh)
 Get the Minimized/Maximized state of a window. More...
 
void gwinRaise (GHandle gh)
 Raise a window to the top of the z-order. More...
 
GHandle gwinGetNextWindow (GHandle gh)
 Get the next window in the z-order. More...
 
void gwinSetFlashing (GHandle gh, bool_t flash)
 Set a window or widget to flash. More...
 
void gwinSetFont (GHandle gh, font_t font)
 Set the current font for this window. More...
 
void gwinClear (GHandle gh)
 Clear the window. More...
 
void gwinDrawPixel (GHandle gh, coord_t x, coord_t y)
 Set a pixel in the window. More...
 
void gwinDrawLine (GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1)
 Draw a line in the window. More...
 
void gwinDrawBox (GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy)
 Draw a box in the window. More...
 
void gwinFillArea (GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy)
 Fill an rectangular area in the window. More...
 
void gwinBlitArea (GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer)
 Fill an area in the window using the supplied bitmap. More...
 
void gwinDrawCircle (GHandle gh, coord_t x, coord_t y, coord_t radius)
 Draw a circle in the window. More...
 
void gwinFillCircle (GHandle gh, coord_t x, coord_t y, coord_t radius)
 Draw a filled circle in the window. More...
 
void gwinFillDualCircle (GHandle gh, coord_t x, coord_t y, coord_t radius1, coord_t radius2)
 Draw two filled circles with the same centre in the window. More...
 
void gwinDrawEllipse (GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b)
 Draw an ellipse. More...
 
void gwinFillEllipse (GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b)
 Draw an filled ellipse. More...
 
color_t gwinGetPixelColor (GHandle gh, coord_t x, coord_t y)
 Get the color of a pixel in the window. More...
 
void gwinDrawChar (GHandle gh, coord_t x, coord_t y, char c)
 Draw a text character at the specified position in the window. More...
 
void gwinFillChar (GHandle gh, coord_t x, coord_t y, char c)
 Draw a text character with a filled background at the specified position in the window. More...
 
void gwinDrawString (GHandle gh, coord_t x, coord_t y, const char *str)
 Draw a text string in the window. More...
 
void gwinFillString (GHandle gh, coord_t x, coord_t y, const char *str)
 Draw a text string with a filled background in the window. More...
 
void gwinDrawStringBox (GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char *str, justify_t justify)
 Draw a text string verticly centered within the specified box. More...
 
void gwinFillStringBox (GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char *str, justify_t justify)
 Draw a text string verticly centered within the specified filled box. More...
 
void gwinDrawPoly (GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt)
 Draw an enclosed polygon (convex, non-convex or complex). More...
 
void gwinFillConvexPoly (GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt)
 Fill a convex polygon. More...
 
void gwinDrawThickLine (GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, bool_t round)
 Draw a thick line in the window. More...
 
gdispImageError gwinDrawImage (GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy)
 Draw the image. More...
 
typedef struct GWindowObject GWindowObject
 A window object structure. More...
 
typedef struct GWindowInit GWindowInit
 The structure to initialise a GWIN. More...
 

Macros

#define gwinGetClassID(gh)   ((void *)((gh)->vmt))
 Get an ID that uniquely describes the class of the GHandle. More...
 
#define gwinGetScreenX(gh)   ((gh)->x)
 Get the X coordinate of the window. More...
 
#define gwinGetScreenY(gh)   ((gh)->y)
 Get the Y coordinate of the window. More...
 
#define gwinGetWidth(gh)   ((gh)->width)
 Get the width of the window. More...
 
#define gwinGetHeight(gh)   ((gh)->height)
 Get the height of the window. More...
 
#define gwinSetColor(gh, clr)   (gh)->color = (clr)
 Set foreground color. More...
 
#define gwinSetBgColor(gh, bgclr)   (gh)->bgcolor = (bgclr)
 Set background color. More...
 
#define gwinGetColor(gh)   (gh)->color
 Get the foreground color of a window. More...
 
#define gwinGetBgColor(gh)   (gh)->bgcolor
 Get the background color of a window. More...
 
#define gwinShow(gh)   gwinSetVisible(gh, TRUE)
 Makes a widget become visible. More...
 
#define gwinHide(gh)   gwinSetVisible(gh, FALSE)
 Makes a widget become invisible. More...
 
#define gwinEnable(gh)   gwinSetEnabled(gh, TRUE)
 Enables a widget. More...
 
#define gwinDisable(gh)   gwinSetEnabled(gh, FALSE)
 Disables a widget. More...
 
#define gwinFlash(gh)   gwinSetFlashing(gh, TRUE)
 Enables flashing of a window or widget. More...
 
#define gwinNoFlash(gh)   gwinSetFlashing(gh, FALSE)
 Disables a widget. More...
 

Enumerations

Function Documentation

void gwinBlitArea ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
coord_t  srcx,
coord_t  srcy,
coord_t  srccx,
const pixel_t buffer 
)

Fill an area in the window using the supplied bitmap.

The bitmap is in the pixel format specified by the low level driver

Note
If GDISP_NEED_ASYNC is defined then the buffer must be static or at least retained until this call has finished the blit. You can tell when all graphics drawing is finished by gdispIsBusy() going FALSE.
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe start filled area
[in]cx,cyThe width and height to be filled
[in]srcx,srcyThe bitmap position to start the fill from
[in]srccxThe width of a line in the bitmap.
[in]bufferThe pixels to use to fill the area.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinClear ( GHandle  gh)

Clear the window.

Note
Uses the current background color to clear the window
Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinClearInit ( GWindowInit pwi)

Clear a GWindowInit structure to all zero's.

Note
This function is provided just to prevent problems on operating systems where using memset() causes issues in the users application.
Parameters
[in]pwiThe GWindowInit structure to clear
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDestroy ( GHandle  gh)

Destroy a window (of any type). Releases any dynamically allocated memory.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawBox ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy 
)

Draw a box in the window.

Note
Uses the current foreground color to draw the box
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe start position
[in]cx,cyThe size of the box (outside dimensions)
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawChar ( GHandle  gh,
coord_t  x,
coord_t  y,
char  c 
)

Draw a text character at the specified position in the window.

Precondition
The font must have been set.
Note
Uses the current foreground color to draw the character
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position for the text
[in]cThe character to draw
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawCircle ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  radius 
)

Draw a circle in the window.

Note
Uses the current foreground color to draw the circle
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe center of the circle
[in]radiusThe radius of the circle
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawEllipse ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  a,
coord_t  b 
)

Draw an ellipse.

Note
Uses the current foreground color to draw the ellipse
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe center of the ellipse
[in]a,bThe dimensions of the ellipse
Function Class:
Normal API, this function can be invoked by regular system threads.
gdispImageError gwinDrawImage ( GHandle  gh,
gdispImage img,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
coord_t  sx,
coord_t  sy 
)

Draw the image.

Returns
GDISP_IMAGE_ERR_OK (0) on success or an error code.
Parameters
[in]ghThe window handle
[in]imgThe image structure
[in]x,yThe window location to draw the image
[in]cx,cyThe area on the screen to draw
[in]sx,syThe image position to start drawing at
Precondition
gdispImageOpen() must have returned successfully.
Note
If sx,sy + cx,cy is outside the image boundaries the area outside the image is simply not drawn.
If gdispImageCache() has been called first for this frame, this routine will draw using a fast blit from the cached frame. If not, it reads the input and decodes it as it is drawing. This may be significantly slower than if the image has been cached (but uses a lot less RAM)
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawLine ( GHandle  gh,
coord_t  x0,
coord_t  y0,
coord_t  x1,
coord_t  y1 
)

Draw a line in the window.

Note
Uses the current foreground color to draw the line
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x0,y0The start position
[in]x1,y1The end position
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawPixel ( GHandle  gh,
coord_t  x,
coord_t  y 
)

Set a pixel in the window.

Note
Uses the current foreground color to set the pixel
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe coordinates of the pixel
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawPoly ( GHandle  gh,
coord_t  tx,
coord_t  ty,
const point pntarray,
unsigned  cnt 
)

Draw an enclosed polygon (convex, non-convex or complex).

Note
Uses the current foreground color.
Parameters
[in]ghThe window handle
[in]tx,tyTransform all points in pntarray by tx, ty
[in]pntarrayAn array of points
[in]cntThe number of points in the array
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawString ( GHandle  gh,
coord_t  x,
coord_t  y,
const char *  str 
)

Draw a text string in the window.

Precondition
The font must have been set.
Note
Uses the current foreground color to draw the character
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position for the text
[in]strThe string to draw
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawStringBox ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
const char *  str,
justify_t  justify 
)

Draw a text string verticly centered within the specified box.

Precondition
The font must have been set.
Note
Uses the current foreground color to draw the character.
The specified box does not need to align with the window box
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position for the text (need to define top-right or base-line - check code)
[in]cx,cyThe width and height of the box
[in]strThe string to draw
[in]justifyJustify the text left, center or right within the box
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinDrawThickLine ( GHandle  gh,
coord_t  x0,
coord_t  y0,
coord_t  x1,
coord_t  y1,
coord_t  width,
bool_t  round 
)

Draw a thick line in the window.

The line thickness is specified in pixels. The line ends can be selected to be either flat or round.

Note
Uses gdispGFillConvexPoly() internally to perform the drawing.
Uses the current foreground color to draw the line
Parameters
[in]ghThe window handle
[in]x0,y0The start position
[in]x1,y1The end position
[in]widthThe width of the line
[in]roundUse round ends for the line
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillArea ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy 
)

Fill an rectangular area in the window.

Note
Uses the current foreground color to fill the box
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe start position
[in]cx,cyThe size of the box (outside dimensions)
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillChar ( GHandle  gh,
coord_t  x,
coord_t  y,
char  c 
)

Draw a text character with a filled background at the specified position in the window.

Precondition
The font must have been set.
Note
Uses the current foreground color to draw the character and fills the background using the background drawing color
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position for the text
[in]cThe character to draw
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillCircle ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  radius 
)

Draw a filled circle in the window.

Note
Uses the current foreground color to draw the filled circle
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe center of the circle
[in]radiusThe radius of the circle
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillConvexPoly ( GHandle  gh,
coord_t  tx,
coord_t  ty,
const point pntarray,
unsigned  cnt 
)

Fill a convex polygon.

Doesn't handle non-convex or complex polygons.

Note
Uses the current foreground color.
Parameters
[in]ghThe window handle
[in]tx,tyTransform all points in pntarray by tx, ty
[in]pntarrayAn array of points
[in]cntThe number of points in the array
Note
Convex polygons are those that have no internal angles. That is; you can draw a line from any point on the polygon to any other point on the polygon without it going outside the polygon. In our case we generalise this a little by saying that an infinite horizontal line (at any y value) will cross no more than two edges on the polygon. Some non-convex polygons do fit this criteria and can therefore be drawn.
This routine is designed to be very efficient with even simple display hardware.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillDualCircle ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  radius1,
coord_t  radius2 
)

Draw two filled circles with the same centre in the window.

Note
Uses the current foreground color to draw the inner circle
Uses the current background color to draw the outer circle
May leave GDISP clipping to this window's dimensions
Precondition
GDISP_NEED_DUALCIRCLE must be TRUE in your gfxconf.h
Parameters
[in]ghThe window handle
[in]x,yThe center of the circle
[in]radius1The radius of the larger circle
[in]radius2The radius of the smaller circle
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillEllipse ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  a,
coord_t  b 
)

Draw an filled ellipse.

Note
Uses the current foreground color to draw the filled ellipse
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe center of the ellipse
[in]a,bThe dimensions of the ellipse
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillString ( GHandle  gh,
coord_t  x,
coord_t  y,
const char *  str 
)

Draw a text string with a filled background in the window.

Precondition
The font must have been set.
Note
Uses the current foreground color to draw the character and fills the background using the background drawing color
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position for the text
[in]strThe string to draw
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinFillStringBox ( GHandle  gh,
coord_t  x,
coord_t  y,
coord_t  cx,
coord_t  cy,
const char *  str,
justify_t  justify 
)

Draw a text string verticly centered within the specified filled box.

Precondition
The font must have been set.
Note
Uses the current foreground color to draw the character and fills the background using the background drawing color
The entire box is filled. Note this box does not need to align with the window box
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position for the text (need to define top-right or base-line - check code)
[in]cx,cyThe width and height of the box
[in]strThe string to draw
[in]justifyJustify the text left, center or right within the box
Function Class:
Normal API, this function can be invoked by regular system threads.
const char* gwinGetClassName ( GHandle  gh)

Get the real class name of the GHandle.

Returns a string describing the object class.

Parameters
[in]ghThe window
Returns
A string describing the object class.
Function Class:
Normal API, this function can be invoked by regular system threads.
color_t gwinGetDefaultBgColor ( void  )

Get the default background color for all new GWIN windows.

Returns
The current default background color for all new GWIN windows
Function Class:
Normal API, this function can be invoked by regular system threads.
color_t gwinGetDefaultColor ( void  )

Get the default foreground color for all new GWIN windows.

Returns
The current default color for all new GWIN windows
Function Class:
Normal API, this function can be invoked by regular system threads.
font_t gwinGetDefaultFont ( void  )

Get the current default font.

Returns
The current default font
Function Class:
Normal API, this function can be invoked by regular system threads.
bool_t gwinGetEnabled ( GHandle  gh)

Gets the enabled state of a window.

Returns
TRUE if enabled
Note
It is possible for a child to be marked as enabled by gwinSetEnabled() but for this call to return FALSE if one of its parents are not enabled.
Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.
GWindowMinMax gwinGetMinMax ( GHandle  gh)

Get the Minimized/Maximized state of a window.

Precondition
GWIN_NEED_WINDOWMANAGER must be TRUE
Parameters
[in]ghThe window
Returns
GWIN_NORMAL, GWIN_MAXIMIZE or GWIN_MINIMIZE
Function Class:
Normal API, this function can be invoked by regular system threads.
GHandle gwinGetNextWindow ( GHandle  gh)

Get the next window in the z-order.

Returns
The next window or NULL if no more windows
Parameters
[in]ghThe previous window or NULL to get the first window
Note
This returns the next window in the system from top to bottom.
Where there are parent child relationships, this ignores them and will list all windows in the system. There is no defined order between children of siblings and they can in fact be mixed in order. The only relationship honored is that parents will be listed before their children.
Function Class:
Normal API, this function can be invoked by regular system threads.
color_t gwinGetPixelColor ( GHandle  gh,
coord_t  x,
coord_t  y 
)

Get the color of a pixel in the window.

Returns
The color of the pixel.
Note
May leave GDISP clipping to this window's dimensions
Parameters
[in]ghThe window handle
[in]x,yThe position in the window
Function Class:
Normal API, this function can be invoked by regular system threads.
bool_t gwinGetVisible ( GHandle  gh)

Gets the visibility of a window.

Returns
TRUE if visible
Note
It is possible for a child to be marked as visible by gwinSetVisible() but for this call to return FALSE if one of its parents are not visible.
Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.
GHandle gwinGWindowCreate ( GDisplay *  g,
GWindowObject pgw,
const GWindowInit pInit 
)

Create a basic window.

Returns
NULL if there is no resultant drawing area, otherwise a window handle.
Parameters
[in]gThe GDisplay to display this window on
[in]pgwThe window structure to initialize. If this is NULL the structure is dynamically allocated.
[in]pInitHow to initialise the window
Note
The drawing color and the background color get set to the current defaults. If you haven't called gwinSetDefaultColor() or gwinSetDefaultBgColor() then these are White and Black respectively.
The font gets set to the current default font. If you haven't called gwinSetDefaultFont() then there is no default font and text drawing operations will no nothing.
A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or its visibility state is changed.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinMove ( GHandle  gh,
coord_t  x,
coord_t  y 
)

Move a window.

Parameters
[in]ghThe window
[in]x,yThe new position (screen relative) for this window
Note
The final window position may not be the requested position. Windows are clipped to the screen area and the window manager may also affect the position.
The window is redrawn if it is visible. See the comments in gwinSetVisible() with regard to what can be redrawn and what can't.
It is up to the window manager to determine what happens with the screen area uncovered by moving the window. When there is no window manager, nothing is done with the uncovered area.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinRaise ( GHandle  gh)

Raise a window to the top of the z-order.

Precondition
GWIN_NEED_WINDOWMANAGER must be TRUE
Parameters
[in]ghThe window
Note
The window z-order is only supported by some window managers. See the comments in gwinSetVisible() with regard to what can be redrawn and what can't.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinRedraw ( GHandle  gh)

Redraw a window.

Parameters
[in]ghThe window
Note
This is normally never required as windows and widgets will redraw as required. Note that some windows are incapable of redrawing themselves as they don't save their drawing state.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinRedrawDisplay ( GDisplay *  g,
bool_t  preserve 
)

Redraw a display.

Parameters
[in]gThe display to redraw. Passing NULL will redraw all displays.
[in]preserveShould the redraw try to preserve existing screen data for those windows that can't redraw themselves?
Note
This is normally never required as windows and widgets will redraw as required.
Some windows are incapable of redrawing themselves as they don't save their drawing state.
This does not clear the background - just redraws the gwin windows (where possible)
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinResize ( GHandle  gh,
coord_t  width,
coord_t  height 
)

Resize a window.

Parameters
[in]ghThe window
[in]width,heightThe new size of the window
Note
The final window size may not be the requested size. Windows are clipped to the screen area and the window manager may also affect the size.
The window is redrawn if it is visible. See the comments in gwinSetVisible() with regard to what can be redrawn and what can't.
It is up to the window manager to determine what happens with any screen area uncovered by resizing the window. When there is no window manager, nothing is done with the uncovered area.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetDefaultBgColor ( color_t  bgclr)

Set the default background color for all new GWIN windows.

Parameters
[in]bgclrThe background color
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetDefaultColor ( color_t  clr)

Set the default foreground color for all new GWIN windows.

Parameters
[in]clrThe color to be set
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetDefaultFont ( font_t  font)

Set the default font for all new GWIN windows.

Parameters
[in]fontThe new font to be set
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetEnabled ( GHandle  gh,
bool_t  enabled 
)

Enable or disable a window.

Parameters
[in]ghThe window handle
[in]enabledEnable or disable the window
Note
The window is automatically redrawn if it supports self-redrawing.
Even when you mark a window as enabled, it may still remain disabled if it's parent is disabled. When the parent becomes enabled this child will automatically be enabled because it is already marked as enabled.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetFlashing ( GHandle  gh,
bool_t  flash 
)

Set a window or widget to flash.

Parameters
[in]ghThe window handle
[in]flashEnable or disable the flashing of the window
Note
The window is automatically redrawn if it supports self-redrawing.
When a window is set to flash, its appearance changes in some way every flash period (GWIN_FLASHING_PERIOD). How its appearance changes depends on the draw for each window/widget.
Precondition
Requires GWIN_NEED_FLASHING to be TRUE
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetFont ( GHandle  gh,
font_t  font 
)

Set the current font for this window.

Parameters
[in]ghThe window handle
[in]fontThe font to use for text functions
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetMinMax ( GHandle  gh,
GWindowMinMax  minmax 
)

Minimize, Maximize or Restore a window.

Precondition
GWIN_NEED_WINDOWMANAGER must be TRUE
Parameters
[in]ghThe window
[in]minmaxThe new minimized/maximized state
Note
The final window state may not be the requested state. Window Managers do not need to implement changing the minmax state. If there is no window manager this call is ignored.
The window is redrawn if it is changed. See the comments in gwinSetVisible() with regard to what can be redrawn and what can't.
It is up to the window manager to determine what happens with any screen area uncovered by resizing the window.
When a window is minimised it may be asked to draw the window or the window manager may draw the minimised window.
Function Class:
Normal API, this function can be invoked by regular system threads.
void gwinSetVisible ( GHandle  gh,
bool_t  visible 
)

Sets whether a window is visible or not.

Parameters
[in]ghThe window
[in]visibleWhether the window should be visible or not
Note
When a window is marked as not visible, drawing operations on the window do nothing.
When a window is marked as visible, it is not automatically redrawn as many window types don't remember their drawing state. Widgets such as Buttons, Sliders etc will be redrawn.
If there is no window manager in use, when a window is marked as not visible, nothing is done to remove the window from the screen. When there is a window manager, it is up to the window manager to handle what happens.
Even when you mark a window as visible, it may still not be displayed if it's parent is invisible. When the parent becomes visible this child will automatically be shown because it is already marked as visible.
Function Class:
Normal API, this function can be invoked by regular system threads.

Referenced by gwinGCheckboxCreate(), gwinGProgressbarCreate(), and gwinGSliderCreate().

void gwinSetWindowManager ( struct GWindowManager *  gwm)

Set the window manager for the GWIN system.

Parameters
[in]gwmThe window manager to use. Can be NULL to turn off the existing window manager.
Note
A window manager is responsible for handling when window visibility is changed or a window is resized for moved. Note that only saved window states will be redrawn. Each window type can save different information (or none at all). See the documentation on each window type to see which information it saves (and can therefore be automatically redrawn). For window types that do not save any state information, the window manager determines what to do. Generally it will just clear the window to its background color.
Function Class:
Normal API, this function can be invoked by regular system threads.

Macro Definition Documentation

#define gwinDisable (   gh)    gwinSetEnabled(gh, FALSE)

Disables a widget.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 413 of file gwin.h.

#define gwinEnable (   gh)    gwinSetEnabled(gh, TRUE)

Enables a widget.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 404 of file gwin.h.

#define gwinFlash (   gh)    gwinSetFlashing(gh, TRUE)

Enables flashing of a window or widget.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 581 of file gwin.h.

#define gwinGetBgColor (   gh)    (gh)->bgcolor

Get the background color of a window.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 326 of file gwin.h.

#define gwinGetClassID (   gh)    ((void *)((gh)->vmt))

Get an ID that uniquely describes the class of the GHandle.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 245 of file gwin.h.

#define gwinGetColor (   gh)    (gh)->color

Get the foreground color of a window.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 317 of file gwin.h.

#define gwinGetHeight (   gh)    ((gh)->height)

Get the height of the window.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 285 of file gwin.h.

#define gwinGetScreenX (   gh)    ((gh)->x)

Get the X coordinate of the window.

Returns the X coordinate of the origin of the window. The coordinate is relative to the physical screen zero point.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 256 of file gwin.h.

#define gwinGetScreenY (   gh)    ((gh)->y)

Get the Y coordinate of the window.

Returns the Y coordinate of the origin of the window. The coordinate is relative to the physical screen zero point.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 267 of file gwin.h.

#define gwinGetWidth (   gh)    ((gh)->width)

Get the width of the window.

Parameters
[in]ghThe window
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 276 of file gwin.h.

#define gwinHide (   gh)    gwinSetVisible(gh, FALSE)

Makes a widget become invisible.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 367 of file gwin.h.

#define gwinNoFlash (   gh)    gwinSetFlashing(gh, FALSE)

Disables a widget.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 590 of file gwin.h.

#define gwinSetBgColor (   gh,
  bgclr 
)    (gh)->bgcolor = (bgclr)

Set background color.

Set the color which will be used as background

Note
gwinClear() must be called to set the background color
Parameters
[in]ghThe window
[in]bgclrThe background color
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 308 of file gwin.h.

#define gwinSetColor (   gh,
  clr 
)    (gh)->color = (clr)

Set foreground color.

Set the color which will be used to draw

Parameters
[in]ghThe window
[in]clrThe color to be set
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 296 of file gwin.h.

#define gwinShow (   gh)    gwinSetVisible(gh, TRUE)

Makes a widget become visible.

Parameters
[in]ghThe window handle
Function Class:
Normal API, this function can be invoked by regular system threads.

Definition at line 358 of file gwin.h.

Typedef Documentation

typedef struct GWindowInit GWindowInit

The structure to initialise a GWIN.

Note
Some gwin's will need extra parameters.
The dimensions and position may be changed to fit on the real screen.
If you create this structure on the stack, you should always memset it to all zero's first in case a future version of the software add's extra fields. Alternatively you can use gwinClearInit() to clear it.
typedef struct GWindowObject GWindowObject

A window object structure.

Note
Do not access the members directly. Treat it as a black-box and use the method functions.

Enumeration Type Documentation

A window's minimized, maximized or normal size.

Definition at line 90 of file gwin.h.