summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-29 20:06:25 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-20 16:02:02 +0200
commit89102ecbd3bb99c996d7b34fbbb55900686200bc (patch)
tree9dfb0db1da14ca205c2772372ad23a6d922c6023
parent8cc340e8b2016bab13872e19abcde6a0b438b4db (diff)
downloadefl-89102ecbd3bb99c996d7b34fbbb55900686200bc.tar.gz
efl_ui_radio: cleanup API
This is a bit of a giant commit. However, the problem here is that cleaning up the API went hand in hand with rewriting most of the usages. In the process of renewing and removing old API the following was done: - Legacy API testcases have been ported back to smart callbacks - EO-API testcases have been ported to efl_add syntax - weird event #defines have been removed - Wrong constructor usage has been removed - Ported to the new box object introduced before - removed legacy API from efl_ui_radio -> no more ptr(int) q66 will do jumps of happiness -> no more ununderstandable group_add methods -> Seperated code in blocks only for legacy, and blocks only for non-legacy To verify this commit, you can check all the tests that have been touched here. Additionally, the cxx example has been adjusted ref T7867 Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9060
-rw-r--r--src/bin/elementary/test_bg.c98
-rw-r--r--src/bin/elementary/test_part_bg.c40
-rw-r--r--src/bin/elementary/test_ui_active_view.c4
-rw-r--r--src/bin/elementary/test_ui_box.c38
-rw-r--r--src/bin/elementary/test_ui_image.c103
-rw-r--r--src/bin/elementary/test_ui_pager.c4
-rw-r--r--src/bin/elementary/test_ui_pager_scroll.c81
-rw-r--r--src/bin/elementary/test_ui_panel.c22
-rw-r--r--src/bin/elementary/test_ui_tab_pager.c18
-rw-r--r--src/bin/elementary/test_ui_table.c16
-rw-r--r--src/bin/elementary/test_ui_textpath.c18
-rw-r--r--src/examples/elementary/efl_ui_list_example_1.c28
-rw-r--r--src/examples/elementary/radio_cxx_example_01.cc9
-rw-r--r--src/lib/elementary/Efl_Ui.h4
-rw-r--r--src/lib/elementary/Elementary.h4
-rw-r--r--src/lib/elementary/efl_ui_radio.c197
-rw-r--r--src/lib/elementary/efl_ui_radio_eo.legacy.c18
-rw-r--r--src/lib/elementary/efl_ui_radio_private.h2
-rw-r--r--src/lib/elementary/elm_check.h3
-rw-r--r--src/lib/elementary/elm_dayselector.c9
-rw-r--r--src/modules/elementary/prefs/elm_check.c7
21 files changed, 336 insertions, 387 deletions
diff --git a/src/bin/elementary/test_bg.c b/src/bin/elementary/test_bg.c
index 5c74caf53e..fb8b4f5f33 100644
--- a/src/bin/elementary/test_bg.c
+++ b/src/bin/elementary/test_bg.c
@@ -375,9 +375,12 @@ test_bg_window(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
static void
_cb_radio_changed_scale_type(void *data, const Efl_Event *ev)
{
+ Efl_Ui_Radio_Box *bx = efl_ui_widget_parent_get(ev->object);
Evas_Object *o_bg = data;
+ int v = efl_ui_radio_group_selected_value_get(bx);
+ if (v == -1) v = 0;
- efl_gfx_image_scale_type_set(o_bg, efl_ui_nstate_value_get(ev->object));
+ efl_gfx_image_scale_type_set(o_bg, v);
}
static void
@@ -402,7 +405,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
{
Evas_Object *win;
Evas_Object *box, *hbox, *o_bg;
- Evas_Object *rd, *rdg;
+ Evas_Object *rd, *c;
char buf[PATH_MAX];
win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
@@ -427,59 +430,54 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e
efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE),
efl_pack(box, efl_added));
- hbox = efl_add(EFL_UI_BOX_CLASS, box,
+ hbox = efl_add(EFL_UI_RADIO_BOX_CLASS, box,
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_TRUE),
efl_pack(box, efl_added));
- rdg = rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_ui_radio_state_value_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FILL),
- efl_text_set(efl_added, "Fill"),
- efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
- efl_pack(hbox, efl_added));
-
- rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_ui_radio_state_value_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_INSIDE),
- efl_ui_radio_group_add(efl_added, rdg),
- efl_text_set(efl_added, "Fit Inside"),
- efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
- efl_pack(hbox, efl_added));
-
-
- rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_ui_radio_state_value_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE),
- efl_ui_radio_group_add(efl_added, rdg),
- efl_text_set(efl_added, "Fit Outside"),
- efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
- efl_pack(hbox, efl_added));
-
- rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_ui_radio_state_value_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_NONE),
- efl_ui_radio_group_add(efl_added, rdg),
- efl_text_set(efl_added, "None"),
- efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
- efl_pack(hbox, efl_added));
-
- rd = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_ui_radio_state_value_set(efl_added, EFL_GFX_IMAGE_SCALE_TYPE_TILE),
- efl_ui_radio_group_add(efl_added, rdg),
- efl_text_set(efl_added, "Tile"),
- efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED, _cb_radio_changed_scale_type, o_bg),
- efl_pack(hbox, efl_added));
-
- efl_ui_radio_group_value_set(rdg, EFL_GFX_IMAGE_SCALE_TYPE_FILL);
-
- efl_add(EFL_UI_CHECK_CLASS, hbox,
- efl_text_set(efl_added, "Bg Color"),
- efl_gfx_hint_weight_set(efl_added, EFL_GFX_HINT_EXPAND, 0.0),
- efl_event_callback_add(efl_added, EFL_UI_CHECK_EVENT_CHANGED, _cb_check_changed_scale_type, o_bg),
- efl_pack(hbox, efl_added));
+ rd = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_ui_radio_state_value_set(rd, EFL_GFX_IMAGE_SCALE_TYPE_FILL);
+ efl_text_set(rd, "Fill");
+ efl_gfx_hint_weight_set(rd, EFL_GFX_HINT_EXPAND, 0.0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _cb_radio_changed_scale_type, o_bg);
+ efl_pack(hbox, rd);
+
+ rd = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_ui_radio_state_value_set(rd, EFL_GFX_IMAGE_SCALE_TYPE_FIT_INSIDE);
+ efl_text_set(rd, "Fit Inside");
+ efl_gfx_hint_weight_set(rd, EFL_GFX_HINT_EXPAND, 0.0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _cb_radio_changed_scale_type, o_bg);
+ efl_pack(hbox, rd);
+
+ rd = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_ui_radio_state_value_set(rd, EFL_GFX_IMAGE_SCALE_TYPE_FIT_OUTSIDE);
+ efl_text_set(rd, "Fit Outside");
+ efl_gfx_hint_weight_set(rd, EFL_GFX_HINT_EXPAND, 0.0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _cb_radio_changed_scale_type, o_bg);
+ efl_pack(hbox, rd);
+
+ rd = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_ui_radio_state_value_set(rd, EFL_GFX_IMAGE_SCALE_TYPE_NONE);
+ efl_text_set(rd, "None");
+ efl_gfx_hint_weight_set(rd, EFL_GFX_HINT_EXPAND, 0.0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _cb_radio_changed_scale_type, o_bg);
+ efl_pack(hbox, rd);
+
+ rd = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_ui_radio_state_value_set(rd, EFL_GFX_IMAGE_SCALE_TYPE_TILE);
+ efl_text_set(rd, "Tile");
+ efl_gfx_hint_weight_set(rd, EFL_GFX_HINT_EXPAND, 0.0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _cb_radio_changed_scale_type, o_bg);
+ efl_pack(hbox, rd);
+
+ efl_ui_radio_group_selected_value_set(hbox, EFL_GFX_IMAGE_SCALE_TYPE_FILL);
+
+ c = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_text_set(c, "Bg Color");
+ efl_gfx_hint_weight_set(c, EFL_GFX_HINT_EXPAND, 0.0);
+ efl_event_callback_add(c, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _cb_check_changed_scale_type, o_bg);
+ efl_pack(box, c);
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 200));
}
diff --git a/src/bin/elementary/test_part_bg.c b/src/bin/elementary/test_part_bg.c
index 6ab0d6ecc4..d297d2ae74 100644
--- a/src/bin/elementary/test_part_bg.c
+++ b/src/bin/elementary/test_part_bg.c
@@ -12,10 +12,10 @@ const Efl_Class *content_class[MAX_NUM_OF_CONTENT];
static void
_reset_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
- Evas_Object *radio = data;
+ Efl_Ui_Radio_Group *radio = data;
Evas_Object *target;
- radio = efl_ui_radio_selected_object_get(radio);
+ radio = efl_ui_radio_group_selected_object_get(radio);
target = evas_object_data_get(radio, "data");
efl_gfx_color_set(efl_part(target, "background"), 0, 0, 0, 0);
@@ -25,11 +25,11 @@ _reset_cb(void *data, const Efl_Event *ev EINA_UNUSED)
static void
_color_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
- Evas_Object *radio = data;
+ Efl_Ui_Radio_Group *radio = data;
Evas_Object *target;
static Eina_Bool i;
- radio = efl_ui_radio_selected_object_get(radio);
+ radio = efl_ui_radio_group_selected_object_get(radio);
target = evas_object_data_get(radio, "data");
i ^= EINA_TRUE;
efl_gfx_color_set(efl_part(target, "background"), (i) ? 255 : 0, (i) ? 0 : 255, 0, 255);
@@ -38,12 +38,12 @@ _color_cb(void *data, const Efl_Event *ev EINA_UNUSED)
static void
_scale_type_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
- Evas_Object *radio = data;
+ Efl_Ui_Radio_Group *radio = data;
Evas_Object *target;
Efl_Gfx_Image_Scale_Type type;
char buf[PATH_MAX];
- radio = efl_ui_radio_selected_object_get(radio);
+ radio = efl_ui_radio_group_selected_object_get(radio);
target = evas_object_data_get(radio, "data");
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
@@ -53,24 +53,28 @@ _scale_type_cb(void *data, const Efl_Event *ev EINA_UNUSED)
efl_gfx_image_scale_type_set(efl_part(target, "background"), type);
}
-static Evas_Object *
+static Efl_Ui_Radio_Group *
_create_box_contents(Evas_Object *box)
{
Evas_Object *hbox;
Evas_Object *radio_group, *radio;
Evas_Object *content;
+ Efl_Ui_Radio_Group *group;
char buf[PATH_MAX];
unsigned int i;
+ group = efl_new(EFL_UI_RADIO_GROUP_IMPL_CLASS, NULL);
+
hbox = efl_add(EFL_UI_BOX_CLASS, box,
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
efl_gfx_hint_weight_set(efl_added, 1, 1),
efl_pack_end(box, efl_added));
- radio_group = radio = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_pack_end(hbox, efl_added),
- efl_gfx_hint_weight_set(efl_added, 0, 0),
- efl_ui_radio_state_value_set(efl_added, 0));
+ radio_group = radio = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_gfx_hint_weight_set(radio, 0, 0);
+ efl_ui_radio_state_value_set(radio, 0);
+ efl_ui_radio_group_register(group, radio);
+ efl_pack_end(hbox, radio);
content = efl_add(EFL_UI_BOX_CLASS, hbox,
efl_pack_end(hbox, efl_added));
@@ -89,11 +93,11 @@ _create_box_contents(Evas_Object *box)
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL),
efl_pack_end(box, efl_added));
- radio = efl_add(EFL_UI_RADIO_CLASS, hbox,
- efl_ui_radio_group_add(efl_added, radio_group),
- efl_pack_end(hbox, efl_added),
- efl_ui_radio_state_value_set(efl_added, i + 1),
- efl_gfx_hint_weight_set(efl_added, 0, 0));
+ radio = efl_add(EFL_UI_RADIO_CLASS, hbox);
+ efl_ui_radio_state_value_set(radio, i + 1);
+ efl_gfx_hint_weight_set(radio, 0, 0);
+ efl_ui_radio_group_register(group, radio);
+ efl_pack_end(hbox, radio);
content = efl_add(content_class[i], hbox,
efl_pack_end(hbox, efl_added));
@@ -110,7 +114,7 @@ _create_box_contents(Evas_Object *box)
evas_object_data_set(radio, "data", content);
}
- efl_ui_radio_group_value_set(radio_group, 0);
+ efl_ui_radio_group_selected_value_set(group, 0);
return radio_group;
}
@@ -121,7 +125,7 @@ test_part_background(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
Evas_Object *win;
Evas_Object *scr;
Evas_Object *vbox, *hbox;
- Evas_Object *radio_group;
+ Efl_Ui_Radio_Group *radio_group;
Evas_Object *reset_btn, *color_btn, *scale_btn;
content_class[0] = EFL_UI_CALENDAR_CLASS;
diff --git a/src/bin/elementary/test_ui_active_view.c b/src/bin/elementary/test_ui_active_view.c
index 86e81e8015..38a79ea831 100644
--- a/src/bin/elementary/test_ui_active_view.c
+++ b/src/bin/elementary/test_ui_active_view.c
@@ -399,7 +399,7 @@ active_view_size(void *data,
size_params->active_view = params->active_view;
size_params->params = params;
- efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_CHANGED, width_check_cb,
+ efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, width_check_cb,
size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
@@ -440,7 +440,7 @@ active_view_size(void *data,
size_params->active_view = params->active_view;
size_params->params = params;
- efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_CHANGED, height_check_cb,
+ efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, height_check_cb,
size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
diff --git a/src/bin/elementary/test_ui_box.c b/src/bin/elementary/test_ui_box.c
index 4c37b8789e..01414b9fb0 100644
--- a/src/bin/elementary/test_ui_box.c
+++ b/src/bin/elementary/test_ui_box.c
@@ -20,9 +20,9 @@ typedef enum {
} Weight_Mode;
static void
-weights_cb(void *data, const Efl_Event *event)
+weights_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
- Weight_Mode mode = elm_radio_state_value_get(event->object);
+ Weight_Mode mode = elm_radio_state_value_get(obj);
switch (mode)
{
@@ -138,9 +138,9 @@ alignv_btn_slider_cb(void *data, const Efl_Event *event)
}
static void
-flow_check_cb(void *data, const Efl_Event *event)
+flow_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
- Eina_Bool chk = elm_check_selected_get(event->object);
+ Eina_Bool chk = elm_check_selected_get(obj);
Eina_List *list = NULL;
Eina_Iterator *it;
Eo *box, *win, *sobj, *parent;
@@ -167,17 +167,17 @@ flow_check_cb(void *data, const Efl_Event *event)
}
static void
-horiz_check_cb(void *data, const Efl_Event *event)
+horiz_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
- Eina_Bool chk = elm_check_selected_get(event->object);
+ Eina_Bool chk = elm_check_selected_get(obj);
Eo *box = efl_key_wref_get(data, "box");
efl_ui_layout_orientation_set(box, chk ? EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL : EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
}
static void
-homo_check_cb(void *data, const Efl_Event *event)
+homo_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
- Eina_Bool chk = elm_check_selected_get(event->object);
+ Eina_Bool chk = elm_check_selected_get(obj);
Eo *box = efl_key_wref_get(data, "box");
efl_ui_box_homogeneous_set(box, chk);
}
@@ -210,12 +210,12 @@ _custom_layout_update(Eo *pack, const void *data EINA_UNUSED)
}
static void
-custom_check_cb(void *data, const Efl_Event *event)
+custom_check_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
EFL_OPS_DEFINE(custom_layout_ops,
EFL_OBJECT_OP_FUNC(efl_pack_layout_update, _custom_layout_update));
- Eina_Bool chk = elm_check_selected_get(event->object);
+ Eina_Bool chk = elm_check_selected_get(obj);
Eo *box, *win = data;
box = efl_key_wref_get(win, "box");
@@ -268,7 +268,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
chk = o = elm_radio_add(win);
elm_object_text_set(o, "No weight");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, win);
+ evas_object_smart_callback_add(o, "changed", weights_cb, win);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, NONE);
efl_pack(bx, o);
@@ -276,7 +276,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_radio_add(win);
elm_object_text_set(o, "No weight + box fill");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, win);
+ evas_object_smart_callback_add(o, "changed", weights_cb, win);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, NONE_BUT_FILL);
elm_radio_group_add(o, chk);
@@ -285,7 +285,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_radio_add(win);
elm_object_text_set(o, "Equal weights");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, win);
+ evas_object_smart_callback_add(o, "changed", weights_cb, win);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, EQUAL);
elm_radio_group_add(o, chk);
@@ -294,7 +294,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_radio_add(win);
elm_object_text_set(o, "One weight only");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, win);
+ evas_object_smart_callback_add(o, "changed", weights_cb, win);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, ONE);
elm_radio_group_add(o, chk);
@@ -303,7 +303,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_radio_add(win);
elm_object_text_set(o, "Two weights");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, win);
+ evas_object_smart_callback_add(o, "changed", weights_cb, win);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, TWO);
elm_radio_group_add(o, chk);
@@ -329,7 +329,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_check_add(win);
elm_check_selected_set(o, 0);
elm_object_text_set(o, "Flow");
- efl_event_callback_add(o, EFL_UI_CHECK_EVENT_CHANGED, flow_check_cb, win);
+ evas_object_smart_callback_add(o, "changed", flow_check_cb, win);
efl_gfx_hint_align_set(o, 0, 0);
efl_pack(bx, o);
efl_gfx_entity_visible_set(o, 1);
@@ -337,7 +337,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_check_add(win);
elm_check_selected_set(o, 1);
elm_object_text_set(o, "Horizontal");
- efl_event_callback_add(o, EFL_UI_CHECK_EVENT_CHANGED, horiz_check_cb, win);
+ evas_object_smart_callback_add(o, "changed", horiz_check_cb, win);
efl_gfx_hint_align_set(o, 0, 0);
efl_pack(bx, o);
efl_gfx_entity_visible_set(o, 1);
@@ -345,7 +345,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_check_add(win);
elm_check_selected_set(o, 0);
elm_object_text_set(o, "Homogenous");
- efl_event_callback_add(o, EFL_UI_CHECK_EVENT_CHANGED, homo_check_cb, win);
+ evas_object_smart_callback_add(o, "changed", homo_check_cb, win);
efl_gfx_hint_align_set(o, 0, 0);
efl_pack(bx, o);
efl_gfx_entity_visible_set(o, 1);
@@ -353,7 +353,7 @@ test_ui_box(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
o = elm_check_add(win);
elm_check_selected_set(o, 0);
elm_object_text_set(o, "Custom layout");
- efl_event_callback_add(o, EFL_UI_CHECK_EVENT_CHANGED, custom_check_cb, win);
+ evas_object_smart_callback_add(o, "changed", custom_check_cb, win);
efl_gfx_hint_align_set(o, 0, 0);
efl_gfx_hint_weight_set(o, 0, 1);
efl_pack(bx, o);
diff --git a/src/bin/elementary/test_ui_image.c b/src/bin/elementary/test_ui_image.c
index 38d732f864..8491a7f4cd 100644
--- a/src/bin/elementary/test_ui_image.c
+++ b/src/bin/elementary/test_ui_image.c
@@ -50,8 +50,9 @@ my_im_ch(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *win = data;
Eo *im = efl_key_data_get(win, "im");
- Eo *rdg = efl_key_data_get(win, "rdg");
- Efl_Gfx_Image_Orientation v = efl_ui_radio_state_value_get(efl_ui_radio_selected_object_get(rdg));
+
+ Efl_Gfx_Image_Orientation v = efl_ui_radio_group_selected_value_get(ev->object);
+ if (((int)v) == -1) v = 0;
efl_gfx_image_orientation_set(im, v);
fprintf(stderr, "Set %i and got %i\n",
@@ -61,17 +62,18 @@ my_im_ch(void *data, const Efl_Event *ev EINA_UNUSED)
void
test_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Eo *win, *box, *im, *rd, *rdg = NULL;
+ Eo *win, *box, *im, *rd;
int i;
win = win_add("image test", "Image Test");
- box = efl_add(EFL_UI_BOX_CLASS, win);
+ box = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
efl_gfx_hint_weight_set(box, 1.0, 1.0);
efl_content_set(win, box);
+ efl_key_data_set(win, "rdg", box);
im = img_add(win, "/images/logo.png");
- efl_pack(box, im);
+ efl_content_set(win, im);
for (i = 0; images_orient[i].name; ++i)
{
@@ -81,19 +83,10 @@ test_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EIN
efl_ui_radio_state_value_set(rd, images_orient[i].orient);
efl_text_set(rd, images_orient[i].name);
efl_pack(box, rd);
- efl_event_callback_add(rd, EFL_UI_RADIO_EVENT_CHANGED, my_im_ch, win);
- if (!rdg)
- {
- rdg = rd;
- efl_key_data_set(win, "rdg", rdg);
- }
- else
- {
- efl_ui_radio_group_add(rd, rdg);
- }
}
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 480));
+ efl_event_callback_add(box, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, my_im_ch, win);
}
@@ -130,8 +123,8 @@ my_im_scale_ch(void *data, const Efl_Event *ev EINA_UNUSED)
{
Eo *win = data;
Eo *im = efl_key_data_get(win, "im");
- Eo *rdg = efl_key_data_get(win, "rdg");
- int v = efl_ui_radio_state_value_get(efl_ui_radio_selected_object_get(rdg));
+ int v = efl_ui_radio_group_selected_value_get(ev->object);
+ if (v == -1) v = 0;
efl_gfx_image_scale_type_set(im, images_scale_type[v].scale_type);
fprintf(stderr, "Set %d[%s] and got %d\n",
@@ -141,14 +134,15 @@ my_im_scale_ch(void *data, const Efl_Event *ev EINA_UNUSED)
void
test_ui_image_scale_type(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Eo *win, *box, *im, *rd, *rdg = NULL;
+ Eo *win, *box, *im, *rd;
int i;
win = win_add("image test scale type", "Image Test Scale Type");
- box = efl_add(EFL_UI_BOX_CLASS, win);
+ box = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
efl_gfx_hint_weight_set(box, 1.0, 1.0);
efl_content_set(win, box);
+ efl_key_data_set(win, "rdg", box);
im = efl_add(EFL_UI_IMAGE_CLASS, win);
char buf[PATH_MAX];
@@ -156,7 +150,7 @@ test_ui_image_scale_type(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *eve
elm_image_file_set(im, buf, NULL);
efl_gfx_hint_weight_set(im, 1.0, 1.0);
efl_gfx_hint_fill_set(im, EINA_TRUE, EINA_TRUE);
- efl_pack(box, im);
+ efl_content_set(win, im);
efl_key_data_set(win, "im", im);
@@ -168,18 +162,8 @@ test_ui_image_scale_type(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *eve
efl_ui_radio_state_value_set(rd, i);
efl_text_set(rd, images_scale_type[i].name);
efl_pack(box, rd);
- efl_event_callback_add(rd, EFL_UI_RADIO_EVENT_CHANGED, my_im_scale_ch, win);
- if (!rdg)
- {
- rdg = rd;
- efl_key_data_set(win, "rdg", rdg);
- }
- else
- {
- efl_ui_radio_group_add(rd, rdg);
- }
}
-
+ efl_event_callback_add(box, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, my_im_scale_ch, win);
efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 480));
}
@@ -307,7 +291,7 @@ _url_activate_cb(void *data, Eo *obj, void *event_info EINA_UNUSED)
void
test_remote_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Eo *win, *box, *im, *rd, *rdg = NULL, *box2, *o;
+ Eo *win, *box, *im, *rd, *box2, *o;
int i;
win = win_add("image test", "Image Test");
@@ -332,6 +316,12 @@ test_remote_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_i
evas_object_smart_callback_add(im, "download,done", _download_done_cb, win);
evas_object_smart_callback_add(im, "download,error", _download_error_cb, win);
+ box2 = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
+ efl_gfx_hint_weight_set(box2, 1.0, 1.0);
+ efl_content_set(win, box2);
+ efl_key_data_set(win, "rdg", box2);
+ efl_pack(box, box2);
+
for (i = 0; images_orient[i].name; ++i)
{
rd = efl_add(EFL_UI_RADIO_CLASS, win);
@@ -339,23 +329,15 @@ test_remote_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_i
efl_gfx_hint_weight_set(rd, 1.0, 0.0);
efl_ui_radio_state_value_set(rd, images_orient[i].orient);
efl_text_set(rd, images_orient[i].name);
- efl_pack(box, rd);
- efl_event_callback_add(rd, EFL_UI_RADIO_EVENT_CHANGED, my_im_ch, win);
- if (!rdg)
- {
- rdg = rd;
- efl_key_data_set(win, "rdg", rdg);
- }
- else
- {
- efl_ui_radio_group_add(rd, rdg);
- }
+ efl_pack(box2, rd);
}
+ efl_event_callback_add(box2, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, my_im_ch, win);
box2 = o = efl_add(EFL_UI_BOX_CLASS, box);
efl_ui_layout_orientation_set(o, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
efl_gfx_hint_weight_set(o, 1.0, 0);
efl_gfx_hint_fill_set(o, EINA_TRUE, EINA_TRUE);
+ efl_pack(box, box2);
o = efl_add(EFL_UI_TEXT_CLASS, box2,
efl_text_interactive_editable_set(efl_added, EINA_FALSE)
@@ -374,7 +356,6 @@ test_remote_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_i
evas_object_show(o);
efl_pack(box2, o);
- efl_pack(box, box2);
// set file now
_url_activate_cb(win, o, NULL);
@@ -567,19 +548,17 @@ test_load_ui_image(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_inf
);
efl_pack(hbox, label);
- chk1 = efl_add(EFL_UI_CHECK_CLASS, hbox,
- efl_text_set(efl_added, "Async file open"),
- efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
- efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE)
- );
+ chk1 = efl_add(EFL_UI_CHECK_CLASS, hbox);
+ efl_text_set(chk1, "Async file open");
+ efl_gfx_hint_weight_set(chk1, 0.0, 0.0);
+ efl_gfx_hint_fill_set(chk1, EINA_TRUE, EINA_FALSE);
efl_pack(hbox, chk1);
efl_key_data_set(win, "chk1", chk1);
- chk2 = efl_add(EFL_UI_CHECK_CLASS, hbox,
- efl_text_set(efl_added, "Disable preload"),
- efl_gfx_hint_weight_set(efl_added, 0.0, 0.0),
- efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE)
- );
+ chk2 = efl_add(EFL_UI_CHECK_CLASS, hbox);
+ efl_text_set(chk2, "Disable preload");
+ efl_gfx_hint_weight_set(chk2, 0.0, 0.0);
+ efl_gfx_hint_fill_set(chk2, EINA_TRUE, EINA_FALSE);
efl_pack(hbox, chk2);
efl_key_data_set(win, "chk2", chk2);
}
@@ -614,7 +593,8 @@ _cb_prescale_radio_changed(void *data, const Efl_Event *ev)
{
Eo *o_bg = data;
int size;
- size = efl_ui_radio_state_value_get(efl_ui_radio_selected_object_get(ev->object));
+ size = efl_ui_radio_group_selected_value_get(ev->object);
+ if (size == -1) size = 0;
//FIXME
elm_image_prescale_set(o_bg, size);
}
@@ -624,7 +604,7 @@ test_ui_image_prescale(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_
{
Eo *win, *im;
Eo *box, *hbox;
- Eo *rd, *rdg;
+ Eo *rd;
win = win_add("image-prescale", "Image Prescale Test");
@@ -634,7 +614,7 @@ test_ui_image_prescale(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_
im = img_add(win, "/images/plant_01.jpg");
efl_pack(box, im);
- hbox = efl_add(EFL_UI_BOX_CLASS, win);
+ hbox = efl_add(EFL_UI_RADIO_BOX_CLASS, win);
efl_ui_layout_orientation_set(hbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
efl_gfx_hint_weight_set(hbox, 1.0, 1.0);
efl_gfx_hint_fill_set(hbox, EINA_TRUE, EINA_TRUE);
@@ -643,27 +623,22 @@ test_ui_image_prescale(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_
efl_ui_radio_state_value_set(rd, 50);
efl_text_set(rd, "50");
efl_gfx_hint_weight_set(rd, 1.0, 1.0);
- efl_event_callback_add(rd, EFL_UI_RADIO_EVENT_CHANGED, _cb_prescale_radio_changed, im);
efl_pack(hbox, rd);
- rdg = rd;
rd = efl_add(EFL_UI_RADIO_CLASS, win);
efl_ui_radio_state_value_set(rd, 100);
- efl_ui_radio_group_add(rd, rdg);
efl_text_set(rd, "100");
efl_gfx_hint_weight_set(rd, 1.0, 1.0);
- efl_event_callback_add(rd, EFL_UI_RADIO_EVENT_CHANGED, _cb_prescale_radio_changed, im);
efl_pack(hbox, rd);
rd = efl_add(EFL_UI_RADIO_CLASS, win);
efl_ui_radio_state_value_set(rd, 200);
- efl_ui_radio_group_add(rd, rdg);
efl_text_set(rd, "200");
efl_gfx_hint_weight_set(rd, 1.0, 1.0);
- efl_event_callback_add(rd, EFL_UI_RADIO_EVENT_CHANGED, _cb_prescale_radio_changed, im);
efl_pack(hbox, rd);
+ efl_event_callback_add(hbox, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _cb_prescale_radio_changed, im);
- elm_radio_value_set(rdg, 200);
+ efl_ui_radio_group_selected_object_set(hbox, rd);
efl_pack(box, hbox);
diff --git a/src/bin/elementary/test_ui_pager.c b/src/bin/elementary/test_ui_pager.c
index 5fba212e53..6fcf48f763 100644
--- a/src/bin/elementary/test_ui_pager.c
+++ b/src/bin/elementary/test_ui_pager.c
@@ -375,7 +375,7 @@ static void page_size_cb(void *data,
size_params->pager = params->pager;
size_params->params = params;
- efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_CHANGED, width_check_cb,
+ efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, width_check_cb,
size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
@@ -416,7 +416,7 @@ static void page_size_cb(void *data,
size_params->pager = params->pager;
size_params->params = params;
- efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_CHANGED, height_check_cb,
+ efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, height_check_cb,
size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
diff --git a/src/bin/elementary/test_ui_pager_scroll.c b/src/bin/elementary/test_ui_pager_scroll.c
index 9d1857ec9e..6e6c7d1f49 100644
--- a/src/bin/elementary/test_ui_pager_scroll.c
+++ b/src/bin/elementary/test_ui_pager_scroll.c
@@ -359,7 +359,7 @@ static void next_block_check_cb(void *data, const Efl_Event *ev)
static void loop_radio_cb(void *data, const Efl_Event *ev)
{
Eo *pager = data;
- int state = efl_ui_radio_group_value_get(ev->object);
+ int state = efl_ui_radio_group_selected_value_get(efl_ui_widget_parent_get(ev->object));
efl_ui_pager_loop_mode_set(pager, state);
}
@@ -409,8 +409,8 @@ static void page_size_cb(void *data,
inbox = efl_add(EFL_UI_BOX_CLASS, fr,
efl_content_set(fr, efl_added));
- ck = elm_check_add(inbox);
- elm_object_text_set(ck, "Fill");
+ ck = efl_add(EFL_UI_CHECK_CLASS, inbox);
+ efl_text_set(ck, "Fill");
efl_pack_end(inbox, ck);
efl_gfx_entity_visible_set(ck, 1);
@@ -429,7 +429,7 @@ static void page_size_cb(void *data,
size_params->pager = params->pager;
size_params->params = params;
- efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_CHANGED, width_check_cb,
+ efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, width_check_cb,
size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
@@ -450,8 +450,8 @@ static void page_size_cb(void *data,
inbox = efl_add(EFL_UI_BOX_CLASS, fr,
efl_content_set(fr, efl_added));
- ck = elm_check_add(inbox);
- elm_object_text_set(ck, "Fill");
+ ck = efl_add(EFL_UI_CHECK_CLASS, inbox);
+ efl_text_set(ck, "Fill");
efl_pack_end(inbox, ck);
efl_gfx_entity_visible_set(ck, 1);
@@ -470,7 +470,7 @@ static void page_size_cb(void *data,
size_params->pager = params->pager;
size_params->params = params;
- efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_CHANGED, height_check_cb,
+ efl_event_callback_add(ck, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, height_check_cb,
size_params);
efl_event_callback_add(ck, EFL_EVENT_DEL, check_del_cb, size_params);
@@ -778,7 +778,7 @@ static void scroll_block_cb(void *data,
Params *params = (Params *)data;
Evas_Object *navi = params->navi;
Eo *pager = params->pager;
- Eo *btn, *box;
+ Eo *btn, *box, *c;
Eina_Bool prev, next;
btn = efl_add(EFL_UI_BUTTON_CLASS, navi,
@@ -793,21 +793,21 @@ static void scroll_block_cb(void *data,
efl_ui_pager_scroll_block_get(pager, &prev, &next);
- efl_add(EFL_UI_CHECK_CLASS, box,
- efl_ui_widget_style_set(efl_added, "toggle"),
- efl_text_set(efl_added, "Prev Block"),
- efl_ui_check_selected_set(efl_added, prev),
- efl_event_callback_add(efl_added, EFL_UI_CHECK_EVENT_CHANGED,
- prev_block_check_cb, pager),
- efl_pack_end(box, efl_added));
-
- efl_add(EFL_UI_CHECK_CLASS, box,
- efl_ui_widget_style_set(efl_added, "toggle"),
- efl_text_set(efl_added, "Next Block"),
- efl_ui_check_selected_set(efl_added, next),
- efl_event_callback_add(efl_added, EFL_UI_CHECK_EVENT_CHANGED,
- next_block_check_cb, pager),
- efl_pack_end(box, efl_added));
+ c = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_ui_widget_style_set(c, "toggle");
+ efl_text_set(c, "Prev Block");
+ efl_ui_check_selected_set(c, prev);
+ efl_event_callback_add(c, EFL_UI_CHECK_EVENT_SELECTED_CHANGED,
+ prev_block_check_cb, pager);
+ efl_pack_end(box, c);
+
+ c = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_ui_widget_style_set(c, "toggle");
+ efl_text_set(c, "Next Block");
+ efl_ui_check_selected_set(c, next);
+ efl_event_callback_add(c, EFL_UI_CHECK_EVENT_SELECTED_CHANGED,
+ next_block_check_cb, pager);
+ efl_pack_end(box, c);
}
static void loop_cb(void *data EINA_UNUSED,
@@ -825,31 +825,30 @@ static void loop_cb(void *data EINA_UNUSED,
efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED,
back_btn_cb, navi));
- box = efl_add(EFL_UI_BOX_CLASS, navi,
+ box = efl_add(EFL_UI_RADIO_BOX_CLASS, navi,
efl_gfx_arrangement_content_padding_set(efl_added, 10, 10, EINA_TRUE),
elm_naviframe_item_push(navi, "Loop", btn, NULL,
efl_added, NULL));
- rd = efl_add(EFL_UI_RADIO_CLASS, box,
- efl_ui_radio_state_value_set(efl_added, EFL_UI_PAGER_LOOP_DISABLED),
- efl_text_set(efl_added, "Disabled"),
- efl_gfx_hint_weight_set(efl_added, 1, 0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED,
- loop_radio_cb, pager),
- efl_pack(box, efl_added));
-
- rd = efl_add(EFL_UI_RADIO_CLASS, box,
- efl_ui_radio_state_value_set(efl_added, EFL_UI_PAGER_LOOP_ENABLED),
- efl_ui_radio_group_add(efl_added, rd),
- efl_text_set(efl_added, "Enabled"),
- efl_gfx_hint_weight_set(efl_added, 1, 0),
- efl_event_callback_add(efl_added, EFL_UI_RADIO_EVENT_CHANGED,
- loop_radio_cb, pager),
- efl_pack(box, efl_added));
+ rd = efl_add(EFL_UI_RADIO_CLASS, box);
+ efl_ui_radio_state_value_set(rd, EFL_UI_PAGER_LOOP_DISABLED);
+ efl_text_set(rd, "Disabled");
+ efl_gfx_hint_weight_set(rd, 1, 0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED,
+ loop_radio_cb, pager);
+ efl_pack(box, rd);
+
+ rd = efl_add(EFL_UI_RADIO_CLASS, box);
+ efl_ui_radio_state_value_set(rd, EFL_UI_PAGER_LOOP_ENABLED);
+ efl_text_set(rd, "Enabled");
+ efl_gfx_hint_weight_set(rd, 1, 0);
+ efl_event_callback_add(rd, EFL_UI_CHECK_EVENT_SELECTED_CHANGED,
+ loop_radio_cb, pager);
+ efl_pack(box, rd);
loop = efl_ui_pager_loop_mode_get(pager);
- efl_ui_radio_group_value_set(rd, loop);
+ efl_ui_radio_group_selected_value_set(efl_ui_radio_box_group_get(box), loop);
if (loop == EFL_UI_PAGER_LOOP_DISABLED)
{
diff --git a/src/bin/elementary/test_ui_panel.c b/src/bin/elementary/test_ui_panel.c
index f8bbd0bd78..91adb22301 100644
--- a/src/bin/elementary/test_ui_panel.c
+++ b/src/bin/elementary/test_ui_panel.c
@@ -111,17 +111,17 @@ test_ui_panel2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added));
- efl_add(EFL_UI_CHECK_CLASS, box,
- efl_ui_check_selected_set(efl_added, elm_config_scroll_thumbscroll_enabled_get()),
- efl_text_set(efl_added, "Enable thumb scroll (temporarily"),
- efl_event_callback_add(efl_added, EFL_UI_NSTATE_EVENT_CHANGED, _check_changed, NULL),
- efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
- efl_pack(box, efl_added));
-
- check = efl_add(EFL_UI_CHECK_CLASS, box,
- efl_text_set(efl_added, "Reset content on toggle"),
- efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
- efl_pack(box, efl_added));
+ check = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_ui_check_selected_set(check, elm_config_scroll_thumbscroll_enabled_get());
+ efl_text_set(check, "Enable thumb scroll (temporarily");
+ efl_event_callback_add(check, EFL_UI_NSTATE_EVENT_CHANGED, _check_changed, NULL);
+ efl_gfx_hint_weight_set(check, EVAS_HINT_EXPAND, 0);
+ efl_pack(box, check);
+
+ check = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_text_set(check, "Reset content on toggle");
+ efl_gfx_hint_weight_set(check, EVAS_HINT_EXPAND, 0);
+ efl_pack(box, check);
btn = efl_add(EFL_UI_BUTTON_CLASS, box,
efl_text_set(efl_added, "toggle"),
diff --git a/src/bin/elementary/test_ui_tab_pager.c b/src/bin/elementary/test_ui_tab_pager.c
index ae579a47de..bd316229c2 100644
--- a/src/bin/elementary/test_ui_tab_pager.c
+++ b/src/bin/elementary/test_ui_tab_pager.c
@@ -532,15 +532,15 @@ _tab_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
efl_gfx_arrangement_content_padding_set(efl_added, 10, 10, EINA_TRUE),
elm_naviframe_item_push(navi, "Tab", btn, NULL, efl_added, NULL));
- label_check = efl_add(EFL_UI_CHECK_CLASS, box,
- efl_text_set(efl_added, "Tab Label + Page"),
- efl_ui_check_selected_set(efl_added, EINA_FALSE),
- efl_pack_end(box, efl_added));
-
- icon_check = efl_add(EFL_UI_CHECK_CLASS, box,
- efl_text_set(efl_added, "Tab Icon"),
- efl_ui_check_selected_set(efl_added, EINA_FALSE),
- efl_pack_end(box, efl_added));
+ label_check = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_text_set(label_check, "Tab Label + Page");
+ efl_ui_check_selected_set(label_check, EINA_FALSE);
+ efl_pack_end(box, label_check);
+
+ icon_check = efl_add(EFL_UI_CHECK_CLASS, box);
+ efl_text_set(icon_check, "Tab Icon");
+ efl_ui_check_selected_set(icon_check, EINA_FALSE);
+ efl_pack_end(box, icon_check);
tcd->tab_pager = tab_pager;
tcd->label_check = label_check;
diff --git a/src/bin/elementary/test_ui_table.c b/src/bin/elementary/test_ui_table.c
index bcaf01559e..34991f6634 100644
--- a/src/bin/elementary/test_ui_table.c
+++ b/src/bin/elementary/test_ui_table.c
@@ -20,12 +20,12 @@ typedef enum {
} Weight_Mode;
static void
-weights_cb(void *data, const Efl_Event *event)
+weights_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
EFL_OPS_DEFINE(custom_layout_ops,
EFL_OBJECT_OP_FUNC(efl_pack_layout_update, _custom_layout_update));
- Weight_Mode mode = elm_radio_state_value_get(event->object);
+ Weight_Mode mode = elm_radio_state_value_get(obj);
Eo *table = data;
if (mode != CUSTOM)
@@ -232,7 +232,7 @@ test_ui_table(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
chk = o = elm_radio_add(win);
elm_object_text_set(o, "No weight");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, table);
+ evas_object_smart_callback_add(o, "changed", weights_cb, table);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, NONE);
efl_pack(bx, o);
@@ -240,7 +240,7 @@ test_ui_table(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
o = elm_radio_add(win);
elm_object_text_set(o, "No weight + table fill");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, table);
+ evas_object_smart_callback_add(o, "changed", weights_cb, table);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, NONE_BUT_FILL);
elm_radio_group_add(o, chk);
@@ -249,7 +249,7 @@ test_ui_table(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
o = elm_radio_add(win);
elm_object_text_set(o, "Equal weights");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, table);
+ evas_object_smart_callback_add(o, "changed", weights_cb, table);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, EQUAL);
elm_radio_group_add(o, chk);
@@ -258,7 +258,7 @@ test_ui_table(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
o = elm_radio_add(win);
elm_object_text_set(o, "One weight only");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, table);
+ evas_object_smart_callback_add(o, "changed", weights_cb, table);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, ONE);
elm_radio_group_add(o, chk);
@@ -267,7 +267,7 @@ test_ui_table(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
o = elm_radio_add(win);
elm_object_text_set(o, "Two weights");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, table);
+ evas_object_smart_callback_add(o, "changed", weights_cb, table);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, TWO);
elm_radio_group_add(o, chk);
@@ -276,7 +276,7 @@ test_ui_table(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
o = elm_radio_add(win);
elm_object_text_set(o, "Custom layout");
- efl_event_callback_add(o, EFL_UI_RADIO_EVENT_CHANGED, weights_cb, table);
+ evas_object_smart_callback_add(o, "changed", weights_cb, table);
efl_gfx_hint_align_set(o, 0, 0.5);
elm_radio_state_value_set(o, CUSTOM);
elm_radio_group_add(o, chk);
diff --git a/src/bin/elementary/test_ui_textpath.c b/src/bin/elementary/test_ui_textpath.c
index 0042f2b6a2..e4756996f3 100644
--- a/src/bin/elementary/test_ui_textpath.c
+++ b/src/bin/elementary/test_ui_textpath.c
@@ -120,23 +120,23 @@ test_ui_textpath(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
efl_gfx_entity_visible_set(hbox, EINA_TRUE);
elm_box_pack_end(box, hbox);
- chk = elm_check_add(win);
- elm_object_text_set(chk, "Ellipsis");
+ chk = efl_add(EFL_UI_CHECK_CLASS, win);
+ efl_text_set(chk, "Ellipsis");
elm_check_state_set(chk, efl_ui_textpath_ellipsis_get(txtpath));
- efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_CHANGED, _ellipsis_changed_cb, txtpath);
+ efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _ellipsis_changed_cb, txtpath);
elm_box_pack_end(hbox, chk);
efl_gfx_entity_visible_set(chk, EINA_TRUE);
- chk = elm_check_add(win);
- elm_object_text_set(chk, "Clockwise");
- efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_CHANGED, _direction_changed_cb, txtpath);
+ chk = efl_add(EFL_UI_CHECK_CLASS, win);
+ efl_text_set(chk, "Clockwise");
+ efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _direction_changed_cb, txtpath);
elm_box_pack_end(hbox, chk);
efl_gfx_entity_visible_set(chk, EINA_TRUE);
dir_chk = chk;
- chk = elm_check_add(win);
- elm_object_text_set(chk, "Short text");
- efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_CHANGED, _short_text_changed_cb, txtpath);
+ chk = efl_add(EFL_UI_CHECK_CLASS, win);
+ efl_text_set(chk, "Short text");
+ efl_event_callback_add(chk, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _short_text_changed_cb, txtpath);
elm_box_pack_end(hbox, chk);
efl_gfx_entity_visible_set(chk, EINA_TRUE);
diff --git a/src/examples/elementary/efl_ui_list_example_1.c b/src/examples/elementary/efl_ui_list_example_1.c
index 135b8a2d3c..7c3b1e55b9 100644
--- a/src/examples/elementary/efl_ui_list_example_1.c
+++ b/src/examples/elementary/efl_ui_list_example_1.c
@@ -70,13 +70,13 @@ static void
_select_radio_changed(void *data, const Efl_Event *ev)
{
Eo *list = data;
- efl_ui_select_mode_set(list, efl_ui_radio_state_value_get(ev->object));
+ efl_ui_select_mode_set(list, efl_ui_radio_group_selected_value_get(ev->object));
}
static void
-_anim_radio_changed(void *data EINA_UNUSED, const Efl_Event *ev)
+_anim_radio_changed(void *data, const Efl_Event *ev EINA_UNUSED)
{
- priv_d.anim = efl_ui_radio_state_value_get(ev->object);
+ priv_d.anim = efl_ui_radio_group_selected_value_get(data);
}
static void
@@ -102,7 +102,7 @@ elm_main(int argc EINA_UNUSED, char **argv)
Eo *win, *list;
Eo *wbox, *ibox, *bbox, *rbox;
Eo *item, *check, *txt;
- Eo *radio, *select_radio, *anim_radio;
+ Eo *radio;
Eo *slider, *scrl_btn;
int i;
char buf[256];
@@ -229,34 +229,28 @@ elm_main(int argc EINA_UNUSED, char **argv)
efl_text_set(txt, "Select Mode");
efl_pack_end(wbox, txt);
- bbox = efl_add(EFL_UI_BOX_CLASS, wbox);
+ bbox = efl_add(EFL_UI_RADIO_BOX_CLASS, wbox);
efl_ui_layout_orientation_set(bbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
efl_gfx_hint_weight_set(bbox, EFL_GFX_HINT_EXPAND, 0.05);
- select_radio = radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
+ radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
efl_text_set(radio, "SINGLE");
efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_MODE_SINGLE);
- efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
efl_pack_end(bbox, radio);
radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
efl_text_set(radio, "SINGLE_ALWAYS");
efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_MODE_SINGLE_ALWAYS);
- efl_ui_radio_group_add(radio, select_radio);
- efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
efl_pack_end(bbox, radio);
radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
efl_text_set(radio, "MULTI");
efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_MODE_MULTI);
- efl_ui_radio_group_add(radio, select_radio);
- efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
efl_pack_end(bbox, radio);
radio = efl_add(EFL_UI_RADIO_CLASS, wbox);
efl_text_set(radio, "NONE");
efl_ui_radio_state_value_set(radio, EFL_UI_SELECT_MODE_NONE);
- efl_ui_radio_group_add(radio, select_radio);
- efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _select_radio_changed, list);
efl_pack_end(bbox, radio);
efl_pack_end(wbox, bbox);
+ efl_event_callback_add(bbox, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _select_radio_changed, list);
/* scroll mode */
txt = efl_add(EFL_UI_TEXT_CLASS, wbox);
@@ -278,23 +272,21 @@ elm_main(int argc EINA_UNUSED, char **argv)
efl_ui_layout_orientation_set(bbox, EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
efl_gfx_hint_weight_set(bbox, EFL_GFX_HINT_EXPAND, 0.05);
- rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
+ rbox = efl_add(EFL_UI_RADIO_BOX_CLASS, bbox);
efl_ui_layout_orientation_set(rbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
- anim_radio = radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
+ radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
efl_gfx_hint_align_set(radio, 0.5, 0.5);
efl_text_set(radio, "ANIMATION OFF");
efl_ui_radio_state_value_set(radio, 0);
- efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _anim_radio_changed, NULL);
efl_pack_end(rbox, radio);
radio = efl_add(EFL_UI_RADIO_CLASS, rbox);
efl_gfx_hint_align_set(radio, 0.5, 0.5);
efl_text_set(radio, "ANIMATION ON");
efl_ui_radio_state_value_set(radio, 1);
- efl_ui_radio_group_add(radio, anim_radio);
- efl_event_callback_add(radio, EFL_UI_RADIO_EVENT_CHANGED, _anim_radio_changed, NULL);
efl_pack_end(rbox, radio);
efl_pack_end(bbox, rbox);
+ efl_event_callback_add(rbox, EFL_UI_RADIO_GROUP_EVENT_VALUE_CHANGED, _anim_radio_changed, rbox);
rbox = efl_add(EFL_UI_BOX_CLASS, bbox);
efl_ui_layout_orientation_set(rbox, EFL_UI_LAYOUT_ORIENTATION_VERTICAL);
diff --git a/src/examples/elementary/radio_cxx_example_01.cc b/src/examples/elementary/radio_cxx_example_01.cc
index c6d5146655..1b6c659e14 100644
--- a/src/examples/elementary/radio_cxx_example_01.cc
+++ b/src/examples/elementary/radio_cxx_example_01.cc
@@ -16,7 +16,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
win.text_set("Radio Example");
win.autohide_set(true);
- efl::ui::Box bx(instantiate, win);
+ efl::ui::Radio_Box bx(instantiate, win);
bx.orientation_set(EFL_UI_LAYOUT_ORIENTATION_HORIZONTAL);
win.content_set(bx);
@@ -30,15 +30,14 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
radio.content_set(ic);
bx.pack_end(radio);
- auto cb_val = std::bind([] (efl::ui::Radio &obj)
- { std::cout << "val is now: " << obj.group_value_get() << std::endl; },
+ auto cb_val = std::bind([bx] (efl::ui::Radio &obj EINA_UNUSED)
+ { std::cout << "val is now: " << bx.selected_value_get() << std::endl; },
std::placeholders::_1);
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio, cb_val);
efl::ui::Radio radio2(instantiate, win);
radio2.text_set("Radio 2");
radio2.state_value_set(2);
- radio2.group_add(group);
efl::ui::Image ic2(instantiate, win);
ic2.icon_set("file");
@@ -49,14 +48,12 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
efl::ui::Radio radio3(instantiate, win);
radio3.text_set("Radio 3");
radio3.state_value_set(3);
- radio3.group_add(group);
bx.pack_end(radio3);
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio3, cb_val);
efl::ui::Radio radio4(instantiate, win);
radio4.text_set("Radio 4");
radio4.state_value_set(4);
- radio4.group_add(group);
bx.pack_end(radio4);
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio4, cb_val);
}
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index c364595260..6509423f05 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -4,10 +4,6 @@
#include <Efl_Config.h>
#include <Elementary_Options.h>
-/* FIXME: wtf? */
-#ifndef EFL_UI_RADIO_EVENT_CHANGED
-# define EFL_UI_RADIO_EVENT_CHANGED EFL_UI_NSTATE_EVENT_CHANGED
-#endif
/* Standard headers for standard system calls etc. */
#include <stdio.h>
#include <stdlib.h>
diff --git a/src/lib/elementary/Elementary.h b/src/lib/elementary/Elementary.h
index 8db5fd9fe2..2a2d986ab3 100644
--- a/src/lib/elementary/Elementary.h
+++ b/src/lib/elementary/Elementary.h
@@ -147,10 +147,6 @@ EAPI extern Elm_Version *elm_version;
#include <elm_focus.h>
#include <Efl.h>
-/* FIXME: wtf? */
-#ifndef EFL_UI_RADIO_EVENT_CHANGED
-# define EFL_UI_RADIO_EVENT_CHANGED EFL_UI_NSTATE_EVENT_CHANGED
-#endif
# include <efl_ui.eot.h>
//define focus manager earlier since focus object and manager is circular
typedef Eo Efl_Ui_Focus_Manager;
diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c
index 7653fe0cba..c38c9fadc7 100644
--- a/src/lib/elementary/efl_ui_radio.c
+++ b/src/lib/elementary/efl_ui_radio.c
@@ -123,21 +123,27 @@ _activate(Evas_Object *obj)
{
ELM_RADIO_DATA_GET(obj, sd);
- if (sd->group->value == sd->value) return;
-
- if ((!_elm_config->access_mode) ||
- (_elm_access_2nd_click_timeout(obj)))
+ if (elm_widget_is_legacy(obj))
{
- sd->group->value = sd->value;
- if (sd->group->valuep) *(sd->group->valuep) = sd->group->value;
+ //in legacy, group is handeled by the widget
+ if (sd->group->value == sd->value) return;
- _state_set_all(sd, EINA_TRUE);
+ if ((!_elm_config->access_mode) ||
+ (_elm_access_2nd_click_timeout(obj)))
+ {
+ sd->group->value = sd->value;
+ if (sd->group->valuep) *(sd->group->valuep) = sd->group->value;
- if (_elm_config->access_mode)
- _elm_access_say(E_("State: On"));
- efl_event_callback_legacy_call
- (obj, EFL_UI_RADIO_EVENT_CHANGED, NULL);
+ _state_set_all(sd, EINA_TRUE);
+ if (_elm_config->access_mode)
+ _elm_access_say(E_("State: On"));
+ }
+ }
+ else
+ {
+ //in new API, we just toggle the state of the widget, rest will be automatically handled
+ efl_ui_check_selected_set(obj, !efl_ui_check_selected_get(obj));
}
}
@@ -220,8 +226,11 @@ _efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *pd)
elm_layout_signal_callback_add
(obj, "efl,action,radio,toggle", "*", _radio_on_cb, obj);
- pd->group = calloc(1, sizeof(Group));
- pd->group->radios = eina_list_append(pd->group->radios, obj);
+ if (elm_widget_is_legacy(obj))
+ {
+ pd->group = calloc(1, sizeof(Group));
+ pd->group->radios = eina_list_append(pd->group->radios, obj);
+ }
elm_layout_sizing_eval(obj);
@@ -239,43 +248,24 @@ _efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *pd)
EOLIAN static void
_efl_ui_radio_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *pd)
{
- pd->group->radios = eina_list_remove(pd->group->radios, obj);
- if (!pd->group->radios) free(pd->group);
-
- efl_destructor(efl_super(obj, MY_CLASS));
-}
-
-EOLIAN static void
-_efl_ui_radio_group_add(Eo *obj, Efl_Ui_Radio_Data *sd, Evas_Object *group)
-{
- ELM_RADIO_DATA_GET(group, sdg);
-
- if (!sdg)
- {
- if (eina_list_count(sd->group->radios) == 1) return;
- sd->group->radios = eina_list_remove(sd->group->radios, obj);
- sd->group = calloc(1, sizeof(Group));
- sd->group->radios = eina_list_append(sd->group->radios, obj);
- }
- else if (sd->group == sdg->group)
- return;
- else
+ if (elm_widget_is_legacy(obj))
{
- sd->group->radios = eina_list_remove(sd->group->radios, obj);
- if (!sd->group->radios) free(sd->group);
- sd->group = sdg->group;
- sd->group->radios = eina_list_append(sd->group->radios, obj);
+ pd->group->radios = eina_list_remove(pd->group->radios, obj);
+ if (!pd->group->radios) free(pd->group);
}
- if (sd->value == sd->group->value) efl_ui_check_selected_set(obj, EINA_TRUE);
- else efl_ui_check_selected_set(obj, EINA_FALSE);
+
+ efl_destructor(efl_super(obj, MY_CLASS));
}
EOLIAN static void
_efl_ui_radio_state_value_set(Eo *obj, Efl_Ui_Radio_Data *sd, int value)
{
sd->value = value;
- if (sd->value == sd->group->value) efl_ui_check_selected_set(obj, EINA_TRUE);
- else efl_ui_check_selected_set(obj, EINA_FALSE);
+ if (elm_widget_is_legacy(obj))
+ {
+ if (sd->value == sd->group->value) efl_ui_check_selected_set(obj, EINA_TRUE);
+ else efl_ui_check_selected_set(obj, EINA_FALSE);
+ }
}
EOLIAN static int
@@ -284,52 +274,6 @@ _efl_ui_radio_state_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
return sd->value;
}
-EOLIAN static void
-_efl_ui_radio_group_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int value)
-{
- if (value == sd->group->value) return;
- sd->group->value = value;
- if (sd->group->valuep) *(sd->group->valuep) = sd->group->value;
- _state_set_all(sd, EINA_FALSE);
-}
-
-EOLIAN static int
-_efl_ui_radio_group_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
-{
- return sd->group->value;
-}
-
-EOLIAN static void
-_efl_ui_radio_value_pointer_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int *valuep)
-{
- if (valuep)
- {
- sd->group->valuep = valuep;
- if (*(sd->group->valuep) != sd->group->value)
- {
- sd->group->value = *(sd->group->valuep);
- _state_set_all(sd, EINA_FALSE);
- }
- }
- else sd->group->valuep = NULL;
-}
-
-EOLIAN static Evas_Object*
-_efl_ui_radio_selected_object_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
-{
- Eina_List *l;
- Evas_Object *child;
-
- EINA_LIST_FOREACH(sd->group->radios, l, child)
- {
- ELM_RADIO_DATA_GET(child, sdc);
-
- if (sdc->value == sd->group->value) return child;
- }
-
- return NULL;
-}
-
EOLIAN static Eina_Bool
_efl_ui_radio_efl_ui_widget_on_access_activate(Eo *obj, Efl_Ui_Radio_Data *_pd EINA_UNUSED, Efl_Ui_Activate act)
{
@@ -486,13 +430,86 @@ elm_radio_add(Evas_Object *parent)
EAPI void
elm_radio_value_set(Evas_Object *obj, int value)
{
- efl_ui_radio_group_value_set(obj, value);
+ EINA_SAFETY_ON_FALSE_RETURN(elm_widget_is_legacy(obj));
+ ELM_RADIO_DATA_GET(obj, sd);
+
+ if (value == sd->group->value) return;
+ sd->group->value = value;
+ if (sd->group->valuep) *(sd->group->valuep) = sd->group->value;
+ _state_set_all(sd, EINA_FALSE);
}
EAPI int
elm_radio_value_get(const Evas_Object *obj)
{
- return efl_ui_radio_group_value_get(obj);
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(elm_widget_is_legacy(obj), 0);
+ ELM_RADIO_DATA_GET(obj, sd);
+ return sd->group->value;
+}
+
+EAPI void
+elm_radio_value_pointer_set(Efl_Ui_Radio *obj, int *valuep)
+{
+ EINA_SAFETY_ON_FALSE_RETURN(elm_widget_is_legacy(obj));
+ ELM_RADIO_DATA_GET(obj, sd);
+
+ if (valuep)
+ {
+ sd->group->valuep = valuep;
+ if (*(sd->group->valuep) != sd->group->value)
+ {
+ sd->group->value = *(sd->group->valuep);
+ _state_set_all(sd, EINA_FALSE);
+ }
+ }
+ else sd->group->valuep = NULL;
+}
+
+EAPI Efl_Canvas_Object *
+elm_radio_selected_object_get(const Efl_Ui_Radio *obj)
+{
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(elm_widget_is_legacy(obj), NULL);
+ ELM_RADIO_DATA_GET(obj, sd);
+
+ Eina_List *l;
+ Evas_Object *child;
+
+ EINA_LIST_FOREACH(sd->group->radios, l, child)
+ {
+ ELM_RADIO_DATA_GET(child, sdc);
+
+ if (sdc->value == sd->group->value) return child;
+ }
+
+ return NULL;
+}
+
+EAPI void
+elm_radio_group_add(Efl_Ui_Radio *obj, Efl_Ui_Radio *group)
+{
+ EINA_SAFETY_ON_FALSE_RETURN(elm_widget_is_legacy(obj));
+ EINA_SAFETY_ON_FALSE_RETURN(elm_widget_is_legacy(group));
+ ELM_RADIO_DATA_GET(group, sdg);
+ ELM_RADIO_DATA_GET(obj, sd);
+
+ if (!sdg)
+ {
+ if (eina_list_count(sd->group->radios) == 1) return;
+ sd->group->radios = eina_list_remove(sd->group->radios, obj);
+ sd->group = calloc(1, sizeof(Group));
+ sd->group->radios = eina_list_append(sd->group->radios, obj);
+ }
+ else if (sd->group == sdg->group)
+ return;
+ else
+ {
+ sd->group->radios = eina_list_remove(sd->group->radios, obj);
+ if (!sd->group->radios) free(sd->group);
+ sd->group = sdg->group;
+ sd->group->radios = eina_list_append(sd->group->radios, obj);
+ }
+ if (sd->value == sd->group->value) efl_ui_check_selected_set(obj, EINA_TRUE);
+ else efl_ui_check_selected_set(obj, EINA_FALSE);
}
#include "efl_ui_radio_legacy_eo.c"
diff --git a/src/lib/elementary/efl_ui_radio_eo.legacy.c b/src/lib/elementary/efl_ui_radio_eo.legacy.c
index 69b23653ed..8e9a4dd06f 100644
--- a/src/lib/elementary/efl_ui_radio_eo.legacy.c
+++ b/src/lib/elementary/efl_ui_radio_eo.legacy.c
@@ -10,21 +10,3 @@ elm_radio_state_value_get(const Efl_Ui_Radio *obj)
{
return efl_ui_radio_state_value_get(obj);
}
-
-EAPI void
-elm_radio_value_pointer_set(Efl_Ui_Radio *obj, int *valuep)
-{
- efl_ui_radio_value_pointer_set(obj, valuep);
-}
-
-EAPI Efl_Canvas_Object *
-elm_radio_selected_object_get(const Efl_Ui_Radio *obj)
-{
- return efl_ui_radio_selected_object_get(obj);
-}
-
-EAPI void
-elm_radio_group_add(Efl_Ui_Radio *obj, Efl_Ui_Radio *group)
-{
- efl_ui_radio_group_add(obj, group);
-}
diff --git a/src/lib/elementary/efl_ui_radio_private.h b/src/lib/elementary/efl_ui_radio_private.h
index a59ea0c48d..f60c28ec24 100644
--- a/src/lib/elementary/efl_ui_radio_private.h
+++ b/src/lib/elementary/efl_ui_radio_private.h
@@ -37,8 +37,6 @@ struct _Efl_Ui_Radio_Data
{
int value;
Group *group;
-
- Eina_Bool state : 1;
};
/**
diff --git a/src/lib/elementary/elm_check.h b/src/lib/elementary/elm_check.h
index 492494a2f8..9cddb69c15 100644
--- a/src/lib/elementary/elm_check.h
+++ b/src/lib/elementary/elm_check.h
@@ -58,9 +58,6 @@
*
* @{
*/
-
-#define EFL_UI_CHECK_EVENT_CHANGED EFL_UI_NSTATE_EVENT_CHANGED
-
#ifndef EFL_NOLEGACY_API_SUPPORT
#include "elm_check_legacy.h"
#endif
diff --git a/src/lib/elementary/elm_dayselector.c b/src/lib/elementary/elm_dayselector.c
index 781ee0c868..d01495219c 100644
--- a/src/lib/elementary/elm_dayselector.c
+++ b/src/lib/elementary/elm_dayselector.c
@@ -204,11 +204,11 @@ _item_signal_emit_cb(void *data,
}
static void
-_item_clicked_cb(void *data, const Efl_Event *event EINA_UNUSED)
+_item_clicked_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Elm_Dayselector_Item_Data *it = data;
- efl_event_callback_legacy_call(WIDGET(it), EFL_UI_CHECK_EVENT_CHANGED, (void *)it->day);
+ evas_object_smart_callback_call(WIDGET(it), "changed", event_info);
}
static Elm_Dayselector_Item_Data *
@@ -295,8 +295,7 @@ _elm_dayselector_content_set(Eo *obj, Elm_Dayselector_Data *sd, const char *item
snprintf(buf, sizeof(buf), "day%d,visible", _item_location_get(sd, it));
elm_layout_signal_emit(obj, buf, "elm");
- efl_event_callback_add
- (VIEW(it), EFL_UI_CHECK_EVENT_CHANGED, _item_clicked_cb, it);
+ evas_object_smart_callback_add(VIEW(it), "changed", _item_clicked_cb, it);
evas_object_event_callback_add
(VIEW(it), EVAS_CALLBACK_DEL, _item_del_cb, obj);
@@ -342,7 +341,7 @@ _elm_dayselector_content_unset(Eo *obj, Elm_Dayselector_Data *sd, const char *it
if (!content) return NULL;
sd->items = eina_list_remove(sd->items, it);
- efl_event_callback_del(content, EFL_UI_CHECK_EVENT_CHANGED, _item_clicked_cb, it);
+ evas_object_smart_callback_del_full(content, "changed", _item_clicked_cb, it);
evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _item_del_cb);
elm_object_signal_callback_del
diff --git a/src/modules/elementary/prefs/elm_check.c b/src/modules/elementary/prefs/elm_check.c
index c191d7dc03..997bb459c8 100644
--- a/src/modules/elementary/prefs/elm_check.c
+++ b/src/modules/elementary/prefs/elm_check.c
@@ -7,11 +7,11 @@ static Elm_Prefs_Item_Type supported_types[] =
};
static void
-_item_changed_cb(void *data, const Efl_Event *event)
+_item_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
{
Elm_Prefs_Item_Changed_Cb prefs_it_changed_cb = data;
- prefs_it_changed_cb(event->object);
+ prefs_it_changed_cb(obj);
}
static Evas_Object *
@@ -23,8 +23,7 @@ elm_prefs_check_add(const Elm_Prefs_Item_Iface *iface EINA_UNUSED,
{
Evas_Object *obj = elm_check_add(prefs);
- efl_event_callback_add
- (obj, EFL_UI_CHECK_EVENT_CHANGED, _item_changed_cb, cb);
+ evas_object_smart_callback_add(obj, "changed", _item_changed_cb, cb);
elm_check_state_set(obj, spec.b.def);
return obj;