(widget_set_state): return cb_ret_t instead of gboolean.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-06-10 14:39:28 +03:00
parent c90b806728
commit 41144d619c
2 changed files with 8 additions and 9 deletions

View File

@ -213,12 +213,12 @@ widget_set_options (Widget * w, widget_options_t options, gboolean enable)
* @param state widget state flag to modify
* @param enable specifies whether to turn the flag on (TRUE) or off (FALSE).
* Only one flag per call can be modified.
* @return TRUE if set was handled successfully, FALSE otherwise
* @return MSG_HANDLED if set was handled successfully, MSG_NOT_HANDLED otherwise.
*/
gboolean
cb_ret_t
widget_set_state (Widget * w, widget_state_t state, gboolean enable)
{
gboolean ret = TRUE;
gboolean ret = MSG_HANDLED;
if (enable)
w->state |= state;
@ -239,15 +239,14 @@ widget_set_state (Widget * w, widget_state_t state, gboolean enable)
}
if (w->owner == NULL)
return FALSE;
return MSG_NOT_HANDLED;
switch (state)
{
case WST_DISABLED:
if (send_message (w, NULL, enable ? MSG_DISABLE : MSG_ENABLE, 0, NULL) != MSG_HANDLED)
ret = FALSE;
if (ret)
send_message (w, NULL, MSG_DRAW, 0, NULL);
ret = send_message (w, NULL, enable ? MSG_DISABLE : MSG_ENABLE, 0, NULL);
if (ret == MSG_HANDLED)
ret = send_message (w, NULL, MSG_DRAW, 0, NULL);
break;
default:

View File

@ -177,7 +177,7 @@ void widget_init (Widget * w, int y, int x, int lines, int cols,
cb_ret_t widget_default_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm,
void *data);
void widget_set_options (Widget * w, widget_options_t options, gboolean enable);
gboolean widget_set_state (Widget * w, widget_state_t state, gboolean enable);
cb_ret_t widget_set_state (Widget * w, widget_state_t state, gboolean enable);
void widget_set_size (Widget * widget, int y, int x, int lines, int cols);
/* select color for widget in dependance of state */
void widget_selectcolor (Widget * w, gboolean focused, gboolean hotkey);