forked from enlightenment/efl
elm: Remove custom layout signal APIs
This merges them with the now standard interface: Efl.Canvas.Layout_Signal Some wrapping work was required for legacy API which takes no user_data in del() but instead returns it. The new EO function, while harder to use, is more correct (you can't delete the invalid callback by accident, and this follows EO events design). Another crazy wrapping was done in entry/text in order to add the callbacks to 2 objects instead of just one, and still return the user data. As for Naviframe and Popup, those two widgets override signal_emit to forward the call to another object than the resize object, but not callback_add/del. So they are definitely broken. Ref T5315
This commit is contained in:
parent
efac7d523a
commit
3e5cfb83c0
|
@ -1168,7 +1168,7 @@ _efl_ui_image_efl_file_file_set(Eo *obj, Efl_Ui_Image_Data *sd, const char *file
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_image_edje_object_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *emission, const char *source)
|
||||
_efl_ui_image_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, const char *emission, const char *source)
|
||||
{
|
||||
if (sd->edje)
|
||||
edje_object_signal_emit(sd->img, emission, source);
|
||||
|
|
|
@ -135,7 +135,7 @@ class Efl.Ui.Image (Elm.Widget, Efl.Ui.Clickable, Efl.Ui.Draggable,
|
|||
Efl.Flipable.flip { get; set; }
|
||||
Efl.Player.playable { get; }
|
||||
Efl.Player.play { get; set; }
|
||||
Edje.Object.signal_emit;
|
||||
Efl.Canvas.Layout_Signal.signal_emit;
|
||||
Edje.Object.group_size_min { get; }
|
||||
Edje.Object.group_size_max { get; }
|
||||
Efl.Canvas.Layout_Calc.calc_size_min;
|
||||
|
|
|
@ -2573,69 +2573,43 @@ _markup_filter_cb(void *data,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_text_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source)
|
||||
_efl_ui_text_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source)
|
||||
{
|
||||
/* always pass to both edje objs */
|
||||
edje_object_signal_emit(sd->entry_edje, emission, source);
|
||||
edje_object_message_signal_process(sd->entry_edje);
|
||||
efl_canvas_layout_signal_emit(sd->entry_edje, emission, source);
|
||||
|
||||
// FIXME: This should not be here!
|
||||
efl_canvas_layout_signal_process(sd->entry_edje, EINA_TRUE);
|
||||
|
||||
if (sd->scr_edje)
|
||||
{
|
||||
edje_object_signal_emit(sd->scr_edje, emission, source);
|
||||
edje_object_message_signal_process(sd->scr_edje);
|
||||
efl_canvas_layout_signal_emit(sd->scr_edje, emission, source);
|
||||
efl_canvas_layout_signal_process(sd->scr_edje, EINA_TRUE); // FIXME
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_text_elm_layout_signal_callback_add (Eo *obj, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_text_efl_canvas_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
{
|
||||
Evas_Object *ro;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
ro = wd->resize_obj;
|
||||
|
||||
wd->resize_obj = sd->entry_edje;
|
||||
|
||||
elm_obj_layout_signal_callback_add
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb, data);
|
||||
Eina_Bool ok;
|
||||
|
||||
ok = efl_canvas_layout_signal_callback_add(sd->entry_edje, emission, source, func_cb, data);
|
||||
if (sd->scr_edje)
|
||||
{
|
||||
wd->resize_obj = sd->scr_edje;
|
||||
ok = efl_canvas_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
|
||||
|
||||
elm_obj_layout_signal_callback_add
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb, data);
|
||||
}
|
||||
|
||||
wd->resize_obj = ro;
|
||||
return ok;
|
||||
}
|
||||
|
||||
EOLIAN static void *
|
||||
_efl_ui_text_elm_layout_signal_callback_del(Eo *obj, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb)
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_text_efl_canvas_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Efl_Ui_Text_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
{
|
||||
Evas_Object *ro;
|
||||
void *data = NULL;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
|
||||
ro = wd->resize_obj;
|
||||
|
||||
wd->resize_obj = sd->entry_edje;
|
||||
|
||||
data = elm_obj_layout_signal_callback_del
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb);
|
||||
Eina_Bool ok;
|
||||
|
||||
ok = efl_canvas_layout_signal_callback_del(sd->entry_edje, emission, source, func_cb, data);
|
||||
if (sd->scr_edje)
|
||||
{
|
||||
wd->resize_obj = sd->scr_edje;
|
||||
ok = efl_canvas_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
|
||||
|
||||
data = elm_obj_layout_signal_callback_del
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb);
|
||||
}
|
||||
|
||||
wd->resize_obj = ro;
|
||||
return data;
|
||||
return ok;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
|
@ -404,6 +404,9 @@ class Efl.Ui.Text (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
|||
Efl.Gfx.position { set; }
|
||||
Efl.Gfx.size { set; }
|
||||
Efl.Canvas.Group.group_member_add;
|
||||
Efl.Canvas.Layout_Signal.signal_callback_add;
|
||||
Efl.Canvas.Layout_Signal.signal_callback_del;
|
||||
Efl.Canvas.Layout_Signal.signal_emit;
|
||||
Elm.Widget.activate;
|
||||
Elm.Widget.focus_direction_manager_is;
|
||||
Elm.Widget.theme_apply;
|
||||
|
@ -413,9 +416,6 @@ class Efl.Ui.Text (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
|||
Elm.Widget.sub_object_del;
|
||||
Elm.Widget.focus_next_manager_is;
|
||||
Elm.Layout.sizing_eval;
|
||||
Elm.Layout.signal_callback_add;
|
||||
Elm.Layout.signal_callback_del;
|
||||
Elm.Layout.signal_emit;
|
||||
Elm.Interface_Scrollable.policy { set; }
|
||||
Elm.Interface_Scrollable.bounce_allow { set; }
|
||||
Elm.Interface.Atspi_Accessible.state_set { get; }
|
||||
|
|
|
@ -1014,7 +1014,7 @@ _back_btn_new(Evas_Object *obj, const char *title_label)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_naviframe_elm_layout_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *emission, const char *source)
|
||||
_elm_naviframe_efl_canvas_layout_signal_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSED, const char *emission, const char *source)
|
||||
{
|
||||
Elm_Object_Item *eo_top_it;
|
||||
|
||||
|
@ -1022,7 +1022,7 @@ _elm_naviframe_elm_layout_signal_emit(Eo *obj, Elm_Naviframe_Data *sd EINA_UNUSE
|
|||
if (!eo_top_it) return;
|
||||
ELM_NAVIFRAME_ITEM_DATA_GET(eo_top_it, top_it);
|
||||
|
||||
elm_obj_layout_signal_emit(VIEW(top_it), emission, source);
|
||||
efl_canvas_layout_signal_emit(VIEW(top_it), emission, source);
|
||||
}
|
||||
|
||||
/* content/text smart functions proxying things to the top item, which
|
||||
|
|
|
@ -503,7 +503,7 @@ _elm_popup_elm_layout_sizing_eval(Eo *obj, Elm_Popup_Data *sd)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_popup_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Elm_Popup_Data *sd, const char *emission, const char *source)
|
||||
_elm_popup_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Elm_Popup_Data *sd, const char *emission, const char *source)
|
||||
{
|
||||
elm_layout_signal_emit(sd->main_layout, emission, source);
|
||||
}
|
||||
|
|
|
@ -987,9 +987,9 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
|
|||
elm_entry_end_visible_set(obj, EINA_TRUE);
|
||||
|
||||
if (sd->scroll)
|
||||
edje_obj_signal_emit(sd->entry_edje, "elm,scroll,enable", "elm");
|
||||
efl_canvas_layout_signal_emit(sd->entry_edje, "elm,scroll,enable", "elm");
|
||||
else
|
||||
edje_obj_signal_emit(sd->entry_edje, "elm,scroll,disable", "elm");
|
||||
efl_canvas_layout_signal_emit(sd->entry_edje, "elm,scroll,disable", "elm");
|
||||
|
||||
sd->changed = EINA_TRUE;
|
||||
elm_layout_sizing_eval(obj);
|
||||
|
@ -3070,7 +3070,7 @@ _chars_add_till_limit(Evas_Object *obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_entry_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source)
|
||||
_elm_entry_efl_canvas_layout_signal_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source)
|
||||
{
|
||||
/* always pass to both edje objs */
|
||||
edje_object_signal_emit(sd->entry_edje, emission, source);
|
||||
|
@ -3083,55 +3083,61 @@ _elm_entry_elm_layout_signal_emit(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const
|
|||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_entry_elm_layout_signal_callback_add (Eo *obj, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_entry_efl_canvas_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
{
|
||||
Evas_Object *ro;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
ro = wd->resize_obj;
|
||||
|
||||
wd->resize_obj = sd->entry_edje;
|
||||
|
||||
elm_obj_layout_signal_callback_add
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb, data);
|
||||
Eina_Bool ok;
|
||||
|
||||
ok = efl_canvas_layout_signal_callback_add(sd->entry_edje, emission, source, func_cb, data);
|
||||
if (sd->scr_edje)
|
||||
{
|
||||
wd->resize_obj = sd->scr_edje;
|
||||
ok = efl_canvas_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
|
||||
|
||||
elm_obj_layout_signal_callback_add
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb, data);
|
||||
}
|
||||
|
||||
wd->resize_obj = ro;
|
||||
return ok;
|
||||
}
|
||||
|
||||
EOLIAN static void *
|
||||
_elm_entry_elm_layout_signal_callback_del(Eo *obj, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_entry_efl_canvas_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
{
|
||||
Evas_Object *ro;
|
||||
void *data = NULL;
|
||||
Eina_Bool ok;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
ok = efl_canvas_layout_signal_callback_del(sd->entry_edje, emission, source, func_cb, data);
|
||||
if (sd->scr_edje)
|
||||
ok = efl_canvas_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
|
||||
|
||||
ro = wd->resize_obj;
|
||||
return ok;
|
||||
}
|
||||
|
||||
wd->resize_obj = sd->entry_edje;
|
||||
// Legacy support... del() returns the user data.
|
||||
void
|
||||
_elm_entry_signal_callback_add_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
{
|
||||
Elm_Entry_Data *sd;
|
||||
|
||||
data = elm_obj_layout_signal_callback_del
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb);
|
||||
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||
if (!sd) return;
|
||||
|
||||
_elm_layout_signal_callback_add_legacy(obj, sd->entry_edje, &sd->edje_signals,
|
||||
emission, source, func_cb, data);
|
||||
|
||||
if (sd->scr_edje)
|
||||
{
|
||||
wd->resize_obj = sd->scr_edje;
|
||||
efl_canvas_layout_signal_callback_add(sd->scr_edje, emission, source, func_cb, data);
|
||||
}
|
||||
|
||||
data = elm_obj_layout_signal_callback_del
|
||||
(efl_super(obj, MY_CLASS), emission, source, func_cb);
|
||||
}
|
||||
void *
|
||||
_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb)
|
||||
{
|
||||
Elm_Entry_Data *sd;
|
||||
void *data;
|
||||
|
||||
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||
if (!sd) return NULL;
|
||||
|
||||
data = _elm_layout_signal_callback_del_legacy(obj, sd->entry_edje, &sd->edje_signals,
|
||||
emission, source, func_cb);
|
||||
|
||||
if (sd->scr_edje)
|
||||
efl_canvas_layout_signal_callback_del(sd->scr_edje, emission, source, func_cb, data);
|
||||
|
||||
wd->resize_obj = ro;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
|
|
@ -954,6 +954,9 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
|||
Efl.Gfx.position { set; }
|
||||
Efl.Gfx.size { set; }
|
||||
Efl.Canvas.Group.group_member_add;
|
||||
Efl.Canvas.Layout_Signal.signal_callback_add;
|
||||
Efl.Canvas.Layout_Signal.signal_callback_del;
|
||||
Efl.Canvas.Layout_Signal.signal_emit;
|
||||
Elm.Widget.activate;
|
||||
Elm.Widget.focus_direction_manager_is;
|
||||
Elm.Widget.theme_apply;
|
||||
|
@ -963,9 +966,6 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
|
|||
Elm.Widget.sub_object_del;
|
||||
Elm.Widget.focus_next_manager_is;
|
||||
Elm.Layout.sizing_eval;
|
||||
Elm.Layout.signal_callback_add;
|
||||
Elm.Layout.signal_callback_del;
|
||||
Elm.Layout.signal_emit;
|
||||
Elm.Interface_Scrollable.policy { set; }
|
||||
Elm.Interface_Scrollable.bounce_allow { set; }
|
||||
Elm.Interface.Atspi_Accessible.state_set { get; }
|
||||
|
|
|
@ -912,68 +912,34 @@ _elm_layout_theme_set(Eo *obj, Elm_Layout_Smart_Data *sd, const char *klass, con
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_layout_signal_emit(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source)
|
||||
_elm_layout_efl_canvas_layout_signal_signal_emit(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source)
|
||||
{
|
||||
// Don't do anything else than call forward here
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
edje_object_signal_emit(wd->resize_obj, emission, source);
|
||||
efl_canvas_layout_signal_emit(wd->resize_obj, emission, source);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_layout_signal_callback_add(Eo *obj, Elm_Layout_Smart_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_layout_efl_canvas_layout_signal_signal_callback_add(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
||||
{
|
||||
Edje_Signal_Data *esd;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
esd = ELM_NEW(Edje_Signal_Data);
|
||||
if (!esd) return;
|
||||
|
||||
esd->obj = obj;
|
||||
esd->func = func_cb;
|
||||
esd->emission = eina_stringshare_add(emission);
|
||||
esd->source = eina_stringshare_add(source);
|
||||
esd->data = data;
|
||||
sd->edje_signals = eina_list_append(sd->edje_signals, esd);
|
||||
|
||||
edje_object_signal_callback_add
|
||||
(wd->resize_obj, emission, source,
|
||||
_edje_signal_callback, esd);
|
||||
// Don't do anything else than call forward here
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||
return efl_canvas_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
|
||||
}
|
||||
|
||||
EOLIAN static void*
|
||||
_elm_layout_signal_callback_del(Eo *obj, Elm_Layout_Smart_Data *sd, const char *emission, const char *source, Edje_Signal_Cb func_cb)
|
||||
EOLIAN static Eina_Bool
|
||||
_elm_layout_efl_canvas_layout_signal_signal_callback_del(Eo *obj, Elm_Layout_Smart_Data *_pd EINA_UNUSED, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
|
||||
{
|
||||
Edje_Signal_Data *esd = NULL;
|
||||
void *data = NULL;
|
||||
Eina_List *l;
|
||||
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
|
||||
EINA_LIST_FOREACH(sd->edje_signals, l, esd)
|
||||
{
|
||||
if ((esd->func == func_cb) && (!strcmp(esd->emission, emission)) &&
|
||||
(!strcmp(esd->source, source)))
|
||||
{
|
||||
sd->edje_signals = eina_list_remove_list(sd->edje_signals, l);
|
||||
eina_stringshare_del(esd->emission);
|
||||
eina_stringshare_del(esd->source);
|
||||
data = esd->data;
|
||||
|
||||
edje_object_signal_callback_del_full
|
||||
(wd->resize_obj, emission, source,
|
||||
_edje_signal_callback, esd);
|
||||
|
||||
free(esd);
|
||||
|
||||
return data; /* stop at 1st match */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
// Don't do anything else than call forward here
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
|
||||
return efl_canvas_layout_signal_callback_add(wd->resize_obj, emission, source, func, data);
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// - message_send
|
||||
// - message_signal_process
|
||||
// and also message handler (not implemented yet as an EO interface!)
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_layout_content_set(Evas_Object *obj,
|
||||
const char *swallow,
|
||||
|
@ -2379,6 +2345,105 @@ elm_layout_thaw(Evas_Object *obj)
|
|||
return efl_canvas_layout_calc_thaw(obj);
|
||||
}
|
||||
|
||||
void
|
||||
_elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals,
|
||||
const char *emission, const char *source,
|
||||
Edje_Signal_Cb func, void *data)
|
||||
{
|
||||
Edje_Signal_Data *esd;
|
||||
|
||||
esd = ELM_NEW(Edje_Signal_Data);
|
||||
if (!esd) return;
|
||||
|
||||
esd->obj = obj;
|
||||
esd->func = func;
|
||||
esd->emission = eina_stringshare_add(emission);
|
||||
esd->source = eina_stringshare_add(source);
|
||||
esd->data = data;
|
||||
*p_edje_signals = eina_list_append(*p_edje_signals, esd);
|
||||
|
||||
efl_canvas_layout_signal_callback_add(edje, emission, source,
|
||||
_edje_signal_callback, esd);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_layout_signal_callback_add(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
|
||||
{
|
||||
Elm_Layout_Smart_Data *sd;
|
||||
|
||||
if (!emission || !source) return;
|
||||
|
||||
if (efl_isa(obj, ELM_ENTRY_CLASS))
|
||||
{
|
||||
_elm_entry_signal_callback_add_legacy(obj, emission, source, func, data);
|
||||
return;
|
||||
}
|
||||
|
||||
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||
if (!sd) return;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
_elm_layout_signal_callback_add_legacy(obj, wd->resize_obj, &sd->edje_signals,
|
||||
emission, source, func, data);
|
||||
}
|
||||
|
||||
void *
|
||||
_elm_layout_signal_callback_del_legacy(Eo *obj EINA_UNUSED, Eo *edje, Eina_List **p_edje_signals,
|
||||
const char *emission, const char *source,
|
||||
Edje_Signal_Cb func)
|
||||
{
|
||||
Edje_Signal_Data *esd = NULL;
|
||||
void *data = NULL;
|
||||
Eina_List *l;
|
||||
|
||||
if (!emission || !source) return NULL;
|
||||
|
||||
EINA_LIST_FOREACH(*p_edje_signals, l, esd)
|
||||
{
|
||||
if ((esd->func == func) && (!strcmp(esd->emission, emission)) &&
|
||||
(!strcmp(esd->source, source)))
|
||||
{
|
||||
*p_edje_signals = eina_list_remove_list(*p_edje_signals, l);
|
||||
|
||||
efl_canvas_layout_signal_callback_del(edje, emission, source,
|
||||
_edje_signal_callback, esd);
|
||||
|
||||
eina_stringshare_del(esd->emission);
|
||||
eina_stringshare_del(esd->source);
|
||||
data = esd->data;
|
||||
free(esd);
|
||||
|
||||
return data; /* stop at 1st match */
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
elm_layout_signal_callback_del(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func)
|
||||
{
|
||||
Elm_Layout_Smart_Data *sd;
|
||||
|
||||
if (!emission || !source) return NULL;
|
||||
|
||||
if (efl_isa(obj, ELM_ENTRY_CLASS))
|
||||
return _elm_entry_signal_callback_del_legacy(obj, emission, source, func);
|
||||
|
||||
sd = efl_data_scope_safe_get(obj, MY_CLASS);
|
||||
if (!sd) return NULL;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
||||
|
||||
return _elm_layout_signal_callback_del_legacy(obj, wd->resize_obj, &sd->edje_signals,
|
||||
emission, source, func);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_layout_signal_emit(Elm_Layout *obj, const char *emission, const char *source)
|
||||
{
|
||||
efl_canvas_layout_signal_emit(obj, emission, source);
|
||||
}
|
||||
|
||||
/* End of legacy only */
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import edje_types;
|
|||
|
||||
class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
|
||||
Efl.Ui.View, Efl.Ui.Model.Connect, Efl.Ui.Model.Factory.Connect,
|
||||
Efl.Canvas.Layout_Calc)
|
||||
Efl.Canvas.Layout_Calc, Efl.Canvas.Layout_Signal)
|
||||
{
|
||||
[[Elementary layout class]]
|
||||
legacy_prefix: elm_layout;
|
||||
|
@ -70,23 +70,6 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
|
|||
@in height: bool; [[Restrict minimum size ot the current height.]]
|
||||
}
|
||||
}
|
||||
signal_callback_add {
|
||||
[[Add a callback for a (Edje) signal emitted by a layout widget's
|
||||
underlying Edje object.
|
||||
|
||||
This function connects a callback function to a signal emitted by
|
||||
the underlying Edje object of $obj. Globs are accepted in either
|
||||
the emission or source strings.
|
||||
]]
|
||||
params {
|
||||
@in emission: string; [[The signal's name string.]]
|
||||
@in source: string; [[The signal's source string.]]
|
||||
@in func: Edje.Signal_Cb; [[The callback function to be executed
|
||||
when the signal is emitted.]]
|
||||
@in data: void_ptr @optional; [[A pointer to data to pass in to the
|
||||
callback function.]]
|
||||
}
|
||||
}
|
||||
data_get @const {
|
||||
[[Get the edje data from the given layout.
|
||||
|
||||
|
@ -96,56 +79,11 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
|
|||
In EDC this comes from a data block within the group block that
|
||||
$obj was loaded from.
|
||||
]]
|
||||
/* FIXME-doc
|
||||
@code
|
||||
collections {
|
||||
group {
|
||||
name: "a_group";
|
||||
data {
|
||||
item: "key1" "value1";
|
||||
item: "key2" "value2";
|
||||
}
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
return: string; [[The edje data string.]]
|
||||
params {
|
||||
@in key: string; [[The data key.]]
|
||||
}
|
||||
}
|
||||
signal_callback_del {
|
||||
[[Remove a signal-triggered callback from a given layout widget.
|
||||
|
||||
This function removes the last callback attached to a signal
|
||||
emitted by the undelying Edje object of $obj, with parameters
|
||||
$emission, $source and $func matching exactly those passed to a
|
||||
previous call to @.signal_callback_add. The data pointer that
|
||||
was passed to this call will be returned.
|
||||
]]
|
||||
return: void_ptr; [[The data pointer of the signal callback (passed on
|
||||
@.signal_callback_add) or $null on errors.]]
|
||||
params {
|
||||
@in emission: string; [[The signal's name string.]]
|
||||
@in source: string; [[The signal's source string.]]
|
||||
@in func: Edje.Signal_Cb; [[The callback function being executed
|
||||
when the signal was emitted.]]
|
||||
}
|
||||
}
|
||||
signal_emit {
|
||||
[[Send a (Edje) signal to a given layout widget's underlying Edje
|
||||
object.
|
||||
|
||||
This function sends a signal to the underlying Edje object of
|
||||
$obj. An Edje program on that Edje object's definition can
|
||||
respond to a signal by specifying matching 'signal' and
|
||||
'source' fields.
|
||||
]]
|
||||
params {
|
||||
@in emission: string; [[The signal's name string.]]
|
||||
@in source: string; [[The signal's source string.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
class.constructor;
|
||||
|
@ -155,6 +93,11 @@ class Elm.Layout (Elm.Widget, Efl.Part, Efl.Container, Efl.File,
|
|||
Efl.Canvas.Group.group_calculate;
|
||||
Efl.Canvas.Layout_Calc.calc_freeze;
|
||||
Efl.Canvas.Layout_Calc.calc_thaw;
|
||||
Efl.Canvas.Layout_Signal.signal_callback_add;
|
||||
Efl.Canvas.Layout_Signal.signal_callback_del;
|
||||
Efl.Canvas.Layout_Signal.signal_emit;
|
||||
//Efl.Canvas.Layout_Signal.message_send;
|
||||
//Efl.Canvas.Layout_Signal.signal_process;
|
||||
Elm.Widget.focus_direction;
|
||||
Elm.Widget.sub_object_add;
|
||||
Elm.Widget.theme_apply;
|
||||
|
|
|
@ -40,6 +40,60 @@ typedef struct _Elm_Layout_Part_Alias_Description Elm_Layout_Part_Alias_Descript
|
|||
*/
|
||||
EAPI Evas_Object *elm_layout_add(Evas_Object *parent);
|
||||
|
||||
/**
|
||||
* @brief Add a callback for a (Edje) signal emitted by a layout widget's
|
||||
* underlying Edje object.
|
||||
*
|
||||
* This function connects a callback function to a signal emitted by the
|
||||
* underlying Edje object of @c obj. Globs are accepted in either the emission
|
||||
* or source strings.
|
||||
*
|
||||
* @param[in] emission The signal's name string.
|
||||
* @param[in] source The signal's source string.
|
||||
* @param[in] func The callback function to be executed when the signal is
|
||||
* emitted.
|
||||
* @param[in] data A pointer to data to pass in to the callback function.
|
||||
*
|
||||
* @ingroup Elm_Layout
|
||||
*/
|
||||
EAPI void elm_layout_signal_callback_add(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
|
||||
|
||||
/**
|
||||
* @brief Remove a signal-triggered callback from a given layout widget.
|
||||
*
|
||||
* This function removes the last callback attached to a signal emitted by the
|
||||
* undelying Edje object of @c obj, with parameters @c emission, @c source and
|
||||
* @c func matching exactly those passed to a previous call to
|
||||
* @ref elm_layout_signal_callback_add. The data pointer that was passed to
|
||||
* this call will be returned.
|
||||
*
|
||||
* @param[in] emission The signal's name string.
|
||||
* @param[in] source The signal's source string.
|
||||
* @param[in] func The callback function being executed when the signal was
|
||||
* emitted.
|
||||
*
|
||||
* @return The data pointer of the signal callback (passed on
|
||||
* @ref elm_layout_signal_callback_add) or @c null on errors.
|
||||
*
|
||||
* @ingroup Elm_Layout
|
||||
*/
|
||||
EAPI void *elm_layout_signal_callback_del(Elm_Layout *obj, const char *emission, const char *source, Edje_Signal_Cb func);
|
||||
|
||||
/**
|
||||
* @brief Send a (Edje) signal to a given layout widget's underlying Edje
|
||||
* object.
|
||||
*
|
||||
* This function sends a signal to the underlying Edje object of @c obj. An
|
||||
* Edje program on that Edje object's definition can respond to a signal by
|
||||
* specifying matching 'signal' and 'source' fields.
|
||||
*
|
||||
* @param[in] emission The signal's name string.
|
||||
* @param[in] source The signal's source string.
|
||||
*
|
||||
* @ingroup Elm_Layout
|
||||
*/
|
||||
EAPI void elm_layout_signal_emit(Elm_Layout *obj, const char *emission, const char *source);
|
||||
|
||||
/**
|
||||
* @brief Get the edje layout
|
||||
*
|
||||
|
|
|
@ -152,7 +152,7 @@ class Elm.Naviframe (Elm.Layout, Elm.Interface.Atspi_Widget_Action)
|
|||
Elm.Widget.translate;
|
||||
Elm.Widget.theme_apply;
|
||||
Elm.Widget.widget_event;
|
||||
Elm.Layout.signal_emit;
|
||||
Efl.Canvas.Layout_Signal.signal_emit;
|
||||
Elm.Layout.sizing_eval;
|
||||
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
|
||||
Efl.Part.part;
|
||||
|
|
|
@ -179,7 +179,7 @@ class Elm.Popup (Elm.Layout, Elm.Interface.Atspi_Widget_Action)
|
|||
Elm.Widget.sub_object_del;
|
||||
Elm.Widget.widget_event;
|
||||
Elm.Layout.sizing_eval;
|
||||
Elm.Layout.signal_emit;
|
||||
Efl.Canvas.Layout_Signal.signal_emit;
|
||||
Elm.Interface.Atspi_Widget_Action.elm_actions { get; }
|
||||
Elm.Interface.Atspi_Accessible.state_set { get; }
|
||||
Efl.Part.part;
|
||||
|
|
|
@ -610,6 +610,13 @@ void _elm_entry_entry_paste(Evas_Object *obj, const char *entry);
|
|||
|
||||
double _elm_atof(const char *s);
|
||||
|
||||
// elm_layout and elm_entry LEGACY signal API (returned the user data pointer)
|
||||
void _elm_layout_signal_callback_add_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func, void *data);
|
||||
void *_elm_layout_signal_callback_del_legacy(Eo *obj, Eo *edje, Eina_List **p_edje_signals, const char *emission, const char *source, Edje_Signal_Cb func);
|
||||
void _elm_entry_signal_callback_add_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data);
|
||||
void *_elm_entry_signal_callback_del_legacy(Eo *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb);
|
||||
|
||||
|
||||
/* Internal EO APIs */
|
||||
const Elm_Layout_Part_Alias_Description *elm_layout_content_aliases_get(const Eo *obj);
|
||||
const Elm_Layout_Part_Alias_Description *elm_layout_text_aliases_get(const Eo *obj);
|
||||
|
|
|
@ -69,6 +69,7 @@ struct _Elm_Entry_Data
|
|||
Elm_Input_Hints input_hints;
|
||||
Edje_Cursor sel_handler_cursor;
|
||||
void *input_panel_imdata;
|
||||
Eina_List *edje_signals;
|
||||
int input_panel_imdata_len;
|
||||
int input_panel_layout_variation;
|
||||
int validators;
|
||||
|
|
|
@ -21,6 +21,53 @@ START_TEST (elm_entry_del)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
_dummy_cb(void *data EINA_UNUSED, Eo *obj EINA_UNUSED,
|
||||
const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
START_TEST (elm_entry_signal_callback)
|
||||
{
|
||||
Evas_Object *win, *entry;
|
||||
void *data;
|
||||
int k;
|
||||
|
||||
elm_init(1, NULL);
|
||||
win = elm_win_add(NULL, "entry", ELM_WIN_BASIC);
|
||||
|
||||
entry = elm_entry_add(win);
|
||||
|
||||
for (k = 1; k < 10; k++)
|
||||
{
|
||||
int *val = malloc(sizeof(int));
|
||||
*val = 42 * k;
|
||||
elm_layout_signal_callback_add(entry, "sig", "src", _dummy_cb, val);
|
||||
}
|
||||
|
||||
data = elm_layout_signal_callback_del(entry, "notsig", "notsrc", _dummy_cb);
|
||||
fail_if(data);
|
||||
|
||||
// this test verifies that the legacy wrapper returns the proper data
|
||||
// the eo API requires the data as input to "del()"
|
||||
for (k = 1; k < 10; k++)
|
||||
{
|
||||
int *val;
|
||||
data = elm_layout_signal_callback_del(entry, "sig", "src", _dummy_cb);
|
||||
fail_if(!data);
|
||||
val = (int *)data;
|
||||
ck_assert_int_ne(*val, 0);
|
||||
ck_assert_int_eq((*val) % 42, 0);
|
||||
free(data);
|
||||
}
|
||||
|
||||
data = elm_layout_signal_callback_del(entry, "sig", "src", _dummy_cb);
|
||||
fail_if(data);
|
||||
|
||||
elm_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (elm_entry_atspi_text_char_get)
|
||||
{
|
||||
Evas_Object *win, *entry;
|
||||
|
@ -350,6 +397,7 @@ END_TEST
|
|||
void elm_test_entry(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, elm_entry_del);
|
||||
tcase_add_test(tc, elm_entry_signal_callback);
|
||||
tcase_add_test(tc, elm_entry_atspi_text_char_get);
|
||||
tcase_add_test(tc, elm_entry_atspi_text_char_count);
|
||||
tcase_add_test(tc, elm_entry_atspi_text_string_get_char);
|
||||
|
|
Loading…
Reference in New Issue