µGFX  2.9
version 2.9
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 GFXON 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 (gColor clr)
 Set the default foreground color for all new GWIN windows. More...
 
gColor gwinGetDefaultColor (void)
 Get the default foreground color for all new GWIN windows. More...
 
void gwinSetDefaultBgColor (gColor bgclr)
 Set the default background color for all new GWIN windows. More...
 
gColor gwinGetDefaultBgColor (void)
 Get the default background color for all new GWIN windows. More...
 
void gwinSetDefaultFont (gFont font)
 Set the default font for all new GWIN windows. More...
 
gFont 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, gBool visible)
 Sets whether a window is visible or not. More...
 
gBool gwinGetVisible (GHandle gh)
 Gets the visibility of a window. More...
 
void gwinSetEnabled (GHandle gh, gBool enabled)
 Enable or disable a window. More...
 
gBool gwinGetEnabled (GHandle gh)
 Gets the enabled state of a window. More...
 
void gwinMove (GHandle gh, gCoord x, gCoord y)
 Move a window. More...
 
void gwinResize (GHandle gh, gCoord width, gCoord height)
 Resize a window. More...
 
void gwinRedraw (GHandle gh)
 Redraw a window. More...
 
void gwinRedrawDisplay (GDisplay *g, gBool 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, gBool flash)
 Set a window or widget to flash. More...
 
void gwinSetFont (GHandle gh, gFont font)
 Set the current font for this window. More...
 
void gwinClear (GHandle gh)
 Clear the window. More...
 
void gwinDrawPixel (GHandle gh, gCoord x, gCoord y)
 Set a pixel in the window. More...
 
void gwinDrawLine (GHandle gh, gCoord x0, gCoord y0, gCoord x1, gCoord y1)
 Draw a line in the window. More...
 
void gwinDrawBox (GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy)
 Draw a box in the window. More...
 
void gwinFillArea (GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy)
 Fill an rectangular area in the window. More...
 
void gwinBlitArea (GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord srcx, gCoord srcy, gCoord srccx, const gPixel *buffer)
 Fill an area in the window using the supplied bitmap. More...
 
void gwinDrawCircle (GHandle gh, gCoord x, gCoord y, gCoord radius)
 Draw a circle in the window. More...
 
void gwinFillCircle (GHandle gh, gCoord x, gCoord y, gCoord radius)
 Draw a filled circle in the window. More...
 
void gwinFillDualCircle (GHandle gh, gCoord x, gCoord y, gCoord radius1, gCoord radius2)
 Draw two filled circles with the same centre in the window. More...
 
void gwinDrawEllipse (GHandle gh, gCoord x, gCoord y, gCoord a, gCoord b)
 Draw an ellipse. More...
 
void gwinFillEllipse (GHandle gh, gCoord x, gCoord y, gCoord a, gCoord b)
 Draw an filled ellipse. More...
 
gColor gwinGetPixelColor (GHandle gh, gCoord x, gCoord y)
 Get the color of a pixel in the window. More...
 
void gwinDrawChar (GHandle gh, gCoord x, gCoord y, char c)
 Draw a text character at the specified position in the window. More...
 
void gwinFillChar (GHandle gh, gCoord x, gCoord y, char c)
 Draw a text character with a filled background at the specified position in the window. More...
 
void gwinDrawString (GHandle gh, gCoord x, gCoord y, const char *str)
 Draw a text string in the window. More...
 
void gwinFillString (GHandle gh, gCoord x, gCoord y, const char *str)
 Draw a text string with a filled background in the window. More...
 
void gwinDrawStringBox (GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gJustify justify)
 Draw a text string verticly centered within the specified box. More...
 
void gwinFillStringBox (GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gJustify justify)
 Draw a text string verticly centered within the specified filled box. More...
 
void gwinDrawPoly (GHandle gh, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt)
 Draw an enclosed polygon (convex, non-convex or complex). More...
 
void gwinFillConvexPoly (GHandle gh, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt)
 Fill a convex polygon. More...
 
void gwinDrawThickLine (GHandle gh, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gCoord width, gBool round)
 Draw a thick line in the window. More...
 
gdispImageError gwinDrawImage (GHandle gh, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord 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, gTrue)
 Makes a widget become visible. More...
 
#define gwinHide(gh)   gwinSetVisible(gh, gFalse)
 Makes a widget become invisible. More...
 
#define gwinEnable(gh)   gwinSetEnabled(gh, gTrue)
 Enables a widget. More...
 
#define gwinDisable(gh)   gwinSetEnabled(gh, gFalse)
 Disables a widget. More...
 
#define gwinFlash(gh)   gwinSetFlashing(gh, gTrue)
 Enables flashing of a window or widget. More...
 
#define gwinNoFlash(gh)   gwinSetFlashing(gh, gFalse)
 Disables a widget. More...
 

Enumerations

enum  GWindowMinMax
 A window's minimized, maximized or normal size. More...
 

Function Documentation

◆ gwinBlitArea()

void gwinBlitArea ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  cx,
gCoord  cy,
gCoord  srcx,
gCoord  srcy,
gCoord  srccx,
const gPixel 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 gFalse.
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.

◆ gwinClear()

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.

◆ gwinClearInit()

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.

◆ gwinDestroy()

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.

◆ gwinDrawBox()

void gwinDrawBox ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  cx,
gCoord  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.

◆ gwinDrawChar()

void gwinDrawChar ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinDrawCircle()

void gwinDrawCircle ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  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.

◆ gwinDrawEllipse()

void gwinDrawEllipse ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  a,
gCoord  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.

◆ gwinDrawImage()

