Add widget callback for getting stripped of focus. Call it in the input setter, on previous input holder.

This commit is contained in:
Michael Drake 2012-07-31 22:14:48 +01:00
parent daa47fce52
commit 72cb5b6ea4
2 changed files with 11 additions and 0 deletions

View File

@ -48,6 +48,7 @@ typedef enum fbtk_callback_type {
FBTK_CBT_REDRAW,
FBTK_CBT_DESTROY,
FBTK_CBT_USER,
FBTK_CBT_STRIP_FOCUS,
FBTK_CBT_END,
} fbtk_callback_type;

View File

@ -729,6 +729,9 @@ fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...)
case FBTK_CBT_USER:
break;
case FBTK_CBT_STRIP_FOCUS:
break;
default:
break;
}
@ -749,6 +752,13 @@ fbtk_set_focus(fbtk_widget_t *widget)
/* ensure we have the root widget */
root = fbtk_get_root_widget(widget);
if (root->u.root.input != NULL &&
root->u.root.input != widget) {
/* inform previous holder of focus that it's being stripped
* of focus */
fbtk_post_callback(root->u.root.input, FBTK_CBT_STRIP_FOCUS);
}
root->u.root.input = widget;
}