From 225b70465158e4886d0150ece63190823c6a92d4 Mon Sep 17 00:00:00 2001 From: Amitesh Singh Date: Thu, 2 Nov 2017 17:26:12 +0900 Subject: [PATCH] Efl.Ui.Radio: remove value{} api Efl.Ui.Nstate already implements value{}. @fix --- src/bin/elementary/test_bg.c | 4 ++-- src/bin/elementary/test_panes.c | 8 ++++---- src/bin/elementary/test_photocam.c | 2 +- src/lib/elementary/efl_ui_radio.c | 32 +++++++++++++++++++++++--------- src/lib/elementary/efl_ui_radio.eo | 17 +---------------- src/lib/elementary/elm_radio_legacy.h | 23 ++++++++++++++++++++++- 6 files changed, 53 insertions(+), 33 deletions(-) diff --git a/src/bin/elementary/test_bg.c b/src/bin/elementary/test_bg.c index b8fde19..53c05ae 100644 --- a/src/bin/elementary/test_bg.c +++ b/src/bin/elementary/test_bg.c @@ -374,7 +374,7 @@ _cb_radio_changed_scale_type(void *data, const Efl_Event *ev) { Evas_Object *o_bg = data; - efl_ui_image_scale_type_set(o_bg, efl_ui_radio_value_get(ev->object)); + efl_ui_image_scale_type_set(o_bg, efl_ui_nstate_value_get(ev->object)); } static void @@ -464,7 +464,7 @@ test_bg_scale_type(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e 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_value_set(rdg, EFL_UI_IMAGE_SCALE_TYPE_FILL); + efl_ui_nstate_value_set(rdg, EFL_UI_IMAGE_SCALE_TYPE_FILL); efl_add(EFL_UI_CHECK_CLASS, hbox, efl_text_set(efl_added, "Bg Color"), diff --git a/src/bin/elementary/test_panes.c b/src/bin/elementary/test_panes.c index a4d6894..bb4e7ff 100644 --- a/src/bin/elementary/test_panes.c +++ b/src/bin/elementary/test_panes.c @@ -123,24 +123,24 @@ test_panes_minsize(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *e efl_add(EFL_UI_BUTTON_CLASS, win, efl_text_set(efl_added, "Left - user set min size(110,110)"), efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(110, 110)), - efl_content_set(efl_part(panes, "first"), efl_added) + efl_content_set(efl_part(panes, "elm.swallow.left"), efl_added) ); panes_h = efl_add(EFL_UI_PANES_CLASS, win, efl_ui_direction_set(efl_added, EFL_UI_DIR_HORIZONTAL), - efl_content_set(efl_part(panes, "second"), efl_added) + efl_content_set(efl_part(panes, "elm.swallow.right"), efl_added) ); efl_add(EFL_UI_BUTTON_CLASS, win, efl_text_set(efl_added, "Up - user set min size(10,0)"), efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(10, 0)), - efl_content_set(efl_part(panes_h, "first"), efl_added) + efl_content_set(efl_part(panes_h, "elm.swallow.left"), efl_added) ); efl_ui_panes_part_hint_min_allow_set(efl_part(panes_h, "first"), EINA_TRUE); efl_add(EFL_UI_BUTTON_CLASS, win, efl_text_set(efl_added, "Down - min size 50 40"), efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(50, 40)), - efl_content_set(efl_part(panes_h, "second"), efl_added) + efl_content_set(efl_part(panes_h, "elm.swallow.right"), efl_added) ); efl_gfx_size_set(win, EINA_SIZE2D(320, 400)); diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c index 162834e..58e34e1 100644 --- a/src/bin/elementary/test_photocam.c +++ b/src/bin/elementary/test_photocam.c @@ -653,7 +653,7 @@ static const struct { static void _radio_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { - unsigned char index = efl_ui_radio_value_get(obj); + unsigned char index = efl_ui_nstate_value_get(obj); efl_ui_image_icon_set(data, photocam_icons[index].name); printf("icon is %s\n", efl_ui_image_icon_get(data)); } diff --git a/src/lib/elementary/efl_ui_radio.c b/src/lib/elementary/efl_ui_radio.c index c2edeb7..89d0578 100644 --- a/src/lib/elementary/efl_ui_radio.c +++ b/src/lib/elementary/efl_ui_radio.c @@ -202,13 +202,6 @@ _access_state_cb(void *data EINA_UNUSED, Evas_Object *obj) return strdup(E_("State: Off")); } -EAPI Evas_Object * -elm_radio_add(Evas_Object *parent) -{ - EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); - return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); -} - EOLIAN static Eo * _efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *pd) { @@ -288,7 +281,7 @@ _efl_ui_radio_state_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd) } EOLIAN static void -_efl_ui_radio_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int value) +_efl_ui_radio_efl_ui_nstate_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int value) { if (value == sd->group->value) return; sd->group->value = value; @@ -297,7 +290,7 @@ _efl_ui_radio_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int value) } EOLIAN static int -_efl_ui_radio_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd) +_efl_ui_radio_efl_ui_nstate_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd) { return sd->group->value; } @@ -384,3 +377,24 @@ ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX) ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX) #include "efl_ui_radio.eo.c" + +/* Legacy APIs */ + +EAPI Evas_Object * +elm_radio_add(Evas_Object *parent) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL); + return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added)); +} + +EAPI void +elm_radio_value_set(Evas_Object *obj, int value) +{ + efl_ui_nstate_value_set(obj, value); +} + +EAPI int +elm_radio_value_get(const Evas_Object *obj) +{ + return efl_ui_nstate_value_get(obj); +} diff --git a/src/lib/elementary/efl_ui_radio.eo b/src/lib/elementary/efl_ui_radio.eo index d3a3bfd..ff3f575 100644 --- a/src/lib/elementary/efl_ui_radio.eo +++ b/src/lib/elementary/efl_ui_radio.eo @@ -20,22 +20,6 @@ class Efl.Ui.Radio (Efl.Ui.Check, Elm.Interface.Atspi_Widget_Action) value: int; [[The value to use if this radio object is selected]] } } - @property value { - set { - [[Set the value of the radio group. - - This sets the value of the radio group and will also set the - value if pointed to, to the value supplied, but will not call - any callbacks. - ]] - } - get { - [[Get the value of the radio group]] - } - values { - value: int; [[The value to use for the group]] - } - } @property value_pointer { set { [[Set a convenience pointer to a integer to change when radio group @@ -83,6 +67,7 @@ class Efl.Ui.Radio (Efl.Ui.Check, Elm.Interface.Atspi_Widget_Action) Elm.Widget.widget_event; Efl.Access.state_set { get; } Elm.Interface.Atspi_Widget_Action.elm_actions { get; } + Efl.Ui.Nstate.value { set; get; } } events { changed; [[Called when radio changed]] diff --git a/src/lib/elementary/elm_radio_legacy.h b/src/lib/elementary/elm_radio_legacy.h index 67aa018..b9a58db 100644 --- a/src/lib/elementary/elm_radio_legacy.h +++ b/src/lib/elementary/elm_radio_legacy.h @@ -8,4 +8,25 @@ */ EAPI Evas_Object *elm_radio_add(Evas_Object *parent); -#include "efl_ui_radio.eo.legacy.h" \ No newline at end of file +/** + * @brief Set the value of the radio group. + * + * This sets the value of the radio group and will also set the value if + * pointed to, to the value supplied, but will not call any callbacks. + * + * @param[in] value The value to use for the group + * + * @ingroup Elm_Radio + */ +EAPI void elm_radio_value_set(Evas_Object *obj, int value); + +/** + * @brief Get the value of the radio group + * + * @return The value to use for the group + * + * @ingroup Elm_Radio + */ +EAPI int elm_radio_value_get(const Efl_Ui_Radio *obj); + +#include "efl_ui_radio.eo.legacy.h" -- 2.7.4