aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2014-04-26 03:07:21 +0200
committerJoel Bodenmann <joel@unormal.org>2014-04-26 03:07:21 +0200
commitf7ef75928bcc166e2326d4a7d10ceb4ccfb35220 (patch)
treeb0a3d217455959bb3ccf6799046083004d2232c8 /src/gwin
parent237658f052c64679f2aad223ee6ae839c2ec2b88 (diff)
downloaduGFX-f7ef75928bcc166e2326d4a7d10ceb4ccfb35220.tar.gz
uGFX-f7ef75928bcc166e2326d4a7d10ceb4ccfb35220.tar.bz2
uGFX-f7ef75928bcc166e2326d4a7d10ceb4ccfb35220.zip
Fixing progressbar bug
Diffstat (limited to 'src/gwin')
-rw-r--r--src/gwin/progressbar.c34
1 files changed, 25 insertions, 9 deletions
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);