gdispImageError gwinDrawImage ( GHandle  gh,
gImage img,
gCoord  x,
gCoord  y,
gCoord  cx,
gCoord  cy,
gCoord  sx,
gCoord  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.

◆ gwinDrawLine()

void gwinDrawLine ( GHandle  gh,
gCoord  x0,
gCoord  y0,
gCoord  x1,
gCoord  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.

◆ gwinDrawPixel()

void gwinDrawPixel ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinDrawPoly()

void gwinDrawPoly ( GHandle  gh,
gCoord  tx,
gCoord  ty,
const gPoint 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.

◆ gwinDrawString()

void gwinDrawString ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinDrawStringBox()

void gwinDrawStringBox ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  cx,
gCoord  cy,
const char *  str,
gJustify  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.

◆ gwinDrawThickLine()

void gwinDrawThickLine ( GHandle  gh,
gCoord  x0,
gCoord  y0,
gCoord  x1,
gCoord  y1,
gCoord  width,
gBool  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.

◆ gwinFillArea()

void gwinFillArea ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  cx,
gCoord  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.

◆ gwinFillChar()

void gwinFillChar ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinFillCircle()

void gwinFillCircle ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  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.

◆ gwinFillConvexPoly()

void gwinFillConvexPoly ( GHandle  gh,
gCoord  tx,
gCoord  ty,
const gPoint 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.

◆ gwinFillDualCircle()

void gwinFillDualCircle ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  radius1,
gCoord  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 GFXON 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.

◆ gwinFillEllipse()

void gwinFillEllipse ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  a,
gCoord  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.

◆ gwinFillString()

void gwinFillString ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinFillStringBox()

void gwinFillStringBox ( GHandle  gh,
gCoord  x,
gCoord  y,
gCoord  cx,
gCoord  cy,
const char *  str,
gJustify  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.

◆ gwinGetClassName()

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.

◆ gwinGetDefaultBgColor()

gColor 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.

◆ gwinGetDefaultColor()

gColor 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.

◆ gwinGetDefaultFont()

gFont 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.

◆ gwinGetEnabled()

gBool gwinGetEnabled ( GHandle  gh)

Gets the enabled state of a window.

Returns
gTrue if enabled
Note
It is possible for a child to be marked as enabled by gwinSetEnabled() but for this call to return gFalse 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.

◆ gwinGetMinMax()

GWindowMinMax gwinGetMinMax ( GHandle  gh)

Get the Minimized/Maximized state of a window.

Precondition
GWIN_NEED_WINDOWMANAGER must be GFXON
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.

◆ gwinGetNextWindow()

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.

◆ gwinGetPixelColor()

gColor gwinGetPixelColor ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinGetVisible()

gBool gwinGetVisible ( GHandle  gh)

Gets the visibility of a window.

Returns
gTrue if visible
Note
It is possible for a child to be marked as visible by gwinSetVisible() but for this call to return gFalse 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.

◆ gwinGWindowCreate()

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 GFX_WHITE and GFX_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.

◆ gwinMove()

void gwinMove ( GHandle  gh,
gCoord  x,
gCoord  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.

◆ gwinRaise()

void gwinRaise ( GHandle  gh)

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

Precondition
GWIN_NEED_WINDOWMANAGER must be GFXON
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.

◆ gwinRedraw()

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.

◆ gwinRedrawDisplay()

void gwinRedrawDisplay ( GDisplay *  g,
gBool  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.

◆ gwinResize()

void gwinResize ( GHandle  gh,
gCoord  width,
gCoord  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.

◆ gwinSetDefaultBgColor()

void gwinSetDefaultBgColor ( gColor  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.

◆ gwinSetDefaultColor()

void gwinSetDefaultColor ( gColor  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.

◆ gwinSetDefaultFont()

void gwinSetDefaultFont ( gFont  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.

◆ gwinSetEnabled()

void gwinSetEnabled ( GHandle  gh,
gBool  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.

◆ gwinSetFlashing()

void gwinSetFlashing ( GHandle  gh,
gBool  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 GFXON
Function Class: Normal API, this function can be invoked by regular system threads.

◆ gwinSetFont()

void gwinSetFont ( GHandle  gh,
gFont  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.

◆ gwinSetMinMax()

void gwinSetMinMax ( GHandle  gh,
GWindowMinMax  minmax 
)

Minimize, Maximize or Restore a window.

Precondition
GWIN_NEED_WINDOWMANAGER must be GFXON
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.

◆ gwinSetVisible()

void gwinSetVisible ( GHandle  gh,
gBool  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.

◆ gwinSetWindowManager()

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

◆ gwinDisable

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

Disables a widget.

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

Definition at line 409 of file gwin.h.

◆ gwinEnable

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

Enables a widget.

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

Definition at line 400 of file gwin.h.

◆ gwinFlash

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

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 577 of file gwin.h.

◆ gwinGetBgColor

#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 322 of file gwin.h.

◆ gwinGetClassID

#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 241 of file gwin.h.

◆ gwinGetColor

#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 313 of file gwin.h.

◆ gwinGetHeight

#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 281 of file gwin.h.

◆ gwinGetScreenX

#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 252 of file gwin.h.

◆ gwinGetScreenY

#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 263 of file gwin.h.

◆ gwinGetWidth

#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 272 of file gwin.h.

◆ gwinHide

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

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 363 of file gwin.h.

◆ gwinNoFlash

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

Disables a widget.

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

Definition at line 586 of file gwin.h.

◆ gwinSetBgColor

#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 304 of file gwin.h.

◆ gwinSetColor

#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 292 of file gwin.h.

◆ gwinShow

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

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 354 of file gwin.h.

Typedef Documentation

◆ GWindowInit

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.

◆ GWindowObject

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

◆ GWindowMinMax

A window's minimized, maximized or normal size.

Definition at line 90 of file gwin.h.