forked from enlightenment/efl
Complete some widgets with activate_hook
widgets: * button * check * file selector button * hoversel * radio Author: Helen Fornazier <helen.fornazier@profusion.mobi> SVN revision: 52598
This commit is contained in:
parent
12324ed54e
commit
2bc6b517c3
|
@ -41,6 +41,8 @@ static void _signal_pressed(void *data, Evas_Object *obj, const char *emission,
|
|||
static void _signal_unpressed(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _on_focus_hook(void *data, Evas_Object *obj);
|
||||
static void _selection_done(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _activate(Evas_Object *obj);
|
||||
static void _activate_hook(Evas_Object *obj);
|
||||
|
||||
static const char SIG_CLICKED[] = "clicked";
|
||||
static const char SIG_UNPRESSED[] = "unpressed";
|
||||
|
@ -166,15 +168,27 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
static void
|
||||
_signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
_activate(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
|
||||
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
|
||||
evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
|
||||
|
||||
/* safe guard when the theme does not emit the 'unpress' signal */
|
||||
_signal_unpressed(data, obj, emission, source);
|
||||
_signal_unpressed(obj, wd->btn, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_activate_hook(Evas_Object *obj)
|
||||
{
|
||||
_activate(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
{
|
||||
_activate(data);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
|
@ -343,6 +357,7 @@ elm_fileselector_button_add(Evas_Object *parent)
|
|||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_disable_hook_set(obj, _disable_hook);
|
||||
elm_widget_can_focus_set(obj, 1);
|
||||
elm_widget_activate_hook_set(obj, _activate_hook);
|
||||
|
||||
wd->btn = edje_object_add(e);
|
||||
_elm_theme_object_set(obj, wd->btn, "button", "base", "default");
|
||||
|
|
|
@ -42,6 +42,8 @@ struct _Elm_Hoversel_Item
|
|||
static const char *widtype = NULL;
|
||||
static void _del_pre_hook(Evas_Object *obj);
|
||||
static void _del_hook(Evas_Object *obj);
|
||||
static void _activate(Evas_Object *obj);
|
||||
static void _activate_hook(Evas_Object *obj);
|
||||
static void _disable_hook(Evas_Object *obj);
|
||||
static void _sizing_eval(Evas_Object *obj);
|
||||
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
@ -206,6 +208,12 @@ _activate(Evas_Object *obj)
|
|||
// if (wd->horizontal) evas_object_hide(wd->btn);
|
||||
}
|
||||
|
||||
static void
|
||||
_activate_hook(Evas_Object *obj)
|
||||
{
|
||||
_activate(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_button_clicked(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
||||
{
|
||||
|
@ -247,6 +255,7 @@ elm_hoversel_add(Evas_Object *parent)
|
|||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_disable_hook_set(obj, _disable_hook);
|
||||
elm_widget_activate_hook_set(obj, _activate_hook);
|
||||
|
||||
wd->btn = elm_button_add(parent);
|
||||
if (wd->horizontal)
|
||||
|
|
|
@ -32,6 +32,8 @@ static void _signal_clicked(void *data, Evas_Object *obj, const char *emission,
|
|||
static void _signal_pressed(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _signal_unpressed(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _on_focus_hook(void *data, Evas_Object *obj);
|
||||
static void _activate(Evas_Object *obj);
|
||||
static void _activate_hook(Evas_Object *obj);
|
||||
|
||||
static const char SIG_CLICKED[] = "clicked";
|
||||
static const char SIG_REPEATED[] = "repeated";
|
||||
|
@ -143,9 +145,9 @@ _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
static void
|
||||
_signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
|
||||
_activate(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
if (wd->timer)
|
||||
{
|
||||
|
@ -153,8 +155,20 @@ _signal_clicked(void *data, Evas_Object *obj, const char *emission, const char *
|
|||
wd->timer = NULL;
|
||||
}
|
||||
wd->repeating = EINA_FALSE;
|
||||
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
|
||||
_signal_unpressed(data, obj, emission, source); /* safe guard when the theme does not emit the 'unpress' signal */
|
||||
evas_object_smart_callback_call(obj, SIG_CLICKED, NULL);
|
||||
_signal_unpressed(obj, wd->btn, NULL, NULL); /* safe guard when the theme does not emit the 'unpress' signal */
|
||||
}
|
||||
|
||||
static void
|
||||
_activate_hook(Evas_Object *obj)
|
||||
{
|
||||
_activate(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_clicked(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
_activate(data);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -243,6 +257,7 @@ elm_button_add(Evas_Object *parent)
|
|||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_disable_hook_set(obj, _disable_hook);
|
||||
elm_widget_can_focus_set(obj, 1);
|
||||
elm_widget_activate_hook_set(obj, _activate_hook);
|
||||
|
||||
wd->btn = edje_object_add(e);
|
||||
_elm_theme_object_set(obj, wd->btn, "button", "base", "default");
|
||||
|
|
|
@ -39,6 +39,9 @@ static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
|||
static void _signal_check_off(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _signal_check_on(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _signal_check_toggle(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _on_focus_hook(void *data, Evas_Object *obj);
|
||||
static void _activate_hook(Evas_Object *obj);
|
||||
static void _activate(Evas_Object *obj);
|
||||
|
||||
static const char SIG_CHANGED[] = "changed";
|
||||
static const Evas_Smart_Cb_Description _signals[] = {
|
||||
|
@ -156,7 +159,19 @@ _signal_check_on(void *data, Evas_Object *obj __UNUSED__, const char *emission _
|
|||
static void
|
||||
_signal_check_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
_activate(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_activate_hook(Evas_Object *obj)
|
||||
{
|
||||
_activate(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_activate(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
wd->state = !wd->state;
|
||||
if (wd->statep) *wd->statep = wd->state;
|
||||
|
@ -164,7 +179,7 @@ _signal_check_toggle(void *data, Evas_Object *obj __UNUSED__, const char *emissi
|
|||
edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
|
||||
evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
|
||||
evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -192,6 +207,8 @@ elm_check_add(Evas_Object *parent)
|
|||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_disable_hook_set(obj, _disable_hook);
|
||||
elm_widget_can_focus_set(obj, 1);
|
||||
elm_widget_activate_hook_set(obj, _activate_hook);
|
||||
|
||||
wd->chk = edje_object_add(e);
|
||||
_elm_theme_object_set(obj, wd->chk, "check", "base", "default");
|
||||
|
|
|
@ -59,6 +59,9 @@ static void _sizing_eval(Evas_Object *obj);
|
|||
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _signal_radio_on(void *data, Evas_Object *obj, const char *emission, const char *source);
|
||||
static void _on_focus_hook(void *data, Evas_Object *obj);
|
||||
static void _activate(Evas_Object *obj);
|
||||
static void _activate_hook(Evas_Object *obj);
|
||||
|
||||
static const char SIG_CHANGED[] = "changed";
|
||||
static const Evas_Smart_Cb_Description _signals[] = {
|
||||
|
@ -190,15 +193,27 @@ _state_set_all(Widget_Data *wd)
|
|||
}
|
||||
|
||||
static void
|
||||
_signal_radio_on(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
_activate(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
if (wd->group->value == wd->value) return;
|
||||
wd->group->value = wd->value;
|
||||
if (wd->group->valuep) *(wd->group->valuep) = wd->group->value;
|
||||
_state_set_all(wd);
|
||||
evas_object_smart_callback_call(data, SIG_CHANGED, NULL);
|
||||
evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_activate_hook(Evas_Object *obj)
|
||||
{
|
||||
_activate(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_signal_radio_on(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||
{
|
||||
_activate(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -226,6 +241,8 @@ elm_radio_add(Evas_Object *parent)
|
|||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_disable_hook_set(obj, _disable_hook);
|
||||
elm_widget_can_focus_set(obj, 1);
|
||||
elm_widget_activate_hook_set(obj, _activate_hook);
|
||||
|
||||
wd->radio = edje_object_add(e);
|
||||
_elm_theme_object_set(obj, wd->radio, "radio", "base", "default");
|
||||
|
|
Loading…
Reference in New Issue