µGFX  2.9
version 2.9
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.io/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 gCoord 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
73  #if GINPUT_NEED_MOUSE
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, gBool 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 gCoord CalcTabHeight(GHandle gh) {
125  GHandle ph;
126  gCoord 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  gCoord 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 gCoord TabSetBorderSize(GHandle gh) { return (gh->flags & GWIN_TABSET_BORDER) ? GTABSET_BORDER : 0; }
173 static gCoord TabSetBorderTop(GHandle gh) { return ((GTabsetObject *)gh)->border_top; }
174 
175 #if GINPUT_NEED_MOUSE
176  static void mouseDown(GWidgetObject *gw, gCoord mx, gCoord 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  gCoord 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
258  #if GINPUT_NEED_MOUSE
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, gU32 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, gBool 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, gCoord y, gCoord x, gCoord 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, gJustifyCenter);
405  }
406  static void bgarea(GWidgetObjset *gw, const char *text, gCoord y, gCoord x, gCoord 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, gJustifyCenter);
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, gCoord y, gCoord x, gCoord 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, gCoord y, gCoord x, gCoord w) {
425  const GColorSet * pcol;
426  gColor 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, gJustifyCenter);
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, gCoord y, gCoord x, gCoord w) {
439  const GColorSet * pcol;
440  fixed alpha;
441  gCoord i;
442  gColor 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(GFX_WHITE, pcol->fill, GTABSET_TOP_FADE);
448  bcol = gdispBlendColor(GFX_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, gJustifyCenter);
453  }
454  static void ntarea(GWidgetObject *gw, gCoord y, gCoord x, gCoord 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 gCoord drawtabs(GWidgetObject *gw) {
465  GHandle ph;
466  gCoord 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, gCoord y) {
491  if ((gw->g.flags & GWIN_CONTAINER_BORDER)) {
492  const GColorSet * pcol;
493  gCoord 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  gCoord 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 ((gImage *)param)
536  gCoord 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__) */
COLOR_TYPE gColor
The color type definition.
Definition: gdisp_colors.h:437
#define GWIN_CONTAINER_BORDER
Flags for gwinContainerCreate()
gCoord gwinGetInnerHeight(GHandle gh)
Get the inner height of a container window.
GHandle gwinGetFirstChild(GHandle gh)
Get the first child window.
GHandle gwinGetSibling(GHandle gh)
Get the next child window in the z-order.
gCoord gwinGetInnerWidth(GHandle gh)
Get the inner width of a container window.
gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha)
Blend 2 colors according to the alpha.
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 gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color)
Draw a line.
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...
gI16 gCoord
The type for a coordinate or length on the screen.
Definition: gdisp.h:39
gCoord gdispGetStringWidth(const char *str, gFont font)
Get the pixel width of an entire string.
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Draw a rectangular box.
@ gJustifyCenter
Definition: gdisp.h:62
GEvent * geventGetEventBuffer(GSourceListener *psl)
Get the event buffer from the GSourceListener.
Definition: gevent.c:187
void geventSendEvent(GSourceListener *psl)
Called by a source to indicate the listener's event buffer has been filled.
Definition: gevent.c:200
GSourceListener * geventGetSourceListener(GSourceHandle gsh, GSourceListener *lastlr)
Called by a source with a possible event to get a listener record.
Definition: gevent.c:163
gI32 fixed
The type for a fixed point type.
Definition: gmisc.h:60
#define FIXED(x)
Macros to convert to and from a fixed point.
Definition: gmisc.h:66
#define GWIN_TABSET_TABHEIGHT
The height in pixels of a row of tabs in a tabset.
Definition: gwin_options.h:373
gdispImageError gdispGImageDraw(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy)
Draw the image.
void gwinTabsetDraw_Transparent(GWidgetObject *gw, void *param)
Renders the tabset but leaves the client area transparent.
void gwinTabsetDraw_Std(GWidgetObject *gw, void *param)
The default rendering function for the tabset widget.
void gwinTabsetDraw_Image(GWidgetObject *gw, void *param)
Renders the tabset and uses the specified image for the client area.
GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, gU32 flags)
Create a tabset widget.
GHandle gwinTabsetAddTab(GHandle gh, const char *title, gBool useAlloc)
Add a tab-page to the tabset.
void gwinTabsetSetTab(GHandle gh)
Set the active tab in a tabset.
int gwinTabsetCountTabs(GHandle gh)
Count the number of tabs in the tabset.
GHandle gwinTabsetGetTabByTitle(GHandle gh, const char *title)
Get the GHandle of a tab based on its title.
#define GWIN_TABSET_BORDER
Flags for gwinTabsetCreate()
Definition: gwin_tabset.h:55
void gwinTabsetSetTitle(GHandle gh, const char *title, gBool useAlloc)
Set the title of a tab-page.
#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.
void gwinSetText(GHandle gh, const char *text, gBool useAlloc)
Set the text of a widget.
void gwinWidgetClearInit(GWidgetInit *pwi)
Clear a GWidgetInit structure to all zero's.
void gwinRedraw(GHandle gh)
Redraw a window.
void gwinSetVisible(GHandle gh, gBool visible)
Sets whether a window is visible or not.
void gwinResize(GHandle gh, gCoord width, gCoord height)
Resize a window.
void gwinMove(GHandle gh, gCoord x, gCoord y)
Move a window.
The GColorSet structure.
Definition: gwin_widget.h:37
gColor fill
Definition: gwin_widget.h:40
gColor text
Definition: gwin_widget.h:38
gColor edge
Definition: gwin_widget.h:39
A Tabset Event.
Definition: gwin_tabset.h:40
The structure to initialise a widget.
Definition: gwin_widget.h:97
GWindowInit g
Definition: gwin_widget.h:98
The GWIN Widget structure.
Definition: gwin_widget.h:118
GWindowObject g
Definition: gwin_widget.h:119
const GWidgetStyle * pstyle
Definition: gwin_widget.h:123
gColor background
Definition: gwin_widget.h:53
GColorSet disabled
Definition: gwin_widget.h:56
GColorSet enabled
Definition: gwin_widget.h:55
GColorSet pressed
Definition: gwin_widget.h:57
gCoord x
Definition: gwin.h:76
gCoord y
Definition: gwin.h:77
gBool show
Definition: gwin.h:80
gCoord width
Definition: gwin.h:78
gCoord height
Definition: gwin.h:79
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
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 Virtual Method Table for a container.
Definition: gwin_class.h:132
The Virtual Method Table for a GWIN window.
Definition: gwin_class.h:55