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/label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gwin/label.c') 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 -- 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 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) (limited to 'src/gwin/label.c') 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 /** @} */ -- 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gwin/label.c') 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; -- cgit v1.2.3