![]() |
µGFX
2.9
version 2.9
|
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.
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... | |
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
gdispIsBusy()
going gFalse. [in] | gh | The window handle |
[in] | x,y | The start filled area |
[in] | cx,cy | The width and height to be filled |
[in] | srcx,srcy | The bitmap position to start the fill from |
[in] | srccx | The width of a line in the bitmap. |
[in] | buffer | The pixels to use to fill the area. |
void gwinClear | ( | GHandle | gh | ) |
Clear the window.
[in] | gh | The window handle |
void gwinClearInit | ( | GWindowInit * | pwi | ) |
Clear a GWindowInit structure to all zero's.
[in] | pwi | The GWindowInit structure to clear |
void gwinDestroy | ( | GHandle | gh | ) |
Destroy a window (of any type). Releases any dynamically allocated memory.
[in] | gh | The window handle |
Draw a box in the window.
[in] | gh | The window handle |
[in] | x,y | The start position |
[in] | cx,cy | The size of the box (outside dimensions) |
Draw a text character at the specified position in the window.
[in] | gh | The window handle |
[in] | x,y | The position for the text |
[in] | c | The character to draw |
Draw a circle in the window.
[in] | gh | The window handle |
[in] | x,y | The center of the circle |
[in] | radius | The radius of the circle |
Draw an ellipse.
[in] | gh | The window handle |
[in] | x,y | The center of the ellipse |
[in] | a,b | The dimensions of the ellipse |
gdispImageError gwinDrawImage | ( | GHandle | gh, |
gImage * | img, | ||
gCoord | x, | ||
gCoord | y, | ||
gCoord | cx, | ||
gCoord | cy, | ||
gCoord | sx, | ||
gCoord | sy | ||
) |
Draw the image.
[in] | gh | The window handle |
[in] | img | The image structure |
[in] | x,y | The window location to draw the image |
[in] | cx,cy | The area on the screen to draw |
[in] | sx,sy | The image position to start drawing at |
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)Draw a line in the window.
[in] | gh | The window handle |
[in] | x0,y0 | The start position |
[in] | x1,y1 | The end position |
Set a pixel in the window.
[in] | gh | The window handle |
[in] | x,y | The coordinates of the pixel |
Draw an enclosed polygon (convex, non-convex or complex).
[in] | gh | The window handle |
[in] | tx,ty | Transform all points in pntarray by tx, ty |
[in] | pntarray | An array of points |
[in] | cnt | The number of points in the array |
Draw a text string in the window.
[in] | gh | The window handle |
[in] | x,y | The position for the text |
[in] | str | The string to draw |
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.
[in] | gh | The window handle |
[in] | x,y | The position for the text (need to define top-right or base-line - check code) |
[in] | cx,cy | The width and height of the box |
[in] | str | The string to draw |
[in] | justify | Justify the text left, center or right within the box |
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.
[in] | gh | The window handle |
[in] | x0,y0 | The start position |
[in] | x1,y1 | The end position |
[in] | width | The width of the line |
[in] | round | Use round ends for the line |
Fill an rectangular area in the window.
[in] | gh | The window handle |
[in] | x,y | The start position |
[in] | cx,cy | The size of the box (outside dimensions) |
Draw a text character with a filled background at the specified position in the window.
[in] | gh | The window handle |
[in] | x,y | The position for the text |
[in] | c | The character to draw |
Draw a filled circle in the window.
[in] | gh | The window handle |
[in] | x,y | The center of the circle |
[in] | radius | The radius of the circle |
Fill a convex polygon.
Doesn't handle non-convex or complex polygons.
[in] | gh | The window handle |
[in] | tx,ty | Transform all points in pntarray by tx, ty |
[in] | pntarray | An array of points |
[in] | cnt | The number of points in the array |
Draw two filled circles with the same centre in the window.
[in] | gh | The window handle |
[in] | x,y | The center of the circle |
[in] | radius1 | The radius of the larger circle |
[in] | radius2 | The radius of the smaller circle |
Draw an filled ellipse.
[in] | gh | The window handle |
[in] | x,y | The center of the ellipse |
[in] | a,b | The dimensions of the ellipse |
Draw a text string with a filled background in the window.
[in] | gh | The window handle |
[in] | x,y | The position for the text |
[in] | str | The string to draw |
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.
[in] | gh | The window handle |
[in] | x,y | The position for the text (need to define top-right or base-line - check code) |
[in] | cx,cy | The width and height of the box |
[in] | str | The string to draw |
[in] | justify | Justify the text left, center or right within the box |
const char* gwinGetClassName | ( | GHandle | gh | ) |
Get the real class name of the GHandle.
Returns a string describing the object class.
[in] | gh | The window |
gColor gwinGetDefaultBgColor | ( | void | ) |
Get the default background color for all new GWIN windows.
gColor gwinGetDefaultColor | ( | void | ) |
Get the default foreground color for all new GWIN windows.
gFont gwinGetDefaultFont | ( | void | ) |
Get the current default font.
gBool gwinGetEnabled | ( | GHandle | gh | ) |
Gets the enabled state of a window.
gwinSetEnabled()
but for this call to return gFalse if one of its parents are not enabled.[in] | gh | The window |
GWindowMinMax gwinGetMinMax | ( | GHandle | gh | ) |
Get the Minimized/Maximized state of a window.
[in] | gh | The window |
Get the next window in the z-order.
[in] | gh | The previous window or NULL to get the first window |
Get the color of a pixel in the window.
[in] | gh | The window handle |
[in] | x,y | The position in the window |
gBool gwinGetVisible | ( | GHandle | gh | ) |
Gets the visibility of a window.
gwinSetVisible()
but for this call to return gFalse if one of its parents are not visible.[in] | gh | The window |
GHandle gwinGWindowCreate | ( | GDisplay * | g, |
GWindowObject * | pgw, | ||
const GWindowInit * | pInit | ||
) |
Create a basic window.
[in] | g | The GDisplay to display this window on |
[in] | pgw | The window structure to initialize. If this is NULL the structure is dynamically allocated. |
[in] | pInit | How to initialise the window |
gwinSetDefaultColor()
or gwinSetDefaultBgColor()
then these are GFX_WHITE and GFX_BLACK respectively. gwinSetDefaultFont()
then there is no default font and text drawing operations will no nothing. Move a window.
[in] | gh | The window |
[in] | x,y | The new position (screen relative) for this window |
gwinSetVisible()
with regard to what can be redrawn and what can't. void gwinRaise | ( | GHandle | gh | ) |
Raise a window to the top of the z-order.
[in] | gh | The window |
gwinSetVisible()
with regard to what can be redrawn and what can't.void gwinRedraw | ( | GHandle | gh | ) |
Redraw a window.
[in] | gh | The window |
void gwinRedrawDisplay | ( | GDisplay * | g, |
gBool | preserve | ||
) |
Redraw a display.
[in] | g | The display to redraw. Passing NULL will redraw all displays. |
[in] | preserve | Should the redraw try to preserve existing screen data for those windows that can't redraw themselves? |
Resize a window.
[in] | gh | The window |
[in] | width,height | The new size of the window |
gwinSetVisible()
with regard to what can be redrawn and what can't. void gwinSetDefaultBgColor | ( | gColor | bgclr | ) |
Set the default background color for all new GWIN windows.
[in] | bgclr | The background color |
void gwinSetDefaultColor | ( | gColor | clr | ) |
Set the default foreground color for all new GWIN windows.
[in] | clr | The color to be set |
void gwinSetDefaultFont | ( | gFont | font | ) |
Set the default font for all new GWIN windows.
[in] | font | The new font to be set |
void gwinSetEnabled | ( | GHandle | gh, |
gBool | enabled | ||
) |
Enable or disable a window.
[in] | gh | The window handle |
[in] | enabled | Enable or disable the window |
void gwinSetFlashing | ( | GHandle | gh, |
gBool | flash | ||
) |
Set a window or widget to flash.
[in] | gh | The window handle |
[in] | flash | Enable or disable the flashing of the window |
Set the current font for this window.
[in] | gh | The window handle |
[in] | font | The font to use for text functions |
void gwinSetMinMax | ( | GHandle | gh, |
GWindowMinMax | minmax | ||
) |
Minimize, Maximize or Restore a window.
[in] | gh | The window |
[in] | minmax | The new minimized/maximized state |
gwinSetVisible()
with regard to what can be redrawn and what can't. void gwinSetVisible | ( | GHandle | gh, |
gBool | visible | ||
) |
Sets whether a window is visible or not.
[in] | gh | The window |
[in] | visible | Whether the window should be visible or not |
void gwinSetWindowManager | ( | struct GWindowManager * | gwm | ) |
Set the window manager for the GWIN system.
[in] | gwm | The window manager to use. Can be NULL to turn off the existing window manager. |
#define gwinDisable | ( | gh | ) | gwinSetEnabled(gh, gFalse) |
#define gwinEnable | ( | gh | ) | gwinSetEnabled(gh, gTrue) |
#define gwinFlash | ( | gh | ) | gwinSetFlashing(gh, gTrue) |
#define gwinGetBgColor | ( | gh | ) | (gh)->bgcolor |
#define gwinGetClassID | ( | gh | ) | ((void *)((gh)->vmt)) |
#define gwinGetColor | ( | gh | ) | (gh)->color |
#define gwinGetHeight | ( | gh | ) | ((gh)->height) |
#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.
[in] | gh | The window |
#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.
[in] | gh | The window |
#define gwinGetWidth | ( | gh | ) | ((gh)->width) |
#define gwinHide | ( | gh | ) | gwinSetVisible(gh, gFalse) |
#define gwinNoFlash | ( | gh | ) | gwinSetFlashing(gh, gFalse) |
#define gwinSetBgColor | ( | gh, | |
bgclr | |||
) | (gh)->bgcolor = (bgclr) |
Set background color.
Set the color which will be used as background
[in] | gh | The window |
[in] | bgclr | The background color |
#define gwinSetColor | ( | gh, | |
clr | |||
) | (gh)->color = (clr) |
#define gwinShow | ( | gh | ) | gwinSetVisible(gh, gTrue) |
typedef struct GWindowInit GWindowInit |
The structure to initialise a GWIN.
gwinClearInit()
to clear it. typedef struct GWindowObject GWindowObject |
A window object structure.
enum GWindowMinMax |