forked from enlightenment/efl
efl_ui_frame: migrate to efl.ui.clickable
Summary: frame now uses efl.ui.clickable, which ensures correct click emittion. The click event is not needed in the event anymore. However, now efl,action,press / efl,action,unpress is needed. Depends on D8825 Reviewers: zmike, segfaultxavi, cedric Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8826
This commit is contained in:
parent
d8cb3e7f71
commit
81d8d8ee55
|
@ -131,9 +131,14 @@ group { name: "efl/frame";
|
|||
transition: DECELERATE 0.3;
|
||||
after: "signal";
|
||||
}
|
||||
program {
|
||||
signal: "mouse,up,1"; source: "event";
|
||||
action: SIGNAL_EMIT "efl,action,click" "efl";
|
||||
program {signal: "mouse,down,1"; source: "event"; // for "press" smart callback
|
||||
action: SIGNAL_EMIT "efl,action,press" "efl";
|
||||
}
|
||||
program { signal: "mouse,up,1"; source: "event"; // for "unpress" smart callback
|
||||
action: SIGNAL_EMIT "efl,action,unpress" "efl";
|
||||
}
|
||||
program { signal: "mouse,pressed,out"; source: "event";
|
||||
action: SIGNAL_EMIT "efl,action,mouse_out" "efl";
|
||||
}
|
||||
program {
|
||||
signal: "efl,action,toggle"; source: "efl";
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define EFL_ACCESS_OBJECT_PROTECTED
|
||||
#define ELM_LAYOUT_PROTECTED
|
||||
#define EFL_PART_PROTECTED
|
||||
#define EFL_UI_CLICKABLE_PROTECTED
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
@ -87,10 +88,7 @@ _on_frame_clicked(void *data,
|
|||
sd->anim = EINA_TRUE;
|
||||
elm_widget_tree_unfocusable_set(data, sd->collapsed);
|
||||
}
|
||||
if (elm_widget_is_legacy(data))
|
||||
evas_object_smart_callback_call(data, "clicked", NULL);
|
||||
else
|
||||
efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL);
|
||||
evas_object_smart_callback_call(data, "clicked", NULL);
|
||||
}
|
||||
|
||||
/* using deferred sizing evaluation, just like the parent */
|
||||
|
@ -107,6 +105,25 @@ _efl_ui_frame_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Frame_Data *sd)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_clicked_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||
{
|
||||
EFL_UI_FRAME_DATA_GET(data, sd);
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
|
||||
|
||||
if (sd->anim) return;
|
||||
|
||||
if (sd->collapsible)
|
||||
{
|
||||
efl_event_callback_add(wd->resize_obj, EFL_LAYOUT_EVENT_RECALC, _recalc, data);
|
||||
elm_layout_signal_emit(data, "efl,action,toggle", "efl");
|
||||
|
||||
sd->collapsed++;
|
||||
sd->anim = EINA_TRUE;
|
||||
elm_widget_tree_unfocusable_set(data, sd->collapsed);
|
||||
}
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UNUSED)
|
||||
{
|
||||
|
@ -130,9 +147,8 @@ _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UN
|
|||
edje_object_signal_callback_add
|
||||
(wd->resize_obj, "efl,anim,done", "efl",
|
||||
_on_recalc_done, obj);
|
||||
edje_object_signal_callback_add
|
||||
(wd->resize_obj, "efl,action,click", "efl",
|
||||
_on_frame_clicked, obj);
|
||||
efl_ui_clickable_util_bind_to_theme(wd->resize_obj, obj);
|
||||
efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _clicked_cb, obj);
|
||||
}
|
||||
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
/* spec-meta-start
|
||||
{"test-interface":"Efl.Ui.Clickable",
|
||||
"test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes"]
|
||||
"test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame"]
|
||||
}
|
||||
spec-meta-end
|
||||
*/
|
||||
|
@ -52,6 +52,12 @@ prepare_window(void)
|
|||
pos->x = 100;
|
||||
pos->y = 100;
|
||||
}
|
||||
else if (efl_isa(widget, EFL_UI_FRAME_CLASS))
|
||||
{
|
||||
efl_text_set(widget, "Test, here has to be text in order to make the frame y > 0");
|
||||
pos->x = 30;
|
||||
pos->y = 10;
|
||||
}
|
||||
|
||||
evas_smart_objects_calculate(evas_object_evas_get(win));
|
||||
evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_RENDER_POST, prepare_window_norendered, pos);
|
||||
|
|
Loading…
Reference in New Issue