summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-10 17:56:34 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 17:15:42 +0900
commitc752d8fe6beec321f66f566bf05731540f8d889e (patch)
treefc0c9f70b590feb5c9e64b6c79b6afebb733d208
parent91df6723c929dc91ccf040ba5021c1142d1a6a17 (diff)
efl_ui_popup: Make backwall efl part object of Efl.Ui.Popup
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/bin/elementary/test_ui_popup.c12
-rw-r--r--src/lib/elementary/efl_ui_popup.c107
-rw-r--r--src/lib/elementary/efl_ui_popup.eo25
-rw-r--r--src/lib/elementary/efl_ui_popup_part.eo11
-rw-r--r--src/lib/elementary/efl_ui_popup_private.h1
6 files changed, 106 insertions, 51 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 2143085b6c..9fdc6b5120 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -34,6 +34,7 @@ elm_public_eolian_files = \
34 lib/elementary/efl_ui_text_interactive.eo \ 34 lib/elementary/efl_ui_text_interactive.eo \
35 lib/elementary/efl_ui_text.eo \ 35 lib/elementary/efl_ui_text.eo \
36 lib/elementary/efl_ui_popup.eo \ 36 lib/elementary/efl_ui_popup.eo \
37 lib/elementary/efl_ui_popup_part.eo \
37 lib/elementary/efl_ui_popup_alert.eo \ 38 lib/elementary/efl_ui_popup_alert.eo \
38 lib/elementary/efl_ui_popup_alert_part.eo \ 39 lib/elementary/efl_ui_popup_alert_part.eo \
39 lib/elementary/efl_ui_popup_alert_scroll.eo \ 40 lib/elementary/efl_ui_popup_alert_scroll.eo \
diff --git a/src/bin/elementary/test_ui_popup.c b/src/bin/elementary/test_ui_popup.c
index b39113f23d..770ff93f7c 100644
--- a/src/bin/elementary/test_ui_popup.c
+++ b/src/bin/elementary/test_ui_popup.c
@@ -84,12 +84,12 @@ _backwall_cb(void *data EINA_UNUSED, const Efl_Event *ev)
84 { 84 {
85 char buf[PATH_MAX]; 85 char buf[PATH_MAX];
86 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get()); 86 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
87 efl_ui_popup_backwall_set(p_data->efl_ui_popup, buf, NULL); 87 efl_file_set(efl_part(p_data->efl_ui_popup, "backwall"), buf, NULL);
88 efl_text_set(ev->object, "Backwall UnSet"); 88 efl_text_set(ev->object, "Backwall UnSet");
89 } 89 }
90 else 90 else
91 { 91 {
92 efl_ui_popup_backwall_set(p_data->efl_ui_popup, NULL, NULL); 92 efl_file_set(efl_part(p_data->efl_ui_popup, "backwall"), NULL, NULL);
93 efl_text_set(ev->object, "Backwall Set"); 93 efl_text_set(ev->object, "Backwall Set");
94 } 94 }
95 k = !k; 95 k = !k;
@@ -100,14 +100,14 @@ _repeat_event_cb(void *data EINA_UNUSED, const Efl_Event *ev)
100{ 100{
101 efl_ui_popup_data *p_data = data; 101 efl_ui_popup_data *p_data = data;
102 if (!p_data->efl_ui_popup) return; 102 if (!p_data->efl_ui_popup) return;
103 if (!efl_ui_popup_backwall_repeat_events_get(p_data->efl_ui_popup)) 103 if (!efl_canvas_object_repeat_events_get(efl_part(p_data->efl_ui_popup, "backwall")))
104 { 104 {
105 efl_ui_popup_backwall_repeat_events_set(p_data->efl_ui_popup, EINA_TRUE); 105 efl_canvas_object_repeat_events_set(efl_part(p_data->efl_ui_popup, "backwall"), EINA_TRUE);
106 efl_text_set(ev->object, "Repeat Event UnSet"); 106 efl_text_set(ev->object, "Repeat Event UnSet");
107 } 107 }
108 else 108 else
109 { 109 {
110 efl_ui_popup_backwall_repeat_events_set(p_data->efl_ui_popup, EINA_FALSE); 110 efl_canvas_object_repeat_events_set(efl_part(p_data->efl_ui_popup, "backwall"), EINA_FALSE);
111 efl_text_set(ev->object, "Repeat Event Set"); 111 efl_text_set(ev->object, "Repeat Event Set");
112 } 112 }
113} 113}
@@ -453,7 +453,7 @@ test_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
453 453
454 Eo *efl_ui_popup = efl_add(EFL_UI_POPUP_ANCHOR_CLASS, win); 454 Eo *efl_ui_popup = efl_add(EFL_UI_POPUP_ANCHOR_CLASS, win);
455 455
456 efl_ui_popup_backwall_repeat_events_set(efl_ui_popup, EINA_TRUE); 456 efl_canvas_object_repeat_events_set(efl_part(efl_ui_popup, "backwall"), EINA_TRUE);
457 457
458 //Default align priority order is top, left, right, bottom, center. 458 //Default align priority order is top, left, right, bottom, center.
459 efl_ui_popup_anchor_align_priority_set(efl_ui_popup, EFL_UI_POPUP_ALIGN_TOP, 459 efl_ui_popup_anchor_align_priority_set(efl_ui_popup, EFL_UI_POPUP_ALIGN_TOP,
diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c
index 92eed8df8b..114daa09c6 100644
--- a/src/lib/elementary/efl_ui_popup.c
+++ b/src/lib/elementary/efl_ui_popup.c
@@ -8,6 +8,8 @@
8 8
9#include "elm_priv.h" 9#include "elm_priv.h"
10#include "efl_ui_popup_private.h" 10#include "efl_ui_popup_private.h"
11#include "efl_ui_popup_part.eo.h"
12#include "elm_part_helper.h"
11 13
12#define MY_CLASS EFL_UI_POPUP_CLASS 14#define MY_CLASS EFL_UI_POPUP_CLASS
13#define MY_CLASS_NAME "Efl.Ui.Popup" 15#define MY_CLASS_NAME "Efl.Ui.Popup"
@@ -249,42 +251,101 @@ _efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED)
249 _calc_align(obj); 251 _calc_align(obj);
250} 252}
251 253
252EOLIAN static void 254static Eina_Bool
253_efl_ui_popup_backwall_set(Eo *obj, Efl_Ui_Popup_Data *pd, const char* file, const char* group) 255_efl_ui_popup_content_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, const char *part, Eo *content)
254{ 256{
255 Eo *prev_obj = edje_object_part_swallow_get(pd->backwall, "elm.swallow.image"); 257 return efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
256 if (prev_obj) 258}
257 {
258 edje_object_part_unswallow(pd->backwall, prev_obj);
259 efl_del(prev_obj);
260 }
261 259
262 Eo *image = elm_image_add(obj); 260Eo *
263 Eina_Bool ret = elm_image_file_set(image, file, group); 261_efl_ui_popup_content_get(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, const char *part)
264 if (!ret) 262{
265 { 263 return efl_content_get(efl_part(efl_super(obj, MY_CLASS), part));
266 edje_object_signal_emit(pd->backwall, "elm,state,image,hidden", "elm"); 264}
267 efl_del(image); 265
268 return; 266static Eo *
269 } 267_efl_ui_popup_content_unset(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, const char *part)
270 edje_object_part_swallow(pd->backwall, "elm.swallow.image", image); 268{
271 edje_object_signal_emit(pd->backwall, "elm,state,image,visible", "elm"); 269 return efl_content_unset(efl_part(efl_super(obj, MY_CLASS), part));
270}
271
272/* Efl.Part begin */
273
274ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_popup, EFL_UI_POPUP, Efl_Ui_Popup_Data)
275ELM_PART_OVERRIDE_CONTENT_GET(efl_ui_popup, EFL_UI_POPUP, Efl_Ui_Popup_Data)
276ELM_PART_OVERRIDE_CONTENT_UNSET(efl_ui_popup, EFL_UI_POPUP, Efl_Ui_Popup_Data)
277
278EOLIAN static Eo *
279_efl_ui_popup_efl_part_part(const Eo *obj, Efl_Ui_Popup_Data *_pd EINA_UNUSED, const char *part)
280{
281 EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
282
283 if (eina_streq(part, "backwall"))
284 return ELM_PART_IMPLEMENT(EFL_UI_POPUP_PART_CLASS, obj, part);
285
286 return efl_part(efl_super(obj, MY_CLASS), part);
272} 287}
273 288
274EOLIAN static void 289EOLIAN static void
275_efl_ui_popup_backwall_repeat_events_set(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd, Eina_Bool repeat) 290_efl_ui_popup_part_efl_canvas_object_repeat_events_set(Eo *obj, void *_pd EINA_UNUSED, Eina_Bool repeat)
291{
292 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
293 Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
294
295 if (eina_streq(pd->part, "backwall"))
296 efl_canvas_object_repeat_events_set(sd->backwall, repeat);
297 else
298 efl_canvas_object_repeat_events_set(efl_part(efl_super(pd->obj, MY_CLASS), pd->part), repeat);
299}
300
301EOLIAN static Eina_Bool
302_efl_ui_popup_part_efl_canvas_object_repeat_events_get(Eo *obj, void *_pd EINA_UNUSED)
276{ 303{
277 pd->backwall_repeat_events = repeat; 304 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
305 Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
306
307 if (eina_streq(pd->part, "backwall"))
308 return efl_canvas_object_repeat_events_get(sd->backwall);
278 309
279 efl_canvas_object_repeat_events_set(pd->backwall, repeat); 310 return efl_canvas_object_repeat_events_get(efl_part(efl_super(pd->obj, MY_CLASS), pd->part));
280} 311}
281 312
282EOLIAN static Eina_Bool 313EOLIAN static Eina_Bool
283_efl_ui_popup_backwall_repeat_events_get(Eo *obj EINA_UNUSED, Efl_Ui_Popup_Data *pd) 314_efl_ui_popup_part_efl_file_file_set(Eo *obj, void *_pd EINA_UNUSED, const char *file, const char *group)
284{ 315{
285 return pd->backwall_repeat_events; 316 Elm_Part_Data *pd = efl_data_scope_get(obj, EFL_UI_WIDGET_PART_CLASS);
317 Efl_Ui_Popup_Data *sd = efl_data_scope_get(pd->obj, EFL_UI_POPUP_CLASS);
318
319 if (eina_streq(pd->part, "backwall"))
320 {
321 Eo *prev_obj = edje_object_part_swallow_get(sd->backwall, "elm.swallow.image");
322 if (prev_obj)
323 {
324 edje_object_part_unswallow(sd->backwall, prev_obj);
325 efl_del(prev_obj);
326 }
327
328 Eo *image = elm_image_add(pd->obj);
329 Eina_Bool ret = elm_image_file_set(image, file, group);
330 if (!ret)
331 {
332 edje_object_signal_emit(sd->backwall, "elm,state,image,hidden", "elm");
333 efl_del(image);
334 return EINA_FALSE;
335 }
336 edje_object_part_swallow(sd->backwall, "elm.swallow.image", image);
337 edje_object_signal_emit(sd->backwall, "elm,state,image,visible", "elm");
338
339 return EINA_TRUE;
340 }
341
342 return efl_file_set(efl_part(efl_super(pd->obj, MY_CLASS), pd->part), file, group);
286} 343}
287 344
345#include "efl_ui_popup_part.eo.c"
346
347/* Efl.Part end */
348
288/* Internal EO APIs and hidden overrides */ 349/* Internal EO APIs and hidden overrides */
289 350
290#define EFL_UI_POPUP_EXTRA_OPS \ 351#define EFL_UI_POPUP_EXTRA_OPS \
diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo
index 09871c407f..48407fff7e 100644
--- a/src/lib/elementary/efl_ui_popup.eo
+++ b/src/lib/elementary/efl_ui_popup.eo
@@ -10,27 +10,6 @@ enum Efl.Ui.Popup.Align {
10class Efl.Ui.Popup(Efl.Ui.Layout) 10class Efl.Ui.Popup(Efl.Ui.Layout)
11{ 11{
12 methods { 12 methods {
13 backwall_set {
14 params {
15 @in file: string; [[The image file path.]]
16 @in group: string; [[The image key in $file (if its an Eet one), or
17 $null, otherwise.]]
18 }
19 }
20 @property backwall_repeat_events {
21 set {
22 [[Sets whether events should be passed to by a click outside.
23
24 Note: The default value is $false.
25 ]]
26 }
27 get {
28 [[Returns value indicating whether backwall repeat events is enabled or not.]]
29 }
30 values {
31 repeat: bool; [[If $true, events are passed to lower objects.]]
32 }
33 }
34 @property align { 13 @property align {
35 set { 14 set {
36 [[ Set the popup alignment.]] 15 [[ Set the popup alignment.]]
@@ -56,6 +35,9 @@ class Efl.Ui.Popup(Efl.Ui.Layout)
56 } 35 }
57 } 36 }
58 } 37 }
38 parts {
39 backwall: Efl.Ui.Popup.Part; [[A backwall behind the popup.]]
40 }
59 implements { 41 implements {
60 Efl.Object.constructor; 42 Efl.Object.constructor;
61 Efl.Object.destructor; 43 Efl.Object.destructor;
@@ -64,6 +46,7 @@ class Efl.Ui.Popup(Efl.Ui.Layout)
64 Elm.Widget.widget_parent { set; } 46 Elm.Widget.widget_parent { set; }
65 Efl.Container.content { get; set; } 47 Efl.Container.content { get; set; }
66 Efl.Container.content_unset; 48 Efl.Container.content_unset;
49 Efl.Part.part;
67 } 50 }
68 events { 51 events {
69 backwall,clicked; [[This is called whenever the user clicks back wall of popup.]] 52 backwall,clicked; [[This is called whenever the user clicks back wall of popup.]]
diff --git a/src/lib/elementary/efl_ui_popup_part.eo b/src/lib/elementary/efl_ui_popup_part.eo
new file mode 100644
index 0000000000..8df70e0c50
--- /dev/null
+++ b/src/lib/elementary/efl_ui_popup_part.eo
@@ -0,0 +1,11 @@
1class Efl.Ui.Popup.Part (Efl.Ui.Layout.Part_Content, Efl.Canvas.Object, Efl.File)
2{
3 [[Efl UI Popup internal part class]]
4 data: null;
5 implements {
6 Efl.Container.content { get; set; }
7 Efl.Container.content_unset;
8 Efl.Canvas.Object.repeat_events { set; get; }
9 Efl.File.file { set; }
10 }
11}
diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h
index 6a1f48b44d..a62a654046 100644
--- a/src/lib/elementary/efl_ui_popup_private.h
+++ b/src/lib/elementary/efl_ui_popup_private.h
@@ -9,7 +9,6 @@ struct _Efl_Ui_Popup_Data
9 Efl_Ui_Popup_Align align; 9 Efl_Ui_Popup_Align align;
10 Ecore_Timer *timer; 10 Ecore_Timer *timer;
11 double timeout; 11 double timeout;
12 Eina_Bool backwall_repeat_events : 1;
13}; 12};
14 13
15#endif 14#endif