From eae98a50d9f6f5c94c918ea77c4adde146c790c1 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 30 Apr 2014 20:55:45 +0200 Subject: Added gwinEnable() and gwinDisable() --- src/gwin/sys_defs.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/gwin') 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 @@ -336,6 +336,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 -- cgit v1.2.3 From 2c57363efc343ae521857cddbcfbcaec50eaedab Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Wed, 30 Apr 2014 21:11:54 +0200 Subject: slider does not change position if disabled --- src/gwin/slider.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gwin') 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; -- cgit v1.2.3