forked from enlightenment/efl
toolbar: added selected and unselected smartcallbacks to toolbar.
- Item based widget should emit this signal. This is good for the consistency and makes application developers easy to guess. - Added test case to elementary_test -> toolbar @feature
This commit is contained in:
parent
3b83fc3b93
commit
fbf2c58127
|
@ -5,6 +5,17 @@
|
|||
|
||||
Evas_Object * _focus_autoscroll_mode_frame_create(Evas_Object *parent);
|
||||
|
||||
static void
|
||||
_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
const char *str = elm_object_item_text_get(event_info);
|
||||
printf("item %p is %s.", event_info, (char *)data);
|
||||
if (str)
|
||||
printf(" string is \"%s\"\n", str);
|
||||
else
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_tb_sel1_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -106,6 +117,8 @@ test_toolbar(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
|
|||
evas_object_show(bx);
|
||||
|
||||
tb = elm_toolbar_add(win);
|
||||
evas_object_smart_callback_add(tb, "selected", _selected_cb, "selected");
|
||||
evas_object_smart_callback_add(tb, "unselected", _selected_cb, "unselected");
|
||||
elm_toolbar_shrink_mode_set(tb, ELM_TOOLBAR_SHRINK_MENU);
|
||||
evas_object_size_hint_weight_set(tb, 0.0, 0.0);
|
||||
evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, 0.0);
|
||||
|
|
|
@ -26,6 +26,8 @@ static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
|
|||
static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
|
||||
static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
|
||||
static const char SIG_CLICKED[] = "clicked";
|
||||
static const char SIG_SELECTED[] = "selected";
|
||||
static const char SIG_UNSELECTED[] = "unselected";
|
||||
static const char SIG_LONGPRESSED[] = "longpressed";
|
||||
static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
|
||||
static const char SIG_ITEM_FOCUSED[] = "item,focused";
|
||||
|
@ -37,6 +39,8 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|||
{SIG_SCROLL_DRAG_START, ""},
|
||||
{SIG_SCROLL_DRAG_STOP, ""},
|
||||
{SIG_CLICKED, ""},
|
||||
{SIG_SELECTED, ""},
|
||||
{SIG_UNSELECTED, ""},
|
||||
{SIG_LONGPRESSED, ""},
|
||||
{SIG_CLICKED_DOUBLE, ""},
|
||||
{SIG_ITEM_FOCUSED, ""},
|
||||
|
@ -153,6 +157,7 @@ _item_unselect(Elm_Toolbar_Item *item)
|
|||
edje_object_signal_emit(VIEW(item), "elm,state,unselected", "elm");
|
||||
if (item->icon)
|
||||
elm_widget_signal_emit(item->icon, "elm,state,unselected", "elm");
|
||||
evas_object_smart_callback_call(WIDGET(item), SIG_UNSELECTED, item);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1100,6 +1105,7 @@ _item_select(Elm_Toolbar_Item *it)
|
|||
if (it->func) it->func((void *)(it->base.data), WIDGET(it), it);
|
||||
}
|
||||
evas_object_smart_callback_call(obj, SIG_CLICKED, it);
|
||||
evas_object_smart_callback_call(obj, SIG_SELECTED, it);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -523,6 +523,8 @@ class Elm_Toolbar (Elm_Widget, Elm_Interface_Scrollable)
|
|||
scroll,drag,start;
|
||||
scroll,drag,stop;
|
||||
clicked;
|
||||
selected;
|
||||
unselected;
|
||||
longpressed;
|
||||
clicked,double;
|
||||
language,changed;
|
||||
|
|
|
@ -33,6 +33,10 @@
|
|||
* - @c "unfocused" - When the toolbar has lost focus. (since 1.8)
|
||||
* - @c "item,focused" - When the toolbar item has received focus. (since 1.10)
|
||||
* - @c "item,unfocused" - When the toolbar item has lost focus. (since 1.10)
|
||||
* - @c "selected" - when an item is selected. @p event_info is a selected
|
||||
* item. (since 1.11)
|
||||
* - @c "unselected" - when an item is unselected. @p event_info is a
|
||||
* unselected item. (since 1.11)
|
||||
*
|
||||
* Available styles for it:
|
||||
* - @c "default"
|
||||
|
|
Loading…
Reference in New Issue