forked from enlightenment/efl
Send signal informing changes in icon state.
Inform that the item was disabled, highlighted or selected. If a toolbar icon is an edje it can receive this signal and change the icon image to a disabled image. By: Otavio Pontes <otavio@profusion.mobi> SVN revision: 54006
This commit is contained in:
parent
1d23d0ae54
commit
f94f6fb3ee
|
@ -10377,6 +10377,16 @@ collections {
|
||||||
source: "event";
|
source: "event";
|
||||||
action: SIGNAL_EMIT "elm,action,click" "elm";
|
action: SIGNAL_EMIT "elm,action,click" "elm";
|
||||||
}
|
}
|
||||||
|
program { name: "mouse,in";
|
||||||
|
signal: "mouse,in";
|
||||||
|
source: "event";
|
||||||
|
action: SIGNAL_EMIT "elm,mouse,in" "elm";
|
||||||
|
}
|
||||||
|
program { name: "mouse,out";
|
||||||
|
signal: "mouse,out";
|
||||||
|
source: "event";
|
||||||
|
action: SIGNAL_EMIT "elm,mouse,out" "elm";
|
||||||
|
}
|
||||||
program { name: "disable";
|
program { name: "disable";
|
||||||
signal: "elm,state,disabled";
|
signal: "elm,state,disabled";
|
||||||
source: "elm";
|
source: "elm";
|
||||||
|
|
|
@ -63,6 +63,40 @@ _theme_hook(Evas_Object *obj)
|
||||||
_sizing_eval(obj);
|
_sizing_eval(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return;
|
||||||
|
Evas_Object *icon_edje;
|
||||||
|
icon_edje = _els_smart_icon_edje_get(wd->img);
|
||||||
|
if (!icon_edje) return;
|
||||||
|
edje_object_signal_emit(icon_edje, emission, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return;
|
||||||
|
Evas_Object *icon_edje;
|
||||||
|
icon_edje = _els_smart_icon_edje_get(wd->img);
|
||||||
|
if (!icon_edje) return;
|
||||||
|
edje_object_signal_callback_add(icon_edje, emission, source, func_cb, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *
|
||||||
|
_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source))
|
||||||
|
{
|
||||||
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return NULL;
|
||||||
|
Evas_Object *icon_edje;
|
||||||
|
icon_edje = _els_smart_icon_edje_get(wd->img);
|
||||||
|
if (!icon_edje) return NULL;
|
||||||
|
return edje_object_signal_callback_del(icon_edje, emission, source,
|
||||||
|
func_cb);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_sizing_eval(Evas_Object *obj)
|
_sizing_eval(Evas_Object *obj)
|
||||||
{
|
{
|
||||||
|
@ -142,6 +176,9 @@ elm_icon_add(Evas_Object *parent)
|
||||||
elm_widget_data_set(obj, wd);
|
elm_widget_data_set(obj, wd);
|
||||||
elm_widget_del_hook_set(obj, _del_hook);
|
elm_widget_del_hook_set(obj, _del_hook);
|
||||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||||
|
elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
|
||||||
|
elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
|
||||||
|
elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
|
||||||
|
|
||||||
wd->lookup_order = ELM_ICON_LOOKUP_FDO_THEME;
|
wd->lookup_order = ELM_ICON_LOOKUP_FDO_THEME;
|
||||||
wd->img = _els_smart_icon_add(e);
|
wd->img = _els_smart_icon_add(e);
|
||||||
|
|
|
@ -119,6 +119,7 @@ _item_select(Elm_Toolbar_Item *it)
|
||||||
it->selected = EINA_TRUE;
|
it->selected = EINA_TRUE;
|
||||||
wd->selected_item = it;
|
wd->selected_item = it;
|
||||||
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
|
edje_object_signal_emit(it->base.view, "elm,state,selected", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
||||||
_item_show(it);
|
_item_show(it);
|
||||||
obj2 = it->base.widget;
|
obj2 = it->base.widget;
|
||||||
if(it->menu)
|
if(it->menu)
|
||||||
|
@ -173,9 +174,15 @@ _item_disable(Elm_Toolbar_Item *it, Eina_Bool disabled)
|
||||||
if (it->disabled == disabled) return;
|
if (it->disabled == disabled) return;
|
||||||
it->disabled = disabled;
|
it->disabled = disabled;
|
||||||
if (it->disabled)
|
if (it->disabled)
|
||||||
|
{
|
||||||
edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
|
edje_object_signal_emit(it->base.view, "elm,state,disabled", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
|
edje_object_signal_emit(it->base.view, "elm,state,enabled", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,enabled", "elm");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -228,9 +235,15 @@ _theme_hook(Evas_Object *obj)
|
||||||
if (!it->separator)
|
if (!it->separator)
|
||||||
{
|
{
|
||||||
if (it->selected)
|
if (it->selected)
|
||||||
|
{
|
||||||
edje_object_signal_emit(view, "elm,state,selected", "elm");
|
edje_object_signal_emit(view, "elm,state,selected", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,selected", "elm");
|
||||||
|
}
|
||||||
if (it->disabled)
|
if (it->disabled)
|
||||||
|
{
|
||||||
edje_object_signal_emit(view, "elm,state,disabled", "elm");
|
edje_object_signal_emit(view, "elm,state,disabled", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,disabled", "elm");
|
||||||
|
}
|
||||||
_elm_theme_object_set(obj, view, "toolbar", "item", style);
|
_elm_theme_object_set(obj, view, "toolbar", "item", style);
|
||||||
if (it->icon)
|
if (it->icon)
|
||||||
{
|
{
|
||||||
|
@ -470,6 +483,22 @@ _select(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__
|
||||||
_item_select(data);
|
_item_select(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mouse_in(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||||
|
{
|
||||||
|
Elm_Toolbar_Item *it = data;
|
||||||
|
edje_object_signal_emit(it->base.view, "elm,state,highlighted", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,highlighted", "elm");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_mouse_out(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
|
||||||
|
{
|
||||||
|
Elm_Toolbar_Item *it = data;
|
||||||
|
edje_object_signal_emit(it->base.view, "elm,state,unhighlighted", "elm");
|
||||||
|
elm_widget_signal_emit(it->icon, "elm,state,unhighlighted", "elm");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
|
_layout(Evas_Object *o, Evas_Object_Box_Data *priv, void *data)
|
||||||
{
|
{
|
||||||
|
@ -517,6 +546,10 @@ _item_new(Evas_Object *obj, const char *icon, const char *label, Evas_Smart_Cb f
|
||||||
elm_widget_style_get(obj));
|
elm_widget_style_get(obj));
|
||||||
edje_object_signal_callback_add(it->base.view, "elm,action,click", "elm",
|
edje_object_signal_callback_add(it->base.view, "elm,action,click", "elm",
|
||||||
_select, it);
|
_select, it);
|
||||||
|
edje_object_signal_callback_add(it->base.view, "elm,mouse,in", "elm",
|
||||||
|
_mouse_in, it);
|
||||||
|
edje_object_signal_callback_add(it->base.view, "elm,mouse,out", "elm",
|
||||||
|
_mouse_out, it);
|
||||||
elm_widget_sub_object_add(obj, it->base.view);
|
elm_widget_sub_object_add(obj, it->base.view);
|
||||||
if (it->icon)
|
if (it->icon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -405,6 +405,15 @@ _els_smart_icon_edit_get(const Evas_Object *obj)
|
||||||
return sd->edit;
|
return sd->edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Evas_Object *
|
||||||
|
_els_smart_icon_edje_get(Evas_Object *obj)
|
||||||
|
{
|
||||||
|
Smart_Data *sd = evas_object_smart_data_get(obj);
|
||||||
|
if (!sd) return NULL;
|
||||||
|
if (!sd->edje) return NULL;
|
||||||
|
return sd->obj;
|
||||||
|
}
|
||||||
|
|
||||||
/* local subsystem globals */
|
/* local subsystem globals */
|
||||||
static void
|
static void
|
||||||
_smart_reconfigure(Smart_Data *sd)
|
_smart_reconfigure(Smart_Data *sd)
|
||||||
|
|
|
@ -20,3 +20,4 @@ void _els_smart_icon_orient_set (Evas_Object *obj, Elm_Image_Orien
|
||||||
Elm_Image_Orient _els_smart_icon_orient_get (const Evas_Object *obj);
|
Elm_Image_Orient _els_smart_icon_orient_get (const Evas_Object *obj);
|
||||||
void _els_smart_icon_edit_set (Evas_Object *obj, Eina_Bool, Evas_Object *parent);
|
void _els_smart_icon_edit_set (Evas_Object *obj, Eina_Bool, Evas_Object *parent);
|
||||||
Eina_Bool _els_smart_icon_edit_get (const Evas_Object *obj);
|
Eina_Bool _els_smart_icon_edit_get (const Evas_Object *obj);
|
||||||
|
Evas_Object *_els_smart_icon_edje_get(Evas_Object *obj);
|
||||||
|
|
Loading…
Reference in New Issue