µGFX  2.9
version 2.9
gwin.c
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 /**
9  * @file src/gwin/gwin.c
10  * @brief GWIN sub-system code
11  */
12 
13 #include "../../gfx.h"
14 
15 #if GFX_USE_GWIN
16 
17 #include "gwin_class.h"
18 
19 #include <string.h>
20 
21 /*-----------------------------------------------
22  * Data
23  *-----------------------------------------------*/
24 
25 static const gwinVMT basegwinVMT = {
26  "GWIN", // The classname
27  sizeof(GWindowObject), // The object size
28  0, // The destroy routine
29  0, // The redraw routine
30  0, // The after-clear routine
31 };
32 
33 static gColor defaultFgColor = GFX_WHITE;
34 static gColor defaultBgColor = GFX_BLACK;
35 #if GDISP_NEED_TEXT
36  static gFont defaultFont;
37 #endif
38 
39 /* These init functions are defined by each module but not published */
40 extern void _gwmInit(void);
41 extern void _gwmDeinit(void);
42 #if GWIN_NEED_WIDGET
43  extern void _gwidgetInit(void);
44  extern void _gwidgetDeinit(void);
45 #endif
46 #if GWIN_NEED_CONTAINERS
47  extern void _gcontainerInit(void);
48  extern void _gcontainerDeinit(void);
49 #endif
50 
51 /*-----------------------------------------------
52  * Helper Routines
53  *-----------------------------------------------*/
54 
55 /*-----------------------------------------------
56  * Class Routines
57  *-----------------------------------------------*/
58 
59 void _gwinInit(void)
60 {
61  _gwmInit();
62 
63  #if GWIN_NEED_WIDGET
64  _gwidgetInit();
65  #endif
66 
67  #if GWIN_NEED_CONTAINERS
68  _gcontainerInit();
69  #endif
70 }
71 
72 void _gwinDeinit(void)
73 {
74  #if GWIN_NEED_CONTAINERS
75  _gcontainerDeinit();
76  #endif
77 
78  #if GWIN_NEED_WIDGET
79  _gwidgetDeinit();
80  #endif
81 
82  _gwmDeinit();
83 }
84 
85 // Internal routine for use by GWIN components only
86 // Initialise a window creating it dynamically if required.
87 GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, gU32 flags) {
88  // Allocate the structure if necessary
89  if (!pgw) {
90  if (!(pgw = gfxAlloc(vmt->size)))
91  return 0;
92  pgw->flags = flags|GWIN_FLG_DYNAMIC;
93  } else
94  pgw->flags = flags;
95 
96  // Initialise all basic fields
97  pgw->display = g;
98  pgw->vmt = vmt;
99  pgw->color = defaultFgColor;
100  pgw->bgcolor = defaultBgColor;
101  #if GDISP_NEED_TEXT
102  pgw->font = defaultFont;
103  #endif
104 
105  // Make sure we don't create nasty problems for ourselves
106  if (vmt->size > sizeof(GWindowObject))
107  memset(pgw+1, 0, vmt->size - sizeof(GWindowObject));
108 
109  if (!_gwinWMAdd(pgw, pInit)) {
110  if ((pgw->flags & GWIN_FLG_DYNAMIC))
111  gfxFree(pgw);
112  return 0;
113  }
114 
115  return (GHandle)pgw;
116 }
117 
118 // Internal routine for use by GWIN components only
119 void _gwinDestroy(GHandle gh, GRedrawMethod how) {
120  if (!gh)
121  return;
122 
123  // Make the window invisible
124  gwinSetVisible(gh, gFalse);
125 
126  // Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION
127  _gwinFlushRedraws(how);
128 
129  #if GWIN_NEED_CONTAINERS
130  // Notify the parent it is about to be deleted
131  if (gh->parent && ((gcontainerVMT *)gh->parent->vmt)->NotifyDelete)
132  ((gcontainerVMT *)gh->parent->vmt)->NotifyDelete(gh->parent, gh);
133  #endif
134 
135  // Remove from the window manager
136  #if GWIN_NEED_WINDOWMANAGER
137  _GWINwm->vmt->Delete(gh);
138  #endif
139 
140  // Class destroy routine
141  if (gh->vmt->Destroy)
142  gh->vmt->Destroy(gh);
143 
144  // Clean up the structure
145  if (gh->flags & GWIN_FLG_DYNAMIC) {
146  gh->flags = 0; // To be sure, to be sure
147  gfxFree((void *)gh);
148  } else
149  gh->flags = 0; // To be sure, to be sure
150 }
151 
152 /*-----------------------------------------------
153  * Routines that affect all windows
154  *-----------------------------------------------*/
155 
156 void gwinClearInit(GWindowInit *pwi) {
157  char *p;
158  unsigned len;
159 
160  for(p = (char *)pwi, len = sizeof(GWindowInit); len; len--)
161  *p++ = 0;
162 }
163 
164 void gwinSetDefaultColor(gColor clr) {
165  defaultFgColor = clr;
166 }
167 
169  return defaultFgColor;
170 }
171 
172 void gwinSetDefaultBgColor(gColor bgclr) {
173  defaultBgColor = bgclr;
174 }
175 
177  return defaultBgColor;
178 }
179 
180 #if GDISP_NEED_TEXT
181  void gwinSetDefaultFont(gFont font) {
182  defaultFont = font;
183  }
184 
185  gFont gwinGetDefaultFont(void) {
186  return defaultFont;
187  }
188 #endif
189 
190 /*-----------------------------------------------
191  * The GWindow Routines
192  *-----------------------------------------------*/
193 
194 GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit) {
195  if (!(pgw = _gwindowCreate(g, pgw, pInit, &basegwinVMT, 0)))
196  return 0;
197 
198  gwinSetVisible(pgw, pInit->show);
199  _gwinFlushRedraws(REDRAW_WAIT);
200 
201  return pgw;
202 }
203 
204 void gwinDestroy(GHandle gh) {
205  _gwinDestroy(gh, REDRAW_WAIT);
206 }
207 
208 const char *gwinGetClassName(GHandle gh) {
209  return gh->vmt->classname;
210 }
211 
212 gBool gwinGetVisible(GHandle gh) {
213  return (gh->flags & GWIN_FLG_SYSVISIBLE) ? gTrue : gFalse;
214 }
215 
216 gBool gwinGetEnabled(GHandle gh) {
217  return (gh->flags & GWIN_FLG_SYSENABLED) ? gTrue : gFalse;
218 }
219 
220 #if GDISP_NEED_TEXT
221  void gwinSetFont(GHandle gh, gFont font) {
222  gh->font = font;
223  }
224 #endif
225 
226 void gwinClear(GHandle gh) {
227  /*
228  * Don't render anything when the window is not visible but
229  * still call the AfterClear() routine as some widgets will
230  * need this to clear internal buffers or similar
231  */
232  if (_gwinDrawStart(gh)) {
233  gdispGFillArea(gh->display, gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
234  _gwinDrawEnd(gh);
235  }
236  if (gh->vmt->AfterClear)
237  gh->vmt->AfterClear(gh);
238 }
239 
240 void gwinDrawPixel(GHandle gh, gCoord x, gCoord y) {
241  if (!_gwinDrawStart(gh)) return;
242  gdispGDrawPixel(gh->display, gh->x+x, gh->y+y, gh->color);
243  _gwinDrawEnd(gh);
244 }
245 
246 void gwinDrawLine(GHandle gh, gCoord x0, gCoord y0, gCoord x1, gCoord y1) {
247  if (!_gwinDrawStart(gh)) return;
248  gdispGDrawLine(gh->display, gh->x+x0, gh->y+y0, gh->x+x1, gh->y+y1, gh->color);
249  _gwinDrawEnd(gh);
250 }
251 
252 void gwinDrawBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy) {
253  if (!_gwinDrawStart(gh)) return;
254  gdispGDrawBox(gh->display, gh->x+x, gh->y+y, cx, cy, gh->color);
255  _gwinDrawEnd(gh);
256 }
257 
258 void gwinFillArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy) {
259  if (!_gwinDrawStart(gh)) return;
260  gdispGFillArea(gh->display, gh->x+x, gh->y+y, cx, cy, gh->color);
261  _gwinDrawEnd(gh);
262 }
263 
264 void gwinBlitArea(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord srcx, gCoord srcy, gCoord srccx, const gPixel *buffer) {
265  if (!_gwinDrawStart(gh)) return;
266  gdispGBlitArea(gh->display, gh->x+x, gh->y+y, cx, cy, srcx, srcy, srccx, buffer);
267  _gwinDrawEnd(gh);
268 }
269 
270 #if GDISP_NEED_CIRCLE
271  void gwinDrawCircle(GHandle gh, gCoord x, gCoord y, gCoord radius) {
272  if (!_gwinDrawStart(gh)) return;
273  gdispGDrawCircle(gh->display, gh->x+x, gh->y+y, radius, gh->color);
274  _gwinDrawEnd(gh);
275  }
276 
277  void gwinFillCircle(GHandle gh, gCoord x, gCoord y, gCoord radius) {
278  if (!_gwinDrawStart(gh)) return;
279  gdispGFillCircle(gh->display, gh->x+x, gh->y+y, radius, gh->color);
280  _gwinDrawEnd(gh);
281  }
282 #endif
283 
284 #if GDISP_NEED_DUALCIRCLE
285  void gwinFillDualCircle(GHandle gh, gCoord x, gCoord y, gCoord radius1, gCoord radius2) {
286  if (!_gwinDrawStart(gh)) return;
287  gdispGFillDualCircle(gh->display, gh->x+x, gh->y+y, radius1, gh->bgcolor, radius2, gh->color);
288  _gwinDrawEnd(gh);
289  }
290 #endif
291 
292 #if GDISP_NEED_ELLIPSE
293  void gwinDrawEllipse(GHandle gh, gCoord x, gCoord y, gCoord a, gCoord b) {
294  if (!_gwinDrawStart(gh)) return;
295  gdispGDrawEllipse(gh->display, gh->x+x, gh->y+y, a, b, gh->color);
296  _gwinDrawEnd(gh);
297  }
298 
299  void gwinFillEllipse(GHandle gh, gCoord x, gCoord y, gCoord a, gCoord b) {
300  if (!_gwinDrawStart(gh)) return;
301  gdispGFillEllipse(gh->display, gh->x+x, gh->y+y, a, b, gh->color);
302  _gwinDrawEnd(gh);
303  }
304 #endif
305 
306 #if GDISP_NEED_ARC
307  void gwinDrawArc(GHandle gh, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle) {
308  if (!_gwinDrawStart(gh)) return;
309  gdispGDrawArc(gh->display, gh->x+x, gh->y+y, radius, startangle, endangle, gh->color);
310  _gwinDrawEnd(gh);
311  }
312 
313  void gwinFillArc(GHandle gh, gCoord x, gCoord y, gCoord radius, gCoord startangle, gCoord endangle) {
314  if (!_gwinDrawStart(gh)) return;
315  gdispGFillArc(gh->display, gh->x+x, gh->y+y, radius, startangle, endangle, gh->color);
316  _gwinDrawEnd(gh);
317  }
318 
319  void gwinDrawThickArc(GHandle gh, gCoord x, gCoord y, gCoord startradius, gCoord endradius, gCoord startangle, gCoord endangle) {
320  if (!_gwinDrawStart(gh)) return;
321  gdispGDrawThickArc(gh->display, gh->x+x, gh->y+y, startradius, endradius, startangle, endangle, gh->color);
322  _gwinDrawEnd(gh);
323  }
324 #endif
325 
326 #if GDISP_NEED_ARCSECTORS
327  void gwinDrawArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, gU8 sectors) {
328  if (!_gwinDrawStart(gh)) return;
329  gdispGDrawArcSectors(gh->display, gh->x+x, gh->y+y, radius, sectors, gh->color);
330  _gwinDrawEnd(gh);
331  }
332 
333  void gwinFillArcSectors(GHandle gh, gCoord x, gCoord y, gCoord radius, gU8 sectors) {
334  if (!_gwinDrawStart(gh)) return;
335  gdispGFillArcSectors(gh->display, gh->x+x, gh->y+y, radius, sectors, gh->color);
336  _gwinDrawEnd(gh);
337  }
338 #endif
339 
340 #if GDISP_NEED_PIXELREAD
342  if (!_gwinDrawStart(gh)) return (gColor)0;
343  return gdispGGetPixelColor(gh->display, gh->x+x, gh->y+y);
344  _gwinDrawEnd(gh);
345  }
346 #endif
347 
348 #if GDISP_NEED_TEXT
349  void gwinDrawChar(GHandle gh, gCoord x, gCoord y, char c) {
350  if (!gh->font || !_gwinDrawStart(gh)) return;
351  gdispGDrawChar(gh->display, gh->x+x, gh->y+y, c, gh->font, gh->color);
352  _gwinDrawEnd(gh);
353  }
354 
355  void gwinFillChar(GHandle gh, gCoord x, gCoord y, char c) {
356  if (!gh->font || !_gwinDrawStart(gh)) return;
357  gdispGFillChar(gh->display, gh->x+x, gh->y+y, c, gh->font, gh->color, gh->bgcolor);
358  _gwinDrawEnd(gh);
359  }
360 
361  void gwinDrawString(GHandle gh, gCoord x, gCoord y, const char *str) {
362  if (!gh->font || !_gwinDrawStart(gh)) return;
363  gdispGDrawString(gh->display, gh->x+x, gh->y+y, str, gh->font, gh->color);
364  _gwinDrawEnd(gh);
365  }
366 
367  void gwinFillString(GHandle gh, gCoord x, gCoord y, const char *str) {
368  if (!gh->font || !_gwinDrawStart(gh)) return;
369  gdispGFillString(gh->display, gh->x+x, gh->y+y, str, gh->font, gh->color, gh->bgcolor);
370  _gwinDrawEnd(gh);
371  }
372 
373  void gwinDrawStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gJustify justify) {
374  if (!gh->font || !_gwinDrawStart(gh)) return;
375  gdispGDrawStringBox(gh->display, gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, justify);
376  _gwinDrawEnd(gh);
377  }
378 
379  void gwinFillStringBox(GHandle gh, gCoord x, gCoord y, gCoord cx, gCoord cy, const char* str, gJustify justify) {
380  if (!gh->font || !_gwinDrawStart(gh)) return;
381  gdispGFillStringBox(gh->display, gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, gh->bgcolor, justify);
382  _gwinDrawEnd(gh);
383  }
384 #endif
385 
386 #if GDISP_NEED_CONVEX_POLYGON
387  void gwinDrawPoly(GHandle gh, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt) {
388  if (!_gwinDrawStart(gh)) return;
389  gdispGDrawPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
390  _gwinDrawEnd(gh);
391  }
392 
393  void gwinFillConvexPoly(GHandle gh, gCoord tx, gCoord ty, const gPoint *pntarray, unsigned cnt) {
394  if (!_gwinDrawStart(gh)) return;
395  gdispGFillConvexPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
396  _gwinDrawEnd(gh);
397  }
398  void gwinDrawThickLine(GHandle gh, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gCoord width, gBool round) {
399  if (!_gwinDrawStart(gh)) return;
400  gdispGDrawThickLine(gh->display, gh->x+x0, gh->y+y0, gh->x+x1, gh->y+y1, gh->color, width, round);
401  _gwinDrawEnd(gh);
402  }
403 #endif
404 
405 #if GDISP_NEED_IMAGE
407  gdispImageError ret;
408 
409  if (!_gwinDrawStart(gh)) return GDISP_IMAGE_ERR_OK;
410  ret = gdispGImageDraw(gh->display, img, gh->x+x, gh->y+y, cx, cy, sx, sy);
411  _gwinDrawEnd(gh);
412  return ret;
413  }
414 #endif
415 
416 #endif /* GFX_USE_GWIN */
COLOR_TYPE gColor
The color type definition.
Definition: gdisp_colors.h:437
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.
Definition: gdisp.h:93
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.
Definition: gdisp.h:226
gJustify
Type for the text justification.
Definition: gdisp.h:60
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.
Definition: gdisp.h:39
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.
Definition: gdisp_image.h:37
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.
Definition: gwin.h:75
gBool show
Definition: gwin.h:80
A window object structure.
Definition: gwin.h:40
gColor bgcolor
Definition: gwin.h:52
GDisplay * display
Definition: gwin.h:46
gCoord x
Definition: gwin.h:47
gColor color
Definition: gwin.h:51
gCoord width
Definition: gwin.h:49
const struct gwinVMT * vmt
Definition: gwin.h:45
gU32 flags
Definition: gwin.h:53
gCoord y
Definition: gwin.h:48
gCoord height
Definition: gwin.h:50
The structure for an image.
Definition: gdisp_image.h:59
Type for a 2D point on the screen.
Definition: gdisp.h:51
The Virtual Method Table for a container.
Definition: gwin_class.h:132
The Virtual Method Table for a GWIN window.
Definition: gwin_class.h:55
gMemSize size
Definition: gwin_class.h:57
void(* AfterClear)(GWindowObject *gh)
Definition: gwin_class.h:60
const char * classname
Definition: gwin_class.h:56
void(* Destroy)(GWindowObject *gh)
Definition: gwin_class.h:58