summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-15 09:09:04 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-15 09:09:04 -0400
commit81d8d8ee55808dabbc124642b09bc01372d60938 (patch)
tree86719084c9005bef87a5e0cfcc201ae0806d1d18 /src
parentd8cb3e7f71b485abeee9aec6695c2a9a765b8c76 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/elementary/efl_ui_frame.c30
-rw-r--r--src/tests/elementary/spec/efl_test_clickable.c8
2 files changed, 30 insertions, 8 deletions
diff --git a/src/lib/elementary/efl_ui_frame.c b/src/lib/elementary/efl_ui_frame.c
index b730a64db9..fd9420d6b7 100644
--- a/src/lib/elementary/efl_ui_frame.c
+++ b/src/lib/elementary/efl_ui_frame.c
@@ -5,6 +5,7 @@
5#define EFL_ACCESS_OBJECT_PROTECTED 5#define EFL_ACCESS_OBJECT_PROTECTED
6#define ELM_LAYOUT_PROTECTED 6#define ELM_LAYOUT_PROTECTED
7#define EFL_PART_PROTECTED 7#define EFL_PART_PROTECTED
8#define EFL_UI_CLICKABLE_PROTECTED
8 9
9#include <Elementary.h> 10#include <Elementary.h>
10#include "elm_priv.h" 11#include "elm_priv.h"
@@ -87,10 +88,7 @@ _on_frame_clicked(void *data,
87 sd->anim = EINA_TRUE; 88 sd->anim = EINA_TRUE;
88 elm_widget_tree_unfocusable_set(data, sd->collapsed); 89 elm_widget_tree_unfocusable_set(data, sd->collapsed);
89 } 90 }
90 if (elm_widget_is_legacy(data)) 91 evas_object_smart_callback_call(data, "clicked", NULL);
91 evas_object_smart_callback_call(data, "clicked", NULL);
92 else
93 efl_event_callback_call(data, EFL_UI_EVENT_CLICKED, NULL);
94} 92}
95 93
96/* using deferred sizing evaluation, just like the parent */ 94/* 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)
107 } 105 }
108} 106}
109 107
108static void
109_clicked_cb(void *data, const Efl_Event *ev EINA_UNUSED)
110{
111 EFL_UI_FRAME_DATA_GET(data, sd);
112 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
113
114 if (sd->anim) return;
115
116 if (sd->collapsible)
117 {
118 efl_event_callback_add(wd->resize_obj, EFL_LAYOUT_EVENT_RECALC, _recalc, data);
119 elm_layout_signal_emit(data, "efl,action,toggle", "efl");
120
121 sd->collapsed++;
122 sd->anim = EINA_TRUE;
123 elm_widget_tree_unfocusable_set(data, sd->collapsed);
124 }
125}
126
110EOLIAN static void 127EOLIAN static void
111_efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UNUSED) 128_efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UNUSED)
112{ 129{
@@ -130,9 +147,8 @@ _efl_ui_frame_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Frame_Data *_pd EINA_UN
130 edje_object_signal_callback_add 147 edje_object_signal_callback_add
131 (wd->resize_obj, "efl,anim,done", "efl", 148 (wd->resize_obj, "efl,anim,done", "efl",
132 _on_recalc_done, obj); 149 _on_recalc_done, obj);
133 edje_object_signal_callback_add 150 efl_ui_clickable_util_bind_to_theme(wd->resize_obj, obj);
134 (wd->resize_obj, "efl,action,click", "efl", 151 efl_event_callback_add(obj, EFL_UI_EVENT_CLICKED, _clicked_cb, obj);
135 _on_frame_clicked, obj);
136 } 152 }
137 153
138 elm_widget_can_focus_set(obj, EINA_FALSE); 154 elm_widget_can_focus_set(obj, EINA_FALSE);
diff --git a/src/tests/elementary/spec/efl_test_clickable.c b/src/tests/elementary/spec/efl_test_clickable.c
index a184053847..c1b63d38b7 100644
--- a/src/tests/elementary/spec/efl_test_clickable.c
+++ b/src/tests/elementary/spec/efl_test_clickable.c
@@ -8,7 +8,7 @@
8 8
9/* spec-meta-start 9/* spec-meta-start
10 {"test-interface":"Efl.Ui.Clickable", 10 {"test-interface":"Efl.Ui.Clickable",
11 "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes"] 11 "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Image", "Efl.Ui.Panes", "Efl.Ui.Frame"]
12 } 12 }
13 spec-meta-end 13 spec-meta-end
14 */ 14 */
@@ -52,6 +52,12 @@ prepare_window(void)
52 pos->x = 100; 52 pos->x = 100;
53 pos->y = 100; 53 pos->y = 100;
54 } 54 }
55 else if (efl_isa(widget, EFL_UI_FRAME_CLASS))
56 {
57 efl_text_set(widget, "Test, here has to be text in order to make the frame y > 0");
58 pos->x = 30;
59 pos->y = 10;
60 }
55 61
56 evas_smart_objects_calculate(evas_object_evas_get(win)); 62 evas_smart_objects_calculate(evas_object_evas_get(win));
57 evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_RENDER_POST, prepare_window_norendered, pos); 63 evas_event_callback_add(evas_object_evas_get(win), EVAS_CALLBACK_RENDER_POST, prepare_window_norendered, pos);