summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-17 14:00:19 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-18 18:04:59 +0200
commit011022ae1bba69334c42a70ae620f9acc9ff792a (patch)
tree882c8c45c6648ec1e526428e28a27c988ce3e4be
parent3139371932303b2b21439d3abb51b3293c7ee02d (diff)
efl/radio/box: handle non-radio-objects
this improves the usefulness of radio box by presenting it as a box widget which has the additional feature of being able to manage radio widgets also fix all the image cases in elm_test which relied on there being only a single box in the window Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9998
-rw-r--r--src/bin/elementary/test_ui_image.c5
-rw-r--r--src/lib/elementary/efl_ui_radio_box.c17
-rw-r--r--src/lib/elementary/efl_ui_radio_box.eo2
3 files changed, 11 insertions, 13 deletions
diff --git a/src/bin/elementary/test_ui_image.c b/src/bin/elementary/test_ui_image.c
index c93fd4ce7e..5e7e25400a 100644
--- a/src/bin/elementary/test_ui_image.c
+++ b/src/bin/elementary/test_ui_image.c
@@ -73,7 +73,7 @@ test_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EIN
73 efl_key_data_set(win, "rdg", box); 73 efl_key_data_set(win, "rdg", box);
74 74
75 im = img_add(win, "/images/logo.png"); 75 im = img_add(win, "/images/logo.png");
76 efl_content_set(win, im); 76 efl_pack(box, im);
77 77
78 for (i = 0; images_orient[i].name; ++i) 78 for (i = 0; images_orient[i].name; ++i)
79 { 79 {
@@ -152,7 +152,7 @@ test_ui_image_scale_type(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *eve
152 elm_image_file_set(im, buf, NULL); 152 elm_image_file_set(im, buf, NULL);
153 efl_gfx_hint_weight_set(im, 1.0, 1.0); 153 efl_gfx_hint_weight_set(im, 1.0, 1.0);
154 efl_gfx_hint_fill_set(im, EINA_TRUE, EINA_TRUE); 154 efl_gfx_hint_fill_set(im, EINA_TRUE, EINA_TRUE);
155 efl_content_set(win, im); 155 efl_pack(box, im);
156 156
157 efl_key_data_set(win, "im", im); 157 efl_key_data_set(win, "im", im);
158 158
@@ -320,7 +320,6 @@ test_remote_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_i
320 320
321 box2 = efl_add(EFL_UI_RADIO_BOX_CLASS, win); 321 box2 = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
322 efl_gfx_hint_weight_set(box2, 1.0, 1.0); 322 efl_gfx_hint_weight_set(box2, 1.0, 1.0);
323 efl_content_set(win, box2);
324 efl_key_data_set(win, "rdg", box2); 323 efl_key_data_set(win, "rdg", box2);
325 efl_pack(box, box2); 324 efl_pack(box, box2);
326 325
diff --git a/src/lib/elementary/efl_ui_radio_box.c b/src/lib/elementary/efl_ui_radio_box.c
index 92918ea7eb..1e18f0f5fc 100644
--- a/src/lib/elementary/efl_ui_radio_box.c
+++ b/src/lib/elementary/efl_ui_radio_box.c
@@ -2,7 +2,6 @@
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4 4
5#include <Elementary.h>
6#include "elm_priv.h" 5#include "elm_priv.h"
7 6
8#define MY_CLASS EFL_UI_RADIO_BOX_CLASS 7#define MY_CLASS EFL_UI_RADIO_BOX_CLASS
@@ -13,10 +12,10 @@ typedef struct {
13} Efl_Ui_Radio_Box_Data; 12} Efl_Ui_Radio_Box_Data;
14 13
15static inline Eina_Bool 14static inline Eina_Bool
16register_safe_in_group_begin(Eo *subobj, Efl_Ui_Radio_Box_Data *pd) 15register_safe_in_group_begin(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool is_radio)
17{ 16{
18 EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(subobj, EFL_UI_RADIO_CLASS), EINA_FALSE); 17 if (pd->in_pack) return EINA_TRUE;
19 if (!pd->in_pack) 18 if (is_radio)
20 efl_ui_radio_group_register(pd->group, subobj); 19 efl_ui_radio_group_register(pd->group, subobj);
21 pd->in_pack = EINA_TRUE; 20 pd->in_pack = EINA_TRUE;
22 21
@@ -24,9 +23,9 @@ register_safe_in_group_begin(Eo *subobj, Efl_Ui_Radio_Box_Data *pd)
24} 23}
25 24
26static inline Eina_Bool 25static inline Eina_Bool
27register_safe_group_end(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool result) 26register_safe_group_end(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool is_radio, Eina_Bool result)
28{ 27{
29 if (!result) 28 if (is_radio && (!result))
30 efl_ui_radio_group_unregister(pd->group, subobj); 29 efl_ui_radio_group_unregister(pd->group, subobj);
31 pd->in_pack = EINA_FALSE; 30 pd->in_pack = EINA_FALSE;
32 31
@@ -34,11 +33,11 @@ register_safe_group_end(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool result)
34} 33}
35 34
36#define REGISTER_SAFE(f) \ 35#define REGISTER_SAFE(f) \
37 Eina_Bool result; \ 36 Eina_Bool result, is_radio = efl_isa(subobj, EFL_UI_RADIO_CLASS); \
38 if (!register_safe_in_group_begin(subobj, pd)) \ 37 if (!register_safe_in_group_begin(subobj, pd, is_radio)) \
39 return EINA_FALSE; \ 38 return EINA_FALSE; \
40 result = f ; \ 39 result = f ; \
41 return register_safe_group_end(subobj, pd, result); 40 return register_safe_group_end(subobj, pd, is_radio, result);
42 41
43static void 42static void
44unpack_from_logical(Eo *obj, Efl_Ui_Radio_Box_Data *pd) 43unpack_from_logical(Eo *obj, Efl_Ui_Radio_Box_Data *pd)
diff --git a/src/lib/elementary/efl_ui_radio_box.eo b/src/lib/elementary/efl_ui_radio_box.eo
index 54bd92e3df..15f6b3ee13 100644
--- a/src/lib/elementary/efl_ui_radio_box.eo
+++ b/src/lib/elementary/efl_ui_radio_box.eo
@@ -2,7 +2,7 @@ class @beta Efl.Ui.Radio_Box extends Efl.Ui.Box implements Efl.Ui.Radio_Group
2 composite Efl.Ui.Radio_Group 2 composite Efl.Ui.Radio_Group
3{ 3{
4 [[A standard @Efl.Ui.Box container which automatically handles grouping of any @Efl.Ui.Radio 4 [[A standard @Efl.Ui.Box container which automatically handles grouping of any @Efl.Ui.Radio
5 widget added to it. 5 widget added to it in addition to regular widgets.
6 6
7 All @Efl.Ui.Radio widgets are added to the same internal group which you only indirectly 7 All @Efl.Ui.Radio widgets are added to the same internal group which you only indirectly
8 access through this object. 8 access through this object.