diff options
| -rw-r--r-- | include/gwin/gwidget.h | 13 | ||||
| -rw-r--r-- | include/gwin/gwin.h | 23 | ||||
| -rw-r--r-- | src/gwin/gwidget.c | 17 | ||||
| -rw-r--r-- | src/gwin/gwin.c | 28 | 
4 files changed, 51 insertions, 30 deletions
| diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index 817f2b0d..a2cf7337 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -84,19 +84,6 @@ extern "C" {  #endif  /** - * @brief	Enable or disable a widget - * - * @param[in] gh		The widget handle - * @param[in] enabled	Enable or disable the widget - * - * @note				The widget is automatically redrawn. - * @note				Non-widgets will ignore this call. - * - * @api - */ -void gwinSetEnabled(GHandle gh, bool_t enabled); - -/**   * @brief   Set the text of a widget.   *   * @param[in] gh		The widget handle diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index ba9e1e1a..dd8abb0f 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -298,6 +298,29 @@ extern "C" {  	bool_t gwinGetVisible(GHandle gh);  	/** +	 * @brief	Enable or disable a window +	 * +	 * @param[in] gh		The window handle +	 * @param[in] enabled	Enable or disable the window +	 * +	 * @note				The window is automatically redrawn if it +	 * 						supports self-redrawing. +	 * +	 * @api +	 */ +	void gwinSetEnabled(GHandle gh, bool_t enabled); + +	/** +	 * @brief	Gets the enabled state of a window +	 * @return	TRUE if enabled +	 * +	 * @param[in] gh		The window +	 * +	 * @api +	 */ +	bool_t gwinGetEnabled(GHandle gh); + +	/**  	 * @brief	Move a window  	 *  	 * @param[in] gh		The window diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index a2b82f1d..6440f171 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -226,23 +226,6 @@ void _gwidgetRedraw(GHandle gh) {  	gw->fnDraw(gw, gw->fnParam);  } -void gwinSetEnabled(GHandle gh, bool_t enabled) { -	if (!(gh->flags & GWIN_FLG_WIDGET)) -		return; - -	if (enabled) { -		if (!(gh->flags & GWIN_FLG_ENABLED)) { -			gh->flags |= GWIN_FLG_ENABLED; -			_gwidgetRedraw(gh); -		} -	} else { -		if ((gh->flags & GWIN_FLG_ENABLED)) { -			gh->flags &= ~GWIN_FLG_ENABLED; -			_gwidgetRedraw(gh); -		} -	} -} -  void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) {  	if (!(gh->flags & GWIN_FLG_WIDGET))  		return; diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index e3d81d9c..9e345523 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -223,6 +223,34 @@ bool_t gwinGetVisible(GHandle gh) {  	return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE;  } +void gwinSetEnabled(GHandle gh, bool_t enabled) { +	if (enabled) { +		if (!(gh->flags & GWIN_FLG_ENABLED)) { +			gh->flags |= GWIN_FLG_ENABLED; +			if (gh->vmt->Redraw) { +				#if GDISP_NEED_CLIP +					gdispSetClip(gh->x, gh->y, gh->width, gh->height); +				#endif +				gh->vmt->Redraw(gh); +			} +		} +	} else { +		if ((gh->flags & GWIN_FLG_ENABLED)) { +			gh->flags &= ~GWIN_FLG_ENABLED; +			if (gh->vmt->Redraw) { +				#if GDISP_NEED_CLIP +					gdispSetClip(gh->x, gh->y, gh->width, gh->height); +				#endif +				gh->vmt->Redraw(gh); +			} +		} +	} +} + +bool_t gwinGetEnabled(GHandle gh) { +	return (gh->flags & GWIN_FLG_ENABLED) ? TRUE : FALSE; +} +  void gwinMove(GHandle gh, coord_t x, coord_t y) {  	#if GWIN_NEED_WINDOWMANAGER  		cwm->vmt->Redim(gh, x, y, gh->width, gh->height); | 
