forked from enlightenment/efl
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
This commit is contained in:
parent
3139371932
commit
011022ae1b
|
@ -73,7 +73,7 @@ test_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EIN
|
||||||
efl_key_data_set(win, "rdg", box);
|
efl_key_data_set(win, "rdg", box);
|
||||||
|
|
||||||
im = img_add(win, "/images/logo.png");
|
im = img_add(win, "/images/logo.png");
|
||||||
efl_content_set(win, im);
|
efl_pack(box, im);
|
||||||
|
|
||||||
for (i = 0; images_orient[i].name; ++i)
|
for (i = 0; images_orient[i].name; ++i)
|
||||||
{
|
{
|
||||||
|
@ -152,7 +152,7 @@ test_ui_image_scale_type(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *eve
|
||||||
elm_image_file_set(im, buf, NULL);
|
elm_image_file_set(im, buf, NULL);
|
||||||
efl_gfx_hint_weight_set(im, 1.0, 1.0);
|
efl_gfx_hint_weight_set(im, 1.0, 1.0);
|
||||||
efl_gfx_hint_fill_set(im, EINA_TRUE, EINA_TRUE);
|
efl_gfx_hint_fill_set(im, EINA_TRUE, EINA_TRUE);
|
||||||
efl_content_set(win, im);
|
efl_pack(box, im);
|
||||||
|
|
||||||
efl_key_data_set(win, "im", im);
|
efl_key_data_set(win, "im", im);
|
||||||
|
|
||||||
|
@ -320,7 +320,6 @@ test_remote_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_i
|
||||||
|
|
||||||
box2 = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
|
box2 = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
|
||||||
efl_gfx_hint_weight_set(box2, 1.0, 1.0);
|
efl_gfx_hint_weight_set(box2, 1.0, 1.0);
|
||||||
efl_content_set(win, box2);
|
|
||||||
efl_key_data_set(win, "rdg", box2);
|
efl_key_data_set(win, "rdg", box2);
|
||||||
efl_pack(box, box2);
|
efl_pack(box, box2);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
# include "elementary_config.h"
|
# include "elementary_config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <Elementary.h>
|
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
|
|
||||||
#define MY_CLASS EFL_UI_RADIO_BOX_CLASS
|
#define MY_CLASS EFL_UI_RADIO_BOX_CLASS
|
||||||
|
@ -13,10 +12,10 @@ typedef struct {
|
||||||
} Efl_Ui_Radio_Box_Data;
|
} Efl_Ui_Radio_Box_Data;
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
register_safe_in_group_begin(Eo *subobj, Efl_Ui_Radio_Box_Data *pd)
|
register_safe_in_group_begin(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool is_radio)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(subobj, EFL_UI_RADIO_CLASS), EINA_FALSE);
|
if (pd->in_pack) return EINA_TRUE;
|
||||||
if (!pd->in_pack)
|
if (is_radio)
|
||||||
efl_ui_radio_group_register(pd->group, subobj);
|
efl_ui_radio_group_register(pd->group, subobj);
|
||||||
pd->in_pack = EINA_TRUE;
|
pd->in_pack = EINA_TRUE;
|
||||||
|
|
||||||
|
@ -24,9 +23,9 @@ register_safe_in_group_begin(Eo *subobj, Efl_Ui_Radio_Box_Data *pd)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Eina_Bool
|
static inline Eina_Bool
|
||||||
register_safe_group_end(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool result)
|
register_safe_group_end(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool is_radio, Eina_Bool result)
|
||||||
{
|
{
|
||||||
if (!result)
|
if (is_radio && (!result))
|
||||||
efl_ui_radio_group_unregister(pd->group, subobj);
|
efl_ui_radio_group_unregister(pd->group, subobj);
|
||||||
pd->in_pack = EINA_FALSE;
|
pd->in_pack = EINA_FALSE;
|
||||||
|
|
||||||
|
@ -34,11 +33,11 @@ register_safe_group_end(Eo *subobj, Efl_Ui_Radio_Box_Data *pd, Eina_Bool result)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REGISTER_SAFE(f) \
|
#define REGISTER_SAFE(f) \
|
||||||
Eina_Bool result; \
|
Eina_Bool result, is_radio = efl_isa(subobj, EFL_UI_RADIO_CLASS); \
|
||||||
if (!register_safe_in_group_begin(subobj, pd)) \
|
if (!register_safe_in_group_begin(subobj, pd, is_radio)) \
|
||||||
return EINA_FALSE; \
|
return EINA_FALSE; \
|
||||||
result = f ; \
|
result = f ; \
|
||||||
return register_safe_group_end(subobj, pd, result);
|
return register_safe_group_end(subobj, pd, is_radio, result);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
unpack_from_logical(Eo *obj, Efl_Ui_Radio_Box_Data *pd)
|
unpack_from_logical(Eo *obj, Efl_Ui_Radio_Box_Data *pd)
|
||||||
|
|
|
@ -2,7 +2,7 @@ class @beta Efl.Ui.Radio_Box extends Efl.Ui.Box implements Efl.Ui.Radio_Group
|
||||||
composite Efl.Ui.Radio_Group
|
composite Efl.Ui.Radio_Group
|
||||||
{
|
{
|
||||||
[[A standard @Efl.Ui.Box container which automatically handles grouping of any @Efl.Ui.Radio
|
[[A standard @Efl.Ui.Box container which automatically handles grouping of any @Efl.Ui.Radio
|
||||||
widget added to it.
|
widget added to it in addition to regular widgets.
|
||||||
|
|
||||||
All @Efl.Ui.Radio widgets are added to the same internal group which you only indirectly
|
All @Efl.Ui.Radio widgets are added to the same internal group which you only indirectly
|
||||||
access through this object.
|
access through this object.
|
||||||
|
|
Loading…
Reference in New Issue