From a4ca308dd51bb780ead1e2388bffe391fcef5659 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 27 May 2013 12:53:34 +0200 Subject: [PATCH] added slider enable/disable API --- include/gwin/slider.h | 24 ++++++++++++++++++++++++ src/gwin/slider.c | 7 +++++++ 2 files changed, 31 insertions(+) diff --git a/include/gwin/slider.h b/include/gwin/slider.h index c22dc5f4..9a51d042 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -141,6 +141,16 @@ void gwinSetSliderStyle(GHandle gh, const GSliderDrawStyle *pStyle); */ void gwinSliderDraw(GHandle gh); +/** + * @brief Enable or disable a button + * + * @param[in] gh The window handle (must be a slider window) + * @param[in] enabled Enable or disable the slider + * + * @api + */ +void gwinSliderSetEnabled(GHandle gh, bool_t enabled); + /** * @brief Set the callback routine to perform a custom slider drawing. * @@ -152,6 +162,20 @@ void gwinSliderDraw(GHandle gh); */ void gwinSetSliderCustom(GHandle gh, GSliderDrawFunction fn, void *param); +/** + * @brief Enable a slider + * + * @api + */ +#define gwinEnableSlider(gh) gwinSetSliderEnabled( ((GSliderObject *)(gh)), TRUE) + +/** + * @brief Disable a slider + * + * @api + */ +#define gwinDisableSlider(gh) gwinSetSliderEnabled( ((GSliderObject *)(gh)), FALSE) + /** * @brief Get the current slider position. * @return The slider position diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 7f1e36bc..1f252d77 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -241,6 +241,13 @@ void gwinSetSliderCustom(GHandle gh, GSliderDrawFunction fn, void *param) { #undef gsw } +void gwinSliderSetEnabled(GHandle gh, bool_t enabled) { + if (gh->type != GW_SLIDER) + return; + + gh->enabled = enabled; +} + void gwinSliderDraw_Std(GHandle gh, bool_t isVertical, coord_t thumbpos, const GSliderDrawStyle *pstyle, void *param) { (void) param;