WButton: remove WButton::selected. Use WST_FOCUSED instead.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2016-06-12 20:43:21 +03:00
parent ad166313a4
commit e1a2e8f8ec
2 changed files with 40 additions and 40 deletions

View File

@ -120,12 +120,12 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
case MSG_UNFOCUS:
case MSG_FOCUS:
case MSG_DRAW:
if (msg == MSG_UNFOCUS)
b->selected = FALSE;
else if (msg == MSG_FOCUS)
b->selected = TRUE;
{
gboolean focused;
widget_selectcolor (w, b->selected, FALSE);
focused = widget_get_state (w, WST_FOCUSED);
widget_selectcolor (w, focused, FALSE);
widget_move (w, 0, 0);
switch (b->flags)
@ -144,7 +144,7 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
return MSG_HANDLED;
}
hotkey_draw (w, b->text, b->selected);
hotkey_draw (w, b->text, focused);
switch (b->flags)
{
@ -160,7 +160,9 @@ button_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *
default:
break;
}
return MSG_HANDLED;
}
case MSG_DESTROY:
release_hotkey (b->text);
@ -212,7 +214,6 @@ button_new (int y, int x, int action, button_flags_t flags, const char *text, bc
b->text = parse_hotkey (text);
widget_init (w, y, x, 1, button_get_len (b), button_callback, button_mouse_callback);
w->options |= WOP_SELECTABLE | WOP_WANT_CURSOR | WOP_WANT_HOTKEY;
b->selected = FALSE;
b->callback = callback;
b->hotpos = (b->text.hotkey != NULL) ? str_term_width1 (b->text.start) : -1;

View File

@ -32,7 +32,6 @@ typedef struct WButton
{
Widget widget;
int action; /* what to do when pressed */
gboolean selected; /* button state */
button_flags_t flags; /* button flags */
hotkey_t text; /* text of button, contain hotkey too */