diff options
author | Joel Bodenmann <joel@seriouslyembedded.com> | 2015-12-18 22:47:33 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@seriouslyembedded.com> | 2015-12-18 22:47:33 +0100 |
commit | e500c8cd8e917e418777cc9e3a3e02451a992b21 (patch) | |
tree | 75c0ccf9688f50b23289040a37df958b2503b02d | |
parent | 43be869ab7d39fd94b0f166880260d27fcd62839 (diff) | |
download | uGFX-e500c8cd8e917e418777cc9e3a3e02451a992b21.tar.gz uGFX-e500c8cd8e917e418777cc9e3a3e02451a992b21.tar.bz2 uGFX-e500c8cd8e917e418777cc9e3a3e02451a992b21.zip |
Fixing slider widget rendering
-rw-r--r-- | src/gwin/gwin_slider.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gwin/gwin_slider.c b/src/gwin/gwin_slider.c index 613b225d..a1371815 100644 --- a/src/gwin/gwin_slider.c +++ b/src/gwin/gwin_slider.c @@ -351,17 +351,18 @@ void gwinSliderDraw_Std(GWidgetObject *gw, void *param) { return; if ((gw->g.flags & GWIN_FLG_SYSENABLED)) - pcol = &gw->pstyle->pressed; + pcol = &gw->pstyle->enabled; else pcol = &gw->pstyle->disabled; - if (gw->g.width < gw->g.height) { // Vertical slider + // Vertical slider + 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, pcol->fill); // 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 if (gsw->dpos >= 2) gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gsw->dpos-2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos-2, pcol->edge); // Thumb if (gsw->dpos <= gw->g.height-2) @@ -370,16 +371,18 @@ void gwinSliderDraw_Std(GWidgetObject *gw, void *param) { // Horizontal slider } 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 + gdispGFillArea(gw->g.display, gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, pcol->fill); // 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 if (gsw->dpos >= 2) gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos-2, gw->g.y, gw->g.x+gsw->dpos-2, gw->g.y+gw->g.height-1, pcol->edge); // Thumb if (gsw->dpos <= gw->g.width-2) gdispGDrawLine(gw->g.display, gw->g.x+gsw->dpos+2, gw->g.y, gw->g.x+gsw->dpos+2, gw->g.y+gw->g.height-1, pcol->edge); // Thumb } + + // Draw the string 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); #undef gsw |