Make the enabled state available to all GWIN's - not just widgets.
This commit is contained in:
parent
a7198b53ff
commit
f9eed6036d
4 changed files with 51 additions and 30 deletions
|
@ -83,19 +83,6 @@ typedef struct GWidgetInit {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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.
|
* @brief Set the text of a widget.
|
||||||
*
|
*
|
||||||
|
|
|
@ -297,6 +297,29 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
bool_t gwinGetVisible(GHandle gh);
|
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
|
* @brief Move a window
|
||||||
*
|
*
|
||||||
|
|
|
@ -226,23 +226,6 @@ void _gwidgetRedraw(GHandle gh) {
|
||||||
gw->fnDraw(gw, gw->fnParam);
|
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) {
|
void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) {
|
||||||
if (!(gh->flags & GWIN_FLG_WIDGET))
|
if (!(gh->flags & GWIN_FLG_WIDGET))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -223,6 +223,34 @@ bool_t gwinGetVisible(GHandle gh) {
|
||||||
return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE;
|
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) {
|
void gwinMove(GHandle gh, coord_t x, coord_t y) {
|
||||||
#if GWIN_NEED_WINDOWMANAGER
|
#if GWIN_NEED_WINDOWMANAGER
|
||||||
cwm->vmt->Redim(gh, x, y, gh->width, gh->height);
|
cwm->vmt->Redim(gh, x, y, gh->width, gh->height);
|
||||||
|
|
Loading…
Add table
Reference in a new issue