13 #include "../../gfx.h"
17 #include "gwin_class.h"
25 static const gwinVMT basegwinVMT = {
33 static gColor defaultFgColor = GFX_WHITE;
34 static gColor defaultBgColor = GFX_BLACK;
36 static gFont defaultFont;
40 extern void _gwmInit(
void);
41 extern void _gwmDeinit(
void);
43 extern void _gwidgetInit(
void);
44 extern void _gwidgetDeinit(
void);
46 #if GWIN_NEED_CONTAINERS
47 extern void _gcontainerInit(
void);
48 extern void _gcontainerDeinit(
void);
67 #if GWIN_NEED_CONTAINERS
72 void _gwinDeinit(
void)
74 #if GWIN_NEED_CONTAINERS
92 pgw->
flags = flags|GWIN_FLG_DYNAMIC;
99 pgw->
color = defaultFgColor;
102 pgw->font = defaultFont;
109 if (!_gwinWMAdd(pgw, pInit)) {
110 if ((pgw->
flags & GWIN_FLG_DYNAMIC))
119 void _gwinDestroy(
GHandle gh, GRedrawMethod how) {
127 _gwinFlushRedraws(how);
129 #if GWIN_NEED_CONTAINERS
136 #if GWIN_NEED_WINDOWMANAGER
137 _GWINwm->vmt->Delete(gh);
145 if (gh->
flags & GWIN_FLG_DYNAMIC) {
160 for(p = (
char *)pwi, len =
sizeof(
GWindowInit); len; len--)
165 defaultFgColor = clr;
169 return defaultFgColor;
173 defaultBgColor = bgclr;
177 return defaultBgColor;
195 if (!(pgw = _gwindowCreate(g, pgw, pInit, &basegwinVMT, 0)))
199 _gwinFlushRedraws(REDRAW_WAIT);
205 _gwinDestroy(gh, REDRAW_WAIT);
213 return (gh->
flags & GWIN_FLG_SYSVISIBLE) ? gTrue : gFalse;
217 return (gh->
flags & GWIN_FLG_SYSENABLED) ? gTrue : gFalse;
232 if (_gwinDrawStart(gh)) {
241 if (!_gwinDrawStart(gh))
return;
247 if (!_gwinDrawStart(gh))
return;
253 if (!_gwinDrawStart(gh))
return;
259 if (!_gwinDrawStart(gh))
return;
265 if (!_gwinDrawStart(gh))
return;
270 #if GDISP_NEED_CIRCLE
272 if (!_gwinDrawStart(gh))
return;
278 if (!_gwinDrawStart(gh))
return;
284 #if GDISP_NEED_DUALCIRCLE
286 if (!_gwinDrawStart(gh))
return;
292 #if GDISP_NEED_ELLIPSE
294 if (!_gwinDrawStart(gh))
return;
300 if (!_gwinDrawStart(gh))
return;
308 if (!_gwinDrawStart(gh))
return;
314 if (!_gwinDrawStart(gh))
return;
320 if (!_gwinDrawStart(gh))
return;
326 #if GDISP_NEED_ARCSECTORS
328 if (!_gwinDrawStart(gh))
return;
334 if (!_gwinDrawStart(gh))
return;
340 #if GDISP_NEED_PIXELREAD
342 if (!_gwinDrawStart(gh))
return (
gColor)0;
350 if (!gh->font || !_gwinDrawStart(gh))
return;
356 if (!gh->font || !_gwinDrawStart(gh))
return;
362 if (!gh->font || !_gwinDrawStart(gh))
return;
368 if (!gh->font || !_gwinDrawStart(gh))
return;
374 if (!gh->font || !_gwinDrawStart(gh))
return;
380 if (!gh->font || !_gwinDrawStart(gh))
return;
386 #if GDISP_NEED_CONVEX_POLYGON
388 if (!_gwinDrawStart(gh))
return;
394 if (!_gwinDrawStart(gh))
return;
399 if (!_gwinDrawStart(gh))
return;
409 if (!_gwinDrawStart(gh))
return GDISP_IMAGE_ERR_OK;
COLOR_TYPE gColor
The color type definition.
void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color)
Draw a selection of 45 degree arcs of a circle.
void gdispGDrawPixel(GDisplay *g, gCoord x, gCoord y, gColor color)
Set a pixel in the specified color.
void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color, gColor bgcolor)
Draw a text character with a filled background.
void gdispGFillCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color)
Draw a filled circle.
void gdispGDrawPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color)
Draw an enclosed polygon (convex, non-convex or complex).
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gJustify justify)
Draw a text string vertically centered within the specified box.
void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color)
Draw an ellipse.
const struct mf_font_s * gFont
The type of a font.
void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord srcx, gCoord srcy, gCoord srccx, const gPixel *buffer)
Fill an area using the supplied bitmap.
gColor gPixel
The pixel format.
gJustify
Type for the text justification.
void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color)
Fill a selection of 45 degree arcs of a circle.
void gdispGDrawThickArc(GDisplay *g, gCoord xc, gCoord yc, gCoord startradius, gCoord endradius, gCoord startangle, gCoord endangle, gColor color)
Draw a thick arc.
void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color)
Draw a filled ellipse.
void gdispGDrawCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius, gColor color)
Draw a circle.
void gdispGFillArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, gColor color)
Draw a filled arc.
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color)
Draw a text character.
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color)
Draw a line.
void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle, gColor color)
Draw an arc.
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gColor bgColor, gJustify justify)
Draw a text string vertically centered within the specified box. The box background is filled with th...
gColor gdispGGetPixelColor(GDisplay *g, gCoord x, gCoord y)
Get the color of a pixel.
void gdispGDrawString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color)
Draw a text string.
void gdispGDrawThickLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color, gCoord width, gBool round)
Draw a line with a specified thickness.
void gdispGFillDualCircle(GDisplay *g, gCoord x, gCoord y, gCoord radius1, gColor color1, gCoord radius2, gColor color2)
Draw two filled circles with the same centre.
void gdispGFillString(GDisplay *g, gCoord x, gCoord y, const char *str, gFont font, gColor color, gColor bgcolor)
Draw a text string.
gI16 gCoord
The type for a coordinate or length on the screen.
void gdispGFillConvexPoly(GDisplay *g, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt, gColor color)
Fill a convex polygon.
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Draw a rectangular box.
void * gfxAlloc(gMemSize sz)
Allocate memory.
void gfxFree(void *ptr)
Free memory.
gdispImageError gdispGImageDraw(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy)
Draw the image.
gU16 gdispImageError
An image error code.
void gwinDrawBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy)
Draw a box in the window.
struct GWindowObject GWindowObject
A window object structure.
void gwinFillEllipse(GHandle gh, gCoord x, gCoord y, gCoord a, gCoord b)
Draw an filled ellipse.
void gwinDrawPoly(GHandle gh, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt)
Draw an enclosed polygon (convex, non-convex or complex).
void gwinDrawCircle(GHandle gh, gCoord x, gCoord y, gCoord radius)
Draw a circle in the window.
void gwinDrawPixel(GHandle gh, gCoord x, gCoord y)
Set a pixel in the window.
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.
gBool gwinGetEnabled(GHandle gh)
Gets the enabled state of a window.
void gwinFillConvexPoly(GHandle gh, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt)
Fill a convex polygon.
void gwinDrawChar(GHandle gh, gCoord x, gCoord y, char c)
Draw a text character at the specified position in the window.
void gwinDrawString(GHandle gh, gCoord x, gCoord y, const char *str)
Draw a text string in the window.
void gwinSetDefaultFont(gFont font)
Set the default font for all new GWIN windows.
void gwinDrawEllipse(GHandle gh, gCoord x, gCoord y, gCoord a, gCoord b)
Draw an ellipse.
void gwinClear(GHandle gh)
Clear the window.
void gwinClearInit(GWindowInit *pwi)
Clear a GWindowInit structure to all zero's.
gFont gwinGetDefaultFont(void)
Get the current default font.
void gwinFillArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy)
Fill an rectangular area in the window.
void gwinFillDualCircle(GHandle gh, gCoord x, gCoord y, gCoord radius1, gCoord radius2)
Draw two filled circles with the same centre in the window.
void gwinDestroy(GHandle gh)
Destroy a window (of any type). Releases any dynamically allocated memory.
void gwinFillCircle(GHandle gh, gCoord x, gCoord y, gCoord radius)
Draw a filled circle in the window.
void gwinSetVisible(GHandle gh, gBool visible)
Sets whether a window is visible or not.
void gwinSetFont(GHandle gh, gFont font)
Set the current font for this window.
GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit)
Create a basic window.
gColor gwinGetDefaultColor(void)
Get the default foreground color for all new GWIN windows.
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.
const char * gwinGetClassName(GHandle gh)
Get the real class name of the GHandle.
gdispImageError gwinDrawImage(GHandle gh, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy)
Draw the image.
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.
void gwinSetDefaultColor(gColor clr)
Set the default foreground color for all new GWIN windows.
gColor gwinGetDefaultBgColor(void)
Get the default background color for all new GWIN windows.
void gwinDrawLine(GHandle gh, gCoord x0, gCoord y0, gCoord x1, gCoord y1)
Draw a line in the window.
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.
void gwinSetDefaultBgColor(gColor bgclr)
Set the default background color for all new GWIN windows.
void gwinFillString(GHandle gh, gCoord x, gCoord y, const char *str)
Draw a text string with a filled background in the window.
gColor gwinGetPixelColor(GHandle gh, gCoord x, gCoord y)
Get the color of a pixel in the window.
void gwinDrawThickLine(GHandle gh, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gCoord width, gBool round)
Draw a thick line in the window.
gBool gwinGetVisible(GHandle gh)
Gets the visibility of a window.
The structure to initialise a GWIN.
A window object structure.
const struct gwinVMT * vmt
The structure for an image.
Type for a 2D point on the screen.
The Virtual Method Table for a container.
The Virtual Method Table for a GWIN window.
void(* AfterClear)(GWindowObject *gh)
void(* Destroy)(GWindowObject *gh)