diff options
-rw-r--r-- | docs/releases.txt | 1 | ||||
-rw-r--r-- | src/gwin/slider.c | 4 | ||||
-rw-r--r-- | src/gwin/sys_defs.h | 18 |
3 files changed, 23 insertions, 0 deletions
diff --git a/docs/releases.txt b/docs/releases.txt index ce6b3c9e..859c7edd 100644 --- a/docs/releases.txt +++ b/docs/releases.txt @@ -32,6 +32,7 @@ FEATURE: Update GADC audio recording driver to new GAUDIO format FEATURE: Added vs1053 audio play driver FEATURE: Added GAUDIO wave-play demo FEATURE: Added many GWIN simple demo's and updated the combined widget demo +FEATURE: Added gwinEnable() and gwinDisable() *** changes after 1.9 *** diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 4c91ede6..ace90365 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -262,6 +262,10 @@ void gwinSliderSetPosition(GHandle gh, int pos) { if (gh->vmt != (gwinVMT *)&sliderVMT) return; + // do not change the position if disabled + if (!gwinGetEnabled(gh)) + return; + if (gsw->min <= gsw->max) { if (pos < gsw->min) gsw->pos = gsw->min; else if (pos > gsw->max) gsw->pos = gsw->max; diff --git a/src/gwin/sys_defs.h b/src/gwin/sys_defs.h index ac2c98c7..f4e1c2f7 100644 --- a/src/gwin/sys_defs.h +++ b/src/gwin/sys_defs.h @@ -337,6 +337,24 @@ extern "C" { void gwinSetEnabled(GHandle gh, bool_t enabled); /** + * @brief Enables a widget + * + * @param[in] gh The window handle + * + * @api + */ + #define gwinEnable(gh) gwinSetEnabled(gh, TRUE); + + /** + * @brief Disables a widget + * + * @param[in] gh The window handle + * + * @api + */ + #define gwinDisable(gh) gwinSetEnabled(gh, FALSE); + + /** * @brief Gets the enabled state of a window * @return TRUE if enabled * |