version 2.8
gwin_tabset.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.org/license.html
6  */
7 
8 /**
9  * @file src/gwin/gwin_tabset.c
10  * @brief GWIN sub-system tabset code.
11  */
12 
13 #include "../../gfx.h"
14 
15 #if GFX_USE_GWIN && GWIN_NEED_TABSET
16 
17 #include "gwin_class.h"
18 
19 #include <string.h>
20 
21 // Some position values
22 #define GTABSET_BORDER 2
23 #define GTABSET_TXT_PAD 5
24 
25 // Some color blending
26 #define GTABSET_TAB_CNR 8 // Diagonal corner on active tab
27 #define GTABSET_TOP_FADE 50 // (GTABSET_TOP_FADE/255)% fade to white for top of tab/button
28 #define GTABSET_BOTTOM_FADE 25 // (GTABSET_BOTTOM_FADE/255)% fade to black for bottom of tab/button
29 #define GTABSET_OUTLINE_FADE 128 // (GTABSET_OUTLINE_FADE/255)% fade to background for active tab edge
30 
31 /* Internal state flags */
32 #define GWIN_TABSET_USER_FLAGS (GWIN_TABSET_BORDER)
33 #if GWIN_TABSET_BORDER < GWIN_FIRST_CONTROL_FLAG
34  #error "GWIN Tabset: - Flag definitions don't match"
35 #endif
36 #if GWIN_TABSET_BORDER > GWIN_LAST_CONTROL_FLAG
37  #error "GWIN Tabset: - Flag definitions don't match"
38 #endif
39 
40 /********************************************************************************************************************
41  * Tab-page stuff
42  */
43 
44 static void FixTabSizePos(GHandle gh);
45 
46 typedef GContainerObject GTabpageObject;
47 
48 static coord_t TabpageBorderSize(GHandle gh) { (void)gh; return 0; }
49 
50 static void gwinTabpageDraw_Std(GWidgetObject *gw, void *param) {
51  (void)gw;
52  (void)param;
53 
54  // The page is effectively transparent
55 }
56 
57 static void TabpageDestroy(GHandle gh) {
58  _gcontainerDestroy(gh);
59 
60  FixTabSizePos(gh->parent);
61 }
62 
63 static const gcontainerVMT tabpageVMT = {
64  {
65  {
66  "Tabpage", // The classname
67  sizeof(GTabpageObject), // The object size
68  TabpageDestroy, // The destroy routine
69  _gcontainerRedraw, // The redraw routine
70  0, // The after-clear routine
71  },
72  gwinTabpageDraw_Std, // The default drawing routine
74  {
75  0, // Process mouse down event
76  0, // Process mouse up events
77  0, // Process mouse move events
78  },
79  #endif
80  #if GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD
81  {
82  0 // Process keyboard events
83  },
84  #endif
85  #if GINPUT_NEED_TOGGLE
86  {
87  0, // 1 toggle role
88  0, // Assign Toggles
89  0, // Get Toggles
90  0, // Process toggle off events
91  0, // Process toggle on events
92  },
93  #endif
94  #if GINPUT_NEED_DIAL
95  {
96  0, // 1 dial roles
97  0, // Assign Dials
98  0, // Get Dials
99  0, // Process dial move events
100  },
101  #endif
102  },
103  TabpageBorderSize, // The size of the left border (mandatory)
104  TabpageBorderSize, // The size of the top border (mandatory)
105  TabpageBorderSize, // The size of the right border (mandatory)
106  TabpageBorderSize, // The size of the bottom border (mandatory)
107  0, // A child has been added (optional)
108  0, // A child has been deleted (optional)
109 };
110 
111 void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc) {
112  if (gh->vmt != (gwinVMT *)&tabpageVMT)
113  return;
114 
115  gwinSetText(gh, title, useAlloc);
116  FixTabSizePos(gh->parent);
117  gwinRedraw(gh->parent);
118 }
119 
120 /********************************************************************************************************************
121  * Tab-set stuff
122  */
123 
124 static coord_t CalcTabHeight(GHandle gh) {
125  GHandle ph;
126  coord_t x, y, w;
127 
128  x = w = 0;
130  for(ph = gwinGetFirstChild(gh); ph; ph = gwinGetSibling(ph)) {
131  if (ph->vmt == (gwinVMT *)&tabpageVMT) {
132  w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gh->font) + GTABSET_TXT_PAD*2;
133  x += w;
134  if (x > gh->width) {
136  x = w;
137  }
138  }
139  }
140  return y;
141 }
142 
143 static void FixTabSizePos(GHandle gh) {
144  coord_t w, h, oldth;
145  GHandle vis, ph;
146 
147  oldth = ((GTabsetObject *)gh)->border_top;
148  ((GTabsetObject *)gh)->border_top = CalcTabHeight(gh);
149  oldth -= ((GTabsetObject *)gh)->border_top;
150  if (oldth == 0)
151  return;
152 
153  vis = 0;
154  w = gwinGetInnerWidth(gh);
155  h = gwinGetInnerHeight(gh);
156  for(ph = gwinGetFirstChild(gh); ph; ph = gwinGetSibling(ph)) {
157  if (ph->vmt == (gwinVMT *)&tabpageVMT) {
158  if (!vis || (ph->flags & GWIN_FLG_VISIBLE))
159  vis = ph;
160  gwinMove(ph, 0, 0);
161  gwinResize(ph, w, h);
162  } else {
163  gwinMove(ph, ph->x-gh->x-((gh->flags & GWIN_TABSET_BORDER) ? GTABSET_BORDER : 0) , ph->y-oldth-gh->y);
164  }
165  }
166  if (vis && !(vis->flags & GWIN_FLG_VISIBLE)) {
167  vis->flags |= GWIN_FLG_VISIBLE;
168  _gwinRippleVisibility();
169  }
170 }
171 
172 static coord_t TabSetBorderSize(GHandle gh) { return (gh->flags & GWIN_TABSET_BORDER) ? GTABSET_BORDER : 0; }
173 static coord_t TabSetBorderTop(GHandle gh) { return ((GTabsetObject *)gh)->border_top; }
174 
175 #if GINPUT_NEED_MOUSE
176  static void mouseDown(GWidgetObject *gw, coord_t mx, coord_t my) {
177  GHandle ph, gh;
178  int cnt;
179 
180  if (my < 0 || my > ((GTabsetObject *)gw)->border_top)
181  return;
182 
183  // Work out which tab was pressed
184  {
185  coord_t x, w, y;
186 
187  cnt = 0;
188  x = w = 0;
190  gh = 0;
191  for(ph = gwinGetFirstChild(&gw->g); ph; ph = gwinGetSibling(ph)) {
192  if (ph->vmt == (gwinVMT *)&tabpageVMT) {
193  w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gw->g.font) + GTABSET_TXT_PAD*2;
194  x += w;
195  if (x > gw->g.width) {
197  x = w;
198  }
199  if (my < y && mx < x) {
200  gh = ph;
201  break;
202  }
203  cnt++;
204  }
205  }
206  if (!gh || (gh->flags & GWIN_FLG_VISIBLE))
207  return;
208  }
209 
210  // Mark the existing tab as not visible
211  for(ph = gwinGetFirstChild(&gw->g); ph; ph = gwinGetSibling(ph)) {
212  if (ph->vmt == (gwinVMT *)&tabpageVMT && (ph->flags & GWIN_FLG_VISIBLE)) {
213  // Mark this page invisible
214  ph->flags &= ~GWIN_FLG_VISIBLE;
215  break;
216  }
217  }
218 
219  // Mark this tab as visible
220  gh->flags |= GWIN_FLG_VISIBLE;
221  _gwinRippleVisibility();
222 
223  // Force a redraw of the whole tabset
224  _gwinUpdate(&gw->g);
225 
226  // Send the Tabset Event
227  {
228  GSourceListener * psl;
229  GEventGWinTabset * pge;
230 
231  psl = 0;
232  while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) {
233  if (!(pge = (GEventGWinTabset *)geventGetEventBuffer(psl)))
234  continue;
235  pge->type = GEVENT_GWIN_TABSET;
236  pge->gwin = &gw->g;
237  #if GWIN_WIDGET_TAGS
238  pge->tag = gw->tag;
239  #endif
240  pge->ghPage = gh;
241  pge->nPage = cnt;
242  geventSendEvent(psl);
243  }
244  }
245  }
246 #endif
247 
248 static const gcontainerVMT tabsetVMT = {
249  {
250  {
251  "Tabset", // The classname
252  sizeof(GTabsetObject), // The object size
253  _gcontainerDestroy, // The destroy routine
254  _gcontainerRedraw, // The redraw routine
255  0, // The after-clear routine
256  },
257  gwinTabsetDraw_Std, // The default drawing routine
259  {
260  mouseDown, // Process mouse down event
261  0, // Process mouse up events
262  0, // Process mouse move events
263  },
264  #endif
265  #if GINPUT_NEED_TOGGLE
266  {
267  0, // 1 toggle role
268  0, // Assign Toggles
269  0, // Get Toggles
270  0, // Process toggle off events
271  0, // Process toggle on events
272  },
273  #endif
274  #if GINPUT_NEED_DIAL
275  {
276  0, // 1 dial roles
277  0, // Assign Dials
278  0, // Get Dials
279  0, // Process dial move events
280  },
281  #endif
282  },
283  TabSetBorderSize, // The size of the left border (mandatory)
284  TabSetBorderTop, // The size of the top border (mandatory)
285  TabSetBorderSize, // The size of the right border (mandatory)
286  TabSetBorderSize, // The size of the bottom border (mandatory)
287  0, // A child has been added (optional)
288  0, // A child has been deleted (optional)
289 };
290 
291 GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, uint32_t flags) {
292  if (!(fo = (GTabsetObject *)_gcontainerCreate(g, (GContainerObject *)fo, pInit, &tabsetVMT)))
293  return 0;
294 
295  // Set Tabset specific stuff
296  fo->c.g.flags |= flags & GWIN_TABSET_USER_FLAGS;
297  fo->border_top = GWIN_TABSET_TABHEIGHT;
298 
299  gwinSetVisible(&fo->c.g, pInit->g.show);
300 
301  return &fo->c.g;
302 }
303 
304 ///////////////////////////////////////////////////////////////////////////////////////////////////
305 // API calls
306 ///////////////////////////////////////////////////////////////////////////////////////////////////
307 
308 GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc) {
309  GWidgetInit wi;
310 
311  if (gh->vmt != (gwinVMT *)&tabsetVMT)
312  return 0;
313 
314  // Set up the init structure
315  gwinWidgetClearInit(&wi);
316  wi.g.x = wi.g.y = 0;
317  wi.g.width = gwinGetInnerWidth(gh);
318  wi.g.height = gwinGetInnerHeight(gh);
319  wi.g.show = !gwinTabsetCountTabs(gh);
320  wi.g.parent = gh;
321 
322  // Create the page
323  if (!(gh = _gcontainerCreate(gh->display, 0, &wi, &tabpageVMT)))
324  return 0;
325 
326  // Set the text and visibility
327  gwinSetText(gh, title, useAlloc);
328  FixTabSizePos(gh->parent);
329 
330  gwinSetVisible(gh, wi.g.show);
331  gwinRedraw(gh->parent);
332  return gh;
333 }
334 
336  int cnt;
337 
338  if (gh->vmt != (gwinVMT *)&tabsetVMT)
339  return 0;
340 
341  for(cnt = 0, gh = gwinGetFirstChild(gh); gh; gh = gwinGetSibling(gh)) {
342  if (gh->vmt == (gwinVMT *)&tabpageVMT)
343  cnt++;
344  }
345  return cnt;
346 }
347 
348 GHandle gwinTabsetGetTabByIndex(GHandle gh, int index) {
349  if (gh->vmt != (gwinVMT *)&tabsetVMT)
350  return 0;
351 
352  for(gh = gwinGetFirstChild(gh); gh; gh = gwinGetSibling(gh)) {
353  if (gh->vmt == (gwinVMT *)&tabpageVMT && !index--)
354  return gh;
355  }
356  return 0;
357 }
358 
359 GHandle gwinTabsetGetTabByTitle(GHandle gh, const char *title) {
360  if (gh->vmt != (gwinVMT *)&tabsetVMT)
361  return 0;
362 
363  for(gh = gwinGetFirstChild(gh); gh; gh = gwinGetSibling(gh)) {
364  if (gh->vmt == (gwinVMT *)&tabpageVMT && !strcmp(title, ((GWidgetObject *)gh)->text))
365  return gh;
366  }
367  return 0;
368 }
369 
370 void gwinTabsetSetTab(GHandle gh) {
371  GHandle ph;
372 
373  if (gh->vmt != (gwinVMT *)&tabpageVMT || (gh->flags & GWIN_FLG_VISIBLE))
374  return;
375 
376  // We alter the visibility flags here directly as we know we are going to redraw everything
377  for(ph = gwinGetFirstChild(gh->parent); ph; ph = gwinGetSibling(ph)) {
378  if (ph->vmt == (gwinVMT *)&tabpageVMT && (ph->flags & GWIN_FLG_VISIBLE)) {
379  // Mark this page invisible
380  ph->flags &= ~GWIN_FLG_VISIBLE;
381  break;
382  }
383  }
384 
385  // Mark this tab as visible
386  gh->flags |= GWIN_FLG_VISIBLE;
387  _gwinRippleVisibility();
388 
389  // Force a redraw of the tabset
390  gwinRedraw(gh->parent);
391 }
392 
393 ///////////////////////////////////////////////////////////////////////////////////////////////////
394 // Default render routines //
395 ///////////////////////////////////////////////////////////////////////////////////////////////////
396 
397 #if GWIN_FLAT_STYLING
398  static void fgarea(GWidgetObjset *gw, const char *text, coord_t y, coord_t x, coord_t w) {
399  const GColorSet * pcol;
400 
401  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
402 
403  gdispGDrawBox(gw->g.display, gw->g.x+x, gw->g.y+y, w, GWIN_TABSET_TABHEIGHT, pcol->edge);
404  gdispGFillStringBox(gw->g.display, gw->g.x+x+1, gw->g.y+y+1, w-2, GWIN_TABSET_TABHEIGHT-1, text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
405  }
406  static void bgarea(GWidgetObjset *gw, const char *text, coord_t y, coord_t x, coord_t w) {
407  const GColorSet * pcol;
408 
409  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
410 
411  gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, w-1, GWIN_TABSET_TABHEIGHT, text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
412  gdispGDrawLine(gw->g.display, gw->g.x+x+w-1, gw->g.y+y, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
413  gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, gw->g.x+x+w-2, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
414  }
415  static void ntarea(GWidgetObjset *gw, coord_t y, coord_t x, coord_t w) {
416  const GColorSet * pcol;
417 
418  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
419 
420  gdispGFillArea(gw->g.display, gw->g.x+x, gw->g.y, w+y, GWIN_TABSET_TABHEIGHT-1, gw->g.bgcolor);
421  gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
422  }
423 #else
424  static void fgarea(GWidgetObject *gw, const char *text, coord_t y, coord_t x, coord_t w) {
425  const GColorSet * pcol;
426  color_t tcol;
427 
428  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
429 
430  tcol = gdispBlendColor(pcol->edge, gw->pstyle->background, GTABSET_OUTLINE_FADE);
431  gdispGFillStringBox(gw->g.display, gw->g.x+x, gw->g.y+y, w, GWIN_TABSET_TABHEIGHT, text, gw->g.font, pcol->text, gw->g.bgcolor, justifyCenter);
432  gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y, gw->g.x+x+w-(GTABSET_TAB_CNR+1), gw->g.y+y, tcol);
433  gdispGDrawLine(gw->g.display, gw->g.x+x+w-(GTABSET_TAB_CNR+1), gw->g.y+y, gw->g.x+x+w-1, gw->g.y+y+GTABSET_TAB_CNR, tcol);
434  gdispGDrawLine(gw->g.display, gw->g.x+x+w-1, gw->g.y+y+GTABSET_TAB_CNR, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, tcol);
435  if (!x)
436  gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+y, gw->g.x, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, tcol);
437  }
438  static void bgarea(GWidgetObject *gw, const char *text, coord_t y, coord_t x, coord_t w) {
439  const GColorSet * pcol;
440  fixed alpha;
441  coord_t i;
442  color_t tcol, bcol;
443 
444  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
445 
446  /* Fill the box blended from variants of the fill color */
447  tcol = gdispBlendColor(White, pcol->fill, GTABSET_TOP_FADE);
448  bcol = gdispBlendColor(Black, pcol->fill, GTABSET_BOTTOM_FADE);
449  for(alpha = 0, i = 0; i < GWIN_TABSET_TABHEIGHT; i++, alpha += FIXED(255)/GWIN_TABSET_TABHEIGHT)
450  gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y+i, gw->g.x+x+w-2, gw->g.y+y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
451  gdispGDrawLine(gw->g.display, gw->g.x+x+w-1, gw->g.y+y, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
452  gdispGDrawStringBox(gw->g.display, gw->g.x+x+1, gw->g.y+y+1, w-2, GWIN_TABSET_TABHEIGHT-2, text, gw->g.font, pcol->text, justifyCenter);
453  }
454  static void ntarea(GWidgetObject *gw, coord_t y, coord_t x, coord_t w) {
455  const GColorSet * pcol;
456 
457  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
458 
459  gdispGFillArea(gw->g.display, gw->g.x+x, gw->g.y+y, w, GWIN_TABSET_TABHEIGHT-1, gw->g.bgcolor);
460  gdispGDrawLine(gw->g.display, gw->g.x+x, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, gw->g.x+x+w-1, gw->g.y+y+GWIN_TABSET_TABHEIGHT-1, pcol->edge);
461  }
462 #endif
463 
464 static coord_t drawtabs(GWidgetObject *gw) {
465  GHandle ph;
466  coord_t x, y, w;
467 
468  x = w = 0;
469  y = 0;
470  for(ph = gwinGetFirstChild(&gw->g); ph; ph = gwinGetSibling(ph)) {
471  if (ph->vmt == (gwinVMT *)&tabpageVMT) {
472  w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gw->g.font) + GTABSET_TXT_PAD*2;
473  if (x+w > gw->g.width) {
474  ntarea(gw, y, x, gw->g.width - x);
476  x = 0;
477  }
478  if (ph->flags & GWIN_FLG_VISIBLE)
479  fgarea(gw, ((GWidgetObject *)ph)->text, y, x, w);
480  else
481  bgarea(gw, ((GWidgetObject *)ph)->text, y, x, w);
482  x += w;
483  }
484  }
485  if (x < gw->g.width)
486  ntarea(gw, y, x, gw->g.width - x);
487  return y + GWIN_TABSET_TABHEIGHT;
488 }
489 
490 static void drawborder(GWidgetObject *gw, coord_t y) {
491  if ((gw->g.flags & GWIN_CONTAINER_BORDER)) {
492  const GColorSet * pcol;
493  coord_t x, w;
494 
495  pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
496  x = gw->g.x+gw->g.width-1;
497  w = gw->g.y+gw->g.height-1;
498  gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+y, gw->g.x, w-1, pcol->edge);
499  gdispGDrawLine(gw->g.display, gw->g.x, w, x, w, pcol->edge);
500  gdispGDrawLine(gw->g.display, x, gw->g.y+y, x, w-1, pcol->edge);
501  }
502 }
503 
504 void gwinTabsetDraw_Transparent(GWidgetObject *gw, void *param) {
505  (void) param;
506 
507  if (gw->g.vmt != (gwinVMT *)&tabsetVMT)
508  return;
509 
510  drawborder(gw, drawtabs(gw));
511 
512  // Don't touch the client area
513 }
514 
515 void gwinTabsetDraw_Std(GWidgetObject *gw, void *param) {
516  coord_t y;
517  (void) param;
518 
519  if (gw->g.vmt != (gwinVMT *)&tabsetVMT)
520  return;
521 
522  // Draw the frame
523  y = drawtabs(gw);
524  drawborder(gw, y);
525 
526  // Draw the client area
527  if ((gw->g.flags & GWIN_CONTAINER_BORDER))
528  gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+y, gw->g.width-2, gw->g.height-y-1, gw->pstyle->background);
529  else
530  gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+y, gw->g.width, gw->g.height-y, gw->pstyle->background);
531 }
532 
533 #if GDISP_NEED_IMAGE
534  void gwinTabsetDraw_Image(GWidgetObject *gw, void *param) {
535  #define gi ((gdispImage *)param)
536  coord_t x, y, iw, ih, mx, my;
537 
538  if (gw->g.vmt != (gwinVMT *)&tabsetVMT)
539  return;
540 
541  // Draw the frame
542  y = drawtabs(gw);
543  drawborder(gw, y);
544 
545  // Draw the client area by tiling the image
546  mx = gw->g.x+gw->g.width;
547  my = gw->g.y+gw->g.height;
548  if ((gw->g.flags & GWIN_CONTAINER_BORDER)) {
549  mx -= 2;
550  my -= 1;
551  }
552  for(y = gw->g.y+y, ih = gi->height; y < my; y += ih) {
553  if (ih > my - y)
554  ih = my - y;
555  x = gw->g.x;
556  if ((gw->g.flags & GWIN_CONTAINER_BORDER))
557  x++;
558  for(iw = gi->width; x < mx; x += iw) {
559  if (iw > mx - x)
560  iw = mx - x;
561  gdispGImageDraw(gw->g.display, gi, x, y, iw, ih, 0, 0);
562  }
563  }
564 
565  #undef gi
566  }
567 #endif
568 
569 #endif /* (GFX_USE_GWIN && GWIN_NEED_TABSET) || defined(__DOXYGEN__) */
void gdispGFillStringBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, const char *str, font_t font, color_t color, color_t bgColor, justify_t justify)
Draw a text string vertically centered within the specified box. The box background is filled with th...
coord_t gwinGetInnerHeight(GHandle gh)
Get the inner height of a container window.
color_t gdispBlendColor(color_t fg, color_t bg, uint8_t alpha)
Blend 2 colors according to the alpha.
void gwinTabsetDraw_Image(GWidgetObject *gw, void *param)
Renders the tabset and uses the specified image for the client area.
const struct gwinVMT * vmt
Definition: gwin.h:45
void gwinRedraw(GHandle gh)
Redraw a window.
GEvent * geventGetEventBuffer(GSourceListener *psl)
Get the event buffer from the GSourceListener.
Definition: gevent.c:187
uint32_t flags
Definition: gwin.h:53
int16_t coord_t
The type for a coordinate or length on the screen.
Definition: gdisp.h:39
coord_t y
Definition: gwin.h:77
The structure to initialise a widget.
Definition: gwin_widget.h:97
The Virtual Method Table for a container.
Definition: gwin_class.h:132
color_t background
Definition: gwin_widget.h:53
coord_t y
Definition: gwin.h:48
coord_t x
Definition: gwin.h:47
int32_t fixed
The type for a fixed point type.
Definition: gmisc.h:60
GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc)
Add a tab-page to the tabset.
void gwinResize(GHandle gh, coord_t width, coord_t height)
Resize a window.
color_t text
Definition: gwin_widget.h:38
#define GWIN_CONTAINER_BORDER
Flags for gwinContainerCreate()
GWindowInit g
Definition: gwin_widget.h:98
#define GINPUT_NEED_MOUSE
Should mouse/touch functions be included.
The GColorSet structure.
Definition: gwin_widget.h:37
GWindowObject g
Definition: gwin_widget.h:119
coord_t gdispGetStringWidth(const char *str, font_t font)
Get the pixel width of an entire string.
#define GWIN_TABSET_TABHEIGHT
The height in pixels of a row of tabs in a tabset.
Definition: gwin_options.h:373
void gwinWidgetClearInit(GWidgetInit *pwi)
Clear a GWidgetInit structure to all zero&#39;s.
A Tabset Event.
Definition: gwin_tabset.h:40
void gdispGDrawLine(GDisplay *g, coord_t x0, coord_t y0, coord_t x1, coord_t y1, color_t color)
Draw a line.
GColorSet pressed
Definition: gwin_widget.h:57
GColorSet disabled
Definition: gwin_widget.h:56
void gdispGFillArea(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color)
Fill an area with a color.
GColorSet enabled
Definition: gwin_widget.h:55
void gwinSetVisible(GHandle gh, bool_t visible)
Sets whether a window is visible or not.
const GWidgetStyle * pstyle
Definition: gwin_widget.h:123
The GWIN Widget structure.
Definition: gwin_widget.h:118
#define GWIN_TABSET_BORDER
Flags for gwinTabsetCreate()
Definition: gwin_tabset.h:55
bool_t show
Definition: gwin.h:80
WidgetTag tag
Definition: gwin_widget.h:125
color_t bgcolor
Definition: gwin.h:52
GDisplay * display
Definition: gwin.h:46
coord_t height
Definition: gwin.h:79
void gdispGDrawStringBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, const char *str, font_t font, color_t color, justify_t justify)
Draw a text string vertically centered within the specified box.
void gwinTabsetDraw_Transparent(GWidgetObject *gw, void *param)
Renders the tabset but leaves the client area transparent.
GHandle gwinGetFirstChild(GHandle gh)
Get the first child window.
coord_t x
Definition: gwin.h:76
coord_t height
Definition: gwin.h:50
GHandle gwinTabsetGetTabByTitle(GHandle gh, const char *title)
Get the GHandle of a tab based on its title.
void geventSendEvent(GSourceListener *psl)
Called by a source to indicate the listener&#39;s event buffer has been filled.
Definition: gevent.c:200
GHandle gwinGetSibling(GHandle gh)
Get the next child window in the z-order.
GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, uint32_t flags)
Create a tabset widget.
int gwinTabsetCountTabs(GHandle gh)
Count the number of tabs in the tabset.
#define FIXED(x)
Macros to convert to and from a fixed point.
Definition: gmisc.h:66
#define GEVENT_GWIN_TABSET
The Event Type for a Tabset Event.
Definition: gwin_tabset.h:34
GHandle gwinTabsetGetTabByIndex(GHandle gh, int index)
Get the GHandle of a tab based on its position.
coord_t width
Definition: gwin.h:49
gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy)
Draw the image.
void gwinTabsetSetTab(GHandle gh)
Set the active tab in a tabset.
coord_t gwinGetInnerWidth(GHandle gh)
Get the inner width of a container window.
void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, color_t color)
Draw a rectangular box.
color_t fill
Definition: gwin_widget.h:40
The Virtual Method Table for a GWIN window.
Definition: gwin_class.h:55
A window object structure.
Definition: gwin.h:40
void gwinTabsetDraw_Std(GWidgetObject *gw, void *param)
The default rendering function for the tabset widget.
COLOR_TYPE color_t
The color type definition.
Definition: gdisp_colors.h:412
void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc)
Set the title of a tab-page.
coord_t width
Definition: gwin.h:78
void gwinMove(GHandle gh, coord_t x, coord_t y)
Move a window.
color_t edge
Definition: gwin_widget.h:39
GSourceListener * geventGetSourceListener(GSourceHandle gsh, GSourceListener *lastlr)
Called by a source with a possible event to get a listener record.
Definition: gevent.c:163
void gwinSetText(GHandle gh, const char *text, bool_t useAlloc)
Set the text of a widget.