diff options
author | Joel Bodenmann <joel@unormal.org> | 2014-09-29 08:08:36 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2014-09-29 08:08:36 +0200 |
commit | 32a4969b7d4d92b1d40e60fae676d798bacb780f (patch) | |
tree | 9607d00476bff7fe4fc1f5cc4c3f261ca7d5c6bf /src/gwin/gwin_progressbar.c | |
parent | 1e8a7ff6ddb5bb9accaf2918c98667427aa1b6b3 (diff) | |
parent | 611133cbc0d55f9dd570cfbccbe432ccc63a12aa (diff) | |
download | uGFX-32a4969b7d4d92b1d40e60fae676d798bacb780f.tar.gz uGFX-32a4969b7d4d92b1d40e60fae676d798bacb780f.tar.bz2 uGFX-32a4969b7d4d92b1d40e60fae676d798bacb780f.zip |
Merge branch 'newmouse' of bitbucket.org:Tectu/ugfx into newmouse
Diffstat (limited to 'src/gwin/gwin_progressbar.c')
-rw-r--r-- | src/gwin/gwin_progressbar.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/gwin/gwin_progressbar.c b/src/gwin/gwin_progressbar.c index ef28e8dc..d5b8721a 100644 --- a/src/gwin/gwin_progressbar.c +++ b/src/gwin/gwin_progressbar.c @@ -79,13 +79,12 @@ GHandle gwinGProgressbarCreate(GDisplay *g, GProgressbarObject *gs, const GWidge gs->pos = 0; #if GWIN_PROGRESSBAR_AUTO - gs->delay = 0; gtimerInit(&gs->gt); #endif ResetDisplayPos(gs); gwinSetVisible((GHandle)gs, pInit->g.show); - + return (GHandle)gs; } @@ -183,39 +182,37 @@ void gwinProgressbarDecrement(GHandle gh) { static void _progressbarCallback(void *param) { #define gsw ((GProgressbarObject *)gh) GHandle gh = (GHandle)param; - + if (gh->vmt != (gwinVMT *)&progressbarVMT) return; - + gwinProgressbarIncrement(gh); - - if (gsw->pos < gsw->max) - gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay); - - #undef gsw + + if (gsw->pos >= gsw->max) + gtimerStop(&gsw->gt); + + #undef gsw } - + void gwinProgressbarStart(GHandle gh, delaytime_t delay) { #define gsw ((GProgressbarObject *)gh) - + if (gh->vmt != (gwinVMT *)&progressbarVMT) return; - - gsw->delay = delay; - - gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay); - + + gtimerStart(&gsw->gt, _progressbarCallback, gh, TRUE, delay); + #undef gsw } - + void gwinProgressbarStop(GHandle gh) { #define gsw ((GProgressbarObject *)gh) - + if (gh->vmt != (gwinVMT *)&progressbarVMT) return; - - gtimerStop(&(gsw->gt)); - + + gtimerStop(&gsw->gt); + #undef gsw } #endif /* GWIN_PROGRESSBAR_AUTO */ @@ -226,7 +223,7 @@ void gwinProgressbarDecrement(GHandle gh) { void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param) { #define gsw ((GProgressbarObject *)gw) - + const GColorSet * pcol; (void) param; |