From e9179545afc320e2404d1e2397c50cc71987bd10 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Fri, 28 Mar 2014 20:18:03 +0100 Subject: doxygen fixes --- src/gwin/button.h | 2 +- src/gwin/checkbox.h | 2 +- src/gwin/class_gwin.h | 2 +- src/gwin/console.h | 2 +- src/gwin/graph.h | 2 +- src/gwin/gwidget.h | 2 +- src/gwin/image.h | 2 +- src/gwin/label.c | 2 +- src/gwin/label.h | 2 +- src/gwin/list.c | 2 +- src/gwin/list.h | 2 +- src/gwin/progressbar.h | 2 +- src/gwin/radio.h | 2 +- src/gwin/slider.h | 2 +- src/gwin/sys_defs.h | 2 ++ src/gwin/sys_options.h | 2 +- 16 files changed, 17 insertions(+), 15 deletions(-) (limited to 'src/gwin') diff --git a/src/gwin/button.h b/src/gwin/button.h index d11764d6..dad0cc91 100644 --- a/src/gwin/button.h +++ b/src/gwin/button.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/button.h + * @file src/gwin/button.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Button Button diff --git a/src/gwin/checkbox.h b/src/gwin/checkbox.h index 946f7e4a..529fc757 100644 --- a/src/gwin/checkbox.h +++ b/src/gwin/checkbox.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/checkbox.h + * @file src/gwin/checkbox.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Checkbox Checkbox diff --git a/src/gwin/class_gwin.h b/src/gwin/class_gwin.h index ae5ac756..49fc6084 100644 --- a/src/gwin/class_gwin.h +++ b/src/gwin/class_gwin.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/class_gwin.h + * @file src/gwin/class_gwin.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Internal Internal diff --git a/src/gwin/console.h b/src/gwin/console.h index 14bc7eb3..3fca6aa4 100644 --- a/src/gwin/console.h +++ b/src/gwin/console.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/console.h + * @file src/gwin/console.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Console Console diff --git a/src/gwin/graph.h b/src/gwin/graph.h index 65a64126..69dbb617 100644 --- a/src/gwin/graph.h +++ b/src/gwin/graph.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/graph.h + * @file src/gwin/graph.h * @brief GWIN GRAPH module header file. * * @defgroup Graph Graph diff --git a/src/gwin/gwidget.h b/src/gwin/gwidget.h index 4eaf6c81..96832fe3 100644 --- a/src/gwin/gwidget.h +++ b/src/gwin/gwidget.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/gwidget.h + * @file src/gwin/gwidget.h * @brief GWIN Widgets header file. */ diff --git a/src/gwin/image.h b/src/gwin/image.h index 66aba3d1..fdaabc92 100644 --- a/src/gwin/image.h +++ b/src/gwin/image.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/image.h + * @file src/gwin/image.h * @brief GWIN image widget header file. * * @defgroup Image Image diff --git a/src/gwin/label.c b/src/gwin/label.c index 97588a27..a5064818 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/label.h + * @file src/gwin/label.c * @brief GWIN label widget header file. * * @defgroup Label Label diff --git a/src/gwin/label.h b/src/gwin/label.h index 3fe0f3d7..9d62738d 100644 --- a/src/gwin/label.h +++ b/src/gwin/label.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/label.h + * @file src/gwin/label.h * @brief GWIN label widget header file. * * @defgroup Label Label diff --git a/src/gwin/list.c b/src/gwin/list.c index 5b49811c..8374ff39 100644 --- a/src/gwin/list.c +++ b/src/gwin/list.c @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/list.h + * @file src/gwin/list.c * @brief GWIN list widget header file. * * @defgroup List List diff --git a/src/gwin/list.h b/src/gwin/list.h index cfe6aeb2..eb800439 100644 --- a/src/gwin/list.h +++ b/src/gwin/list.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/list.h + * @file src/gwin/list.h * @brief GWIN list widget header file * * @defgroup List List diff --git a/src/gwin/progressbar.h b/src/gwin/progressbar.h index c9efe46b..de10783f 100644 --- a/src/gwin/progressbar.h +++ b/src/gwin/progressbar.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/progressbar.h + * @file src/gwin/progressbar.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Progressbar Progressbar diff --git a/src/gwin/radio.h b/src/gwin/radio.h index 3ee2918f..f2bd7f35 100644 --- a/src/gwin/radio.h +++ b/src/gwin/radio.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/radio.h + * @file src/gwin/radio.h * @brief GWIN Graphic window subsystem header file. * * @defgroup RadioButton RadioButton diff --git a/src/gwin/slider.h b/src/gwin/slider.h index 8f87745c..8c5bd9ca 100644 --- a/src/gwin/slider.h +++ b/src/gwin/slider.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/slider.h + * @file src/gwin/slider.h * @brief GWIN Graphic window subsystem header file. * * @defgroup Slider Slider diff --git a/src/gwin/sys_defs.h b/src/gwin/sys_defs.h index 10b5b564..98c153d0 100644 --- a/src/gwin/sys_defs.h +++ b/src/gwin/sys_defs.h @@ -439,6 +439,8 @@ extern "C" { * * @param[in] gh The window * + * @return ToDo + * * @api */ GWindowMinMax gwinGetMinMax(GHandle gh); diff --git a/src/gwin/sys_options.h b/src/gwin/sys_options.h index e7bb93b4..656e0e3f 100644 --- a/src/gwin/sys_options.h +++ b/src/gwin/sys_options.h @@ -6,7 +6,7 @@ */ /** - * @file include/gwin/sys_options.h + * @file src/gwin/sys_options.h * @brief GWIN sub-system options header file. * * @addtogroup GWIN -- cgit v1.2.3 From 87bef5d0df44f38f1e474ccf12f6daba06a743fe Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 30 Mar 2014 14:59:17 +1000 Subject: Fill in some doxygen Todo's --- src/gwin/sys_defs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gwin') diff --git a/src/gwin/sys_defs.h b/src/gwin/sys_defs.h index 98c153d0..ac2c98c7 100644 --- a/src/gwin/sys_defs.h +++ b/src/gwin/sys_defs.h @@ -439,7 +439,7 @@ extern "C" { * * @param[in] gh The window * - * @return ToDo + * @return GWIN_NORMAL, GWIN_MAXIMIZE or GWIN_MINIMIZE * * @api */ -- cgit v1.2.3 From 8169a0453b77364a0ef804f43762cc5675f450bf Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:29:50 +0200 Subject: Added gwinProgressbarStop() --- src/gwin/progressbar.c | 11 +++++++++++ src/gwin/progressbar.h | 9 +++++++++ 2 files changed, 20 insertions(+) (limited to 'src/gwin') diff --git a/src/gwin/progressbar.c b/src/gwin/progressbar.c index 37bad3c8..671c0971 100644 --- a/src/gwin/progressbar.c +++ b/src/gwin/progressbar.c @@ -200,6 +200,17 @@ void gwinProgressbarStart(GHandle gh, delaytime_t delay) { #undef gsw } +void gwinProgressbarStop(GHandle gh) { + #define gsw ((GProgressbarObject *)gh) + + if (gh->vmt != (gwinVMT *)&progressbarVMT) + return; + + gtimerStop(&(gsw->gt)); + + #undef gsw +} + /*---------------------------------------------------------- * Custom Draw Routines *----------------------------------------------------------*/ diff --git a/src/gwin/progressbar.h b/src/gwin/progressbar.h index de10783f..1b7e4424 100644 --- a/src/gwin/progressbar.h +++ b/src/gwin/progressbar.h @@ -155,6 +155,15 @@ void gwinProgressbarDecrement(GHandle gh); */ void gwinProgressbarStart(GHandle gh, delaytime_t delay); +/** + * @brief Stop the timer which is started by @p gwinProgressbarStart() + * + * @param[in] gh The window handle (must be a progressbar window) + * + * @api + */ +void gwinProgressbarStop(GHandle gh); + /** * @brief Some custom progressbar drawing routines * @details These function may be passed to @p gwinSetCustomDraw() to get different progressbar drawing styles -- cgit v1.2.3 From 5c3779cf79616539840baae000797a731ed43127 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:39:12 +0200 Subject: Added gwinProgressbarReset() --- src/gwin/progressbar.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/gwin') diff --git a/src/gwin/progressbar.h b/src/gwin/progressbar.h index 1b7e4424..fcf76b12 100644 --- a/src/gwin/progressbar.h +++ b/src/gwin/progressbar.h @@ -138,6 +138,15 @@ void gwinProgressbarDecrement(GHandle gh); */ #define gwinProgressbarGetPosition(gh) (((GProgressbarObject *)(gh))->pos) + /** + * @brief Reset the progressbar to the minimum position + * + * @param[in] gh The window handle (must be a progressbar window) + * + * @api + */ +#define gwinProgressbarReset(gh) gwinProgressbarSetPosition(gh, ((GProgressbarObject *)(gh))->min) + /** * @brief Automatically increments the progress bar * -- cgit v1.2.3 From c3b17604ee456a725328f924a8a3ec339629eb7b Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 23 Apr 2014 23:55:35 +0200 Subject: Fixing gwin progressbar destroying process --- src/gwin/progressbar.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gwin') diff --git a/src/gwin/progressbar.c b/src/gwin/progressbar.c index 671c0971..a7acc0ed 100644 --- a/src/gwin/progressbar.c +++ b/src/gwin/progressbar.c @@ -29,12 +29,21 @@ static void ResetDisplayPos(GProgressbarObject *gsw) { gsw->dpos = ((gsw->w.g.width-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min); } +// We have to deinitialize the timer which auto updates the progressbar if any +static void _destroy(GHandle gh) { + #if GFX_USE_GTIMER + gtimerDeinit( &((GProgressbarObject *)gh)->gt ); + #endif + + _gwidgetDestroy(gh); +} + // The progressbar VMT table static const gwidgetVMT progressbarVMT = { { "Progressbar", // The classname sizeof(GProgressbarObject), // The object size - _gwidgetDestroy, // The destroy routine + _destroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, -- cgit v1.2.3 From f7ef75928bcc166e2326d4a7d10ceb4ccfb35220 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sat, 26 Apr 2014 03:07:21 +0200 Subject: Fixing progressbar bug --- src/gwin/progressbar.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'src/gwin') diff --git a/src/gwin/progressbar.c b/src/gwin/progressbar.c index a7acc0ed..7c34607f 100644 --- a/src/gwin/progressbar.c +++ b/src/gwin/progressbar.c @@ -206,6 +206,12 @@ void gwinProgressbarStart(GHandle gh, delaytime_t delay) { gtimerInit(&(gsw->gt)); gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay); + // if this is not made, the progressbar will not start when the it's already visible + if (gsw->w.g.flags & GWIN_FLG_VISIBLE) { + gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, TRUE); + } + #undef gsw } @@ -226,33 +232,43 @@ void gwinProgressbarStop(GHandle gh) { void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param) { #define gsw ((GProgressbarObject *)gw) + const GColorSet * pcol; (void) param; if (gw->g.vmt != (gwinVMT *)&progressbarVMT) return; - if ((gw->g.flags & GWIN_FLG_ENABLED)) + // disable the auto-update timer if any + #if GFX_USE_GTIMER + if (gtimerIsActive(&(gsw->gt)) && !(gw->g.flags & GWIN_FLG_ENABLED)) { + gtimerStop(&(gsw->gt)); + } + #endif + + // get the colors right + if ((gw->g.flags & GWIN_FLG_ENABLED)) pcol = &gw->pstyle->pressed; else pcol = &gw->pstyle->disabled; - if (gw->g.width < gw->g.height) { // Vertical progressbar + // Vertical progressbar + if (gw->g.width < gw->g.height) { if (gsw->dpos != gw->g.height-1) - gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+gsw->dpos, gw->g.width, gw->g.height - gsw->dpos, pcol->progress); // Active Area + gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+gsw->dpos, gw->g.width, gw->g.height - gsw->dpos, pcol->progress); // Active Area if (gsw->dpos != 0) - gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gw->pstyle->enabled.progress); // Inactive area - gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge - gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, pcol->edge); // Thumb + gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gw->pstyle->enabled.progress); // Inactive area + gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge + gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, pcol->edge); // Thumb // Horizontal progressbar } else { if (gsw->dpos != gw->g.width-1) gdispGFillArea(gw->g.display, gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gw->pstyle->enabled.progress); // Inactive area if (gsw->dpos != 0) - gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gsw->dpos, gw->g.height, pcol->progress); // Active Area - gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge - gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, pcol->edge); // Thumb + gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gsw->dpos, gw->g.height, pcol->progress); // Active Area + gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge + gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, pcol->edge); // Thumb } gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); -- cgit v1.2.3 From 8b4ca720369d790ea330bc2189efa05cc557c2f7 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sat, 26 Apr 2014 03:27:19 +0200 Subject: Added gwinListEnableRender() --- src/gwin/list.c | 20 ++++++++++++++++++++ src/gwin/list.h | 14 ++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'src/gwin') diff --git a/src/gwin/list.c b/src/gwin/list.c index 8374ff39..50c669f0 100644 --- a/src/gwin/list.c +++ b/src/gwin/list.c @@ -41,6 +41,7 @@ #define GLIST_FLG_HASIMAGES (GWIN_FIRST_CONTROL_FLAG << 1) #define GLIST_FLG_SCROLLALWAYS (GWIN_FIRST_CONTROL_FLAG << 2) #define GLIST_FLG_SCROLLSMOOTH (GWIN_FIRST_CONTROL_FLAG << 3) +#define GLIST_FLG_ENABLERENDER (GWIN_FIRST_CONTROL_FLAG << 4) // Flags on a ListItem. #define GLIST_FLG_SELECTED 0x0001 @@ -92,6 +93,11 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) { coord_t sy; #endif + // dont render if render has been disabled + if (!(gw->g.flags & GLIST_FLG_ENABLERENDER)) { + return; + } + ps = (gw->g.flags & GWIN_FLG_ENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled; iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING; x = 1; @@ -401,12 +407,26 @@ GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, bool if (multiselect) gobj->w.g.flags |= GLIST_FLG_MULTISELECT; gobj->w.g.flags |= GLIST_FLG_SCROLLALWAYS; + gobj->w.g.flags |= GLIST_FLG_ENABLERENDER; gwinSetVisible(&gobj->w.g, pInit->g.show); return (GHandle)gobj; } +void gwinListEnableRender(GHandle gh, bool_t ena) { + // is it a valid handle? + if (gh->vmt != (gwinVMT *)&listVMT) + return; + + if (ena) { + gh->flags |= GLIST_FLG_ENABLERENDER; + gwinRedraw(gh); + } else { + gh->flags &=~ GLIST_FLG_ENABLERENDER; + } +} + void gwinListSetScroll(GHandle gh, scroll_t flag) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) diff --git a/src/gwin/list.h b/src/gwin/list.h index eb800439..2cc525a2 100644 --- a/src/gwin/list.h +++ b/src/gwin/list.h @@ -102,6 +102,20 @@ extern "C" { GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, bool_t multiselect); #define gwinListCreate(w, pInit, m) gwinGListCreate(GDISP, w, pInit, m) +/** + * @brief Enable or disable the rendering of the list + * + * @details Usually the list is being re-rendered when an item is added to the list. This can cause + * flickering and performance issues when many items are added at once. This can be prevented + * by temporarely disabling the render using this function. + * + * @param[in] gh The widget handle (must be a list handle) + * @param[in] ena TRUE or FALSE + * + * @api + */ +void gwinListEnableRender(GHandle gh, bool_t ena); + /** * @brief Change the behaviour of the scroll bar * -- cgit v1.2.3 From 135f8f5ecac5bc04bc18438bf78fd7ba82c40816 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 28 Apr 2014 23:20:51 +0200 Subject: Added gwinLabelSetAttribute() --- src/gwin/label.c | 43 +++++++++++++++++++++++++++++++++++++++---- src/gwin/label.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 4 deletions(-) (limited to 'src/gwin') diff --git a/src/gwin/label.c b/src/gwin/label.c index a5064818..167ded84 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -23,6 +23,7 @@ // macros to assist in data type conversions #define gh2obj ((GLabelObject *)gh) +#define gw2obj ((GLabelObject *)gw) // flags for the GLabelObject #define GLABEL_FLG_WAUTO (GWIN_FIRST_CONTROL_FLAG << 0) @@ -57,10 +58,26 @@ static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) { return; } - // render the text - gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, - (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background, - justifyLeft); + #if GWIN_LABEL_ATTRIBUTE + if (gw2obj->attr != 0) { + gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw2obj->attr, gw->g.font, + (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background, + justifyLeft); + + gdispGFillStringBox(gw->g.display, gw->g.x + gw2obj->tab, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, + (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background, + justifyLeft); + } else { + gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, + (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background, + justifyLeft); + + } + #else + gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, + (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background, + justifyLeft); + #endif // render the border (if any) if (gw->g.flags & GLABEL_FLG_BORDER) @@ -124,6 +141,11 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) // no borders by default flags &=~ GLABEL_FLG_BORDER; + #if GWIN_LABEL_ATTRIBUTE + widget->tab = 0; + widget->attr = 0; + #endif + widget->w.g.flags |= flags; gwinSetVisible(&widget->w.g, pInit->g.show); @@ -141,6 +163,19 @@ void gwinLabelSetBorder(GHandle gh, bool_t border) { gh2obj->w.g.flags &=~ GLABEL_FLG_BORDER; } +#if GWIN_LABEL_ATTRIBUTE + void gwinLabelSetAttribute(GHandle gh, coord_t tab, char* attr) { + // is it a valid handle? + if (gh->vmt != (gwinVMT *)&labelVMT) + return; + + gh2obj->tab = tab; + gh2obj->attr = attr; + + gwinRedraw(gh); + } +#endif // GWIN_LABEL_ATTRIBUTE + #endif // GFX_USE_GWIN && GFX_NEED_LABEL /** @} */ diff --git a/src/gwin/label.h b/src/gwin/label.h index 9d62738d..5cf87ad1 100644 --- a/src/gwin/label.h +++ b/src/gwin/label.h @@ -32,6 +32,11 @@ // An label window typedef struct GLabelObject { GWidgetObject w; + + #if GWIN_LABEL_ATTRIBUTE + coord_t tab; + char* attr; + #endif } GLabelObject; #ifdef __cplusplus @@ -63,6 +68,29 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit); */ void gwinLabelSetBorder(GHandle gh, bool_t border); +#if GWIN_LABEL_ATTRIBUTE + /** + * @brief Add an attribute in front of the actualy label text + * @detail Often you want to display a text like this: + * Current IP: 192.168.1.42 + * In that case, one the actual IP will be variable, the text in front of it + * always remains the same. The static text is called the attribute and can be + * set using this function. + * Furthermore, the tab can be set in order to vertically align multiple labels. + * Please check out the website for further explanation, illustraions and usage + * examples. + * + * @note The attribute text is currently not being allocated + * + * @param[in] gh The widget handle (must be a label handle) + * @param[in] tab The distance of the label text from the left widget edge + * @param[in] attr The attribute to be displayed + * + * @api + */ + void gwinLabelSetAttribute(GHandle gh, coord_t tab, char* attr); +#endif + #ifdef __cplusplus } #endif -- cgit v1.2.3 From a0b11f764b6c2e52d7a41d7bfda438a4e7a9a5b0 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 28 Apr 2014 23:31:33 +0200 Subject: typo --- src/gwin/label.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gwin') diff --git a/src/gwin/label.h b/src/gwin/label.h index 5cf87ad1..eafa8d91 100644 --- a/src/gwin/label.h +++ b/src/gwin/label.h @@ -73,7 +73,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border); * @brief Add an attribute in front of the actualy label text * @detail Often you want to display a text like this: * Current IP: 192.168.1.42 - * In that case, one the actual IP will be variable, the text in front of it + * In that case, the actual IP will be variable, the text in front of it * always remains the same. The static text is called the attribute and can be * set using this function. * Furthermore, the tab can be set in order to vertically align multiple labels. -- cgit v1.2.3 From 56b8dfc72f2adf3bd214428f5fa4f81d8b41b437 Mon Sep 17 00:00:00 2001 From: inmarket Date: Tue, 29 Apr 2014 09:00:06 +1000 Subject: New label attribute is const. Also updated comments. --- src/gwin/label.c | 2 +- src/gwin/label.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/gwin') diff --git a/src/gwin/label.c b/src/gwin/label.c index 167ded84..574dc8b7 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -164,7 +164,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border) { } #if GWIN_LABEL_ATTRIBUTE - void gwinLabelSetAttribute(GHandle gh, coord_t tab, char* attr) { + void gwinLabelSetAttribute(GHandle gh, coord_t tab, const char* attr) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&labelVMT) return; diff --git a/src/gwin/label.h b/src/gwin/label.h index eafa8d91..708599a6 100644 --- a/src/gwin/label.h +++ b/src/gwin/label.h @@ -35,7 +35,7 @@ typedef struct GLabelObject { #if GWIN_LABEL_ATTRIBUTE coord_t tab; - char* attr; + const char* attr; #endif } GLabelObject; @@ -70,7 +70,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border); #if GWIN_LABEL_ATTRIBUTE /** - * @brief Add an attribute in front of the actualy label text + * @brief Add an text attribute in front of the normal label text * @detail Often you want to display a text like this: * Current IP: 192.168.1.42 * In that case, the actual IP will be variable, the text in front of it @@ -80,7 +80,11 @@ void gwinLabelSetBorder(GHandle gh, bool_t border); * Please check out the website for further explanation, illustraions and usage * examples. * - * @note The attribute text is currently not being allocated + * @note The attribute text is not copied into private memory and so it + * must be a constant string, not one allocated in a stack buffer. + * @note Use of this construct is discouraged. The appropriate way is to + * create two labels - one for the static text and one for the + * dynamic text. * * @param[in] gh The widget handle (must be a label handle) * @param[in] tab The distance of the label text from the left widget edge @@ -88,7 +92,7 @@ void gwinLabelSetBorder(GHandle gh, bool_t border); * * @api */ - void gwinLabelSetAttribute(GHandle gh, coord_t tab, char* attr); + void gwinLabelSetAttribute(GHandle gh, coord_t tab, const char* attr); #endif #ifdef __cplusplus -- cgit v1.2.3 From 70c96543fcd20a0d323170e4f8392a0494de2cd4 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 29 Apr 2014 08:21:18 +0200 Subject: doxygen --- src/gwin/label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gwin') diff --git a/src/gwin/label.h b/src/gwin/label.h index 708599a6..b7218193 100644 --- a/src/gwin/label.h +++ b/src/gwin/label.h @@ -68,10 +68,10 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit); */ void gwinLabelSetBorder(GHandle gh, bool_t border); -#if GWIN_LABEL_ATTRIBUTE +#if GWIN_LABEL_ATTRIBUTE || defined(__DOXYGEN__) /** * @brief Add an text attribute in front of the normal label text - * @detail Often you want to display a text like this: + * @details Often you want to display a text like this: * Current IP: 192.168.1.42 * In that case, the actual IP will be variable, the text in front of it * always remains the same. The static text is called the attribute and can be -- cgit v1.2.3