efl_ui_check: make it undependend of nstate
Summary: check can only display 2 states, and is only designed to do so. Additionally, nstate inherits from button, which brings in autorepeat, which is hileriously broken on check and cannot really work. Right now there is not even support in the theme for clickable. So its a good idea to get rid of this for now IMO. ref T7865 Reviewers: stefan_schmidt, zmike, segfaultxavi, akanad, YOhoho Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T7865, T7867 Differential Revision: https://phab.enlightenment.org/D9018
This commit is contained in:
parent
d7fb6f62b4
commit
3a5f506b0e
|
@ -1962,6 +1962,7 @@ tests_elementary_efl_ui_suite_SOURCES = \
|
|||
tests/elementary/efl_ui_test_layout.c \
|
||||
tests/elementary/efl_ui_test_widget.c \
|
||||
tests/elementary/efl_ui_test_active_view.c \
|
||||
tests/elementary/efl_ui_test_check.c \
|
||||
tests/elementary/efl_ui_suite.h \
|
||||
tests/elementary/efl_ui_model.c
|
||||
|
||||
|
|
|
@ -473,7 +473,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_nstate_value_set(rdg, EFL_GFX_IMAGE_SCALE_TYPE_FILL);
|
||||
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"),
|
||||
|
|
|
@ -110,7 +110,7 @@ _create_box_contents(Evas_Object *box)
|
|||
evas_object_data_set(radio, "data", content);
|
||||
}
|
||||
|
||||
efl_ui_nstate_value_set(radio_group, 0);
|
||||
efl_ui_radio_group_value_set(radio_group, 0);
|
||||
|
||||
return radio_group;
|
||||
}
|
||||
|
|
|
@ -654,7 +654,7 @@ static const struct {
|
|||
static void
|
||||
_radio_changed_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
unsigned char index = efl_ui_nstate_value_get(obj);
|
||||
unsigned char index = elm_radio_value_get(obj);
|
||||
efl_ui_image_icon_set(data, photocam_icons[index].name);
|
||||
printf("icon is %s\n", efl_ui_image_icon_get(data));
|
||||
}
|
||||
|
|
|
@ -339,7 +339,7 @@ static void prev_block_check_cb(void *data, const Efl_Event *ev)
|
|||
Eo *pager = data;
|
||||
Eina_Bool prev, next;
|
||||
|
||||
prev = efl_ui_nstate_value_get(ev->object);
|
||||
prev = efl_ui_check_selected_get(ev->object);
|
||||
|
||||
efl_ui_pager_scroll_block_get(pager, NULL, &next);
|
||||
efl_ui_pager_scroll_block_set(pager, prev, next);
|
||||
|
@ -350,7 +350,7 @@ static void next_block_check_cb(void *data, const Efl_Event *ev)
|
|||
Eo *pager = data;
|
||||
Eina_Bool prev, next;
|
||||
|
||||
next = efl_ui_nstate_value_get(ev->object);
|
||||
next = efl_ui_check_selected_get(ev->object);
|
||||
|
||||
efl_ui_pager_scroll_block_get(pager, &prev, NULL);
|
||||
efl_ui_pager_scroll_block_set(pager, prev, next);
|
||||
|
@ -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_nstate_value_get(ev->object);
|
||||
int state = efl_ui_radio_group_value_get(ev->object);
|
||||
|
||||
efl_ui_pager_loop_mode_set(pager, state);
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ static void scroll_block_cb(void *data,
|
|||
efl_add(EFL_UI_CHECK_CLASS, box,
|
||||
efl_ui_widget_style_set(efl_added, "toggle"),
|
||||
efl_text_set(efl_added, "Prev Block"),
|
||||
efl_ui_nstate_value_set(efl_added, prev),
|
||||
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));
|
||||
|
@ -804,7 +804,7 @@ static void scroll_block_cb(void *data,
|
|||
efl_add(EFL_UI_CHECK_CLASS, box,
|
||||
efl_ui_widget_style_set(efl_added, "toggle"),
|
||||
efl_text_set(efl_added, "Next Block"),
|
||||
efl_ui_nstate_value_set(efl_added, next),
|
||||
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));
|
||||
|
@ -849,7 +849,7 @@ static void loop_cb(void *data EINA_UNUSED,
|
|||
|
||||
loop = efl_ui_pager_loop_mode_get(pager);
|
||||
|
||||
efl_ui_nstate_value_set(rd, loop);
|
||||
efl_ui_radio_group_value_set(rd, loop);
|
||||
|
||||
if (loop == EFL_UI_PAGER_LOOP_DISABLED)
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ test_ui_panel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
|
|||
static void
|
||||
_check_changed(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||
{
|
||||
elm_config_scroll_thumbscroll_enabled_set(efl_ui_nstate_value_get(ev->object));
|
||||
elm_config_scroll_thumbscroll_enabled_set(efl_ui_check_selected_get(ev->object));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -76,7 +76,7 @@ _panel_toggled(void *data, const Efl_Event *ev)
|
|||
Evas_Object *list;
|
||||
int i;
|
||||
|
||||
if (!efl_ui_nstate_value_get(data)) return;
|
||||
if (!efl_ui_check_selected_get(data)) return;
|
||||
|
||||
list = efl_content_get(ev->object);
|
||||
evas_object_del(list);
|
||||
|
|
|
@ -491,7 +491,7 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|||
cur = efl_ui_active_view_active_index_get(tcd->tab_pager);
|
||||
tab_page = efl_pack_content_get(tcd->tab_pager, cur);
|
||||
|
||||
if (efl_ui_nstate_value_get(tcd->label_check))
|
||||
if (efl_ui_check_selected_get(tcd->label_check))
|
||||
{
|
||||
label = tab_label_get();
|
||||
efl_text_set(efl_part(tab_page, "tab"), label);
|
||||
|
@ -499,7 +499,7 @@ _change_btn_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|||
efl_content_set(tab_page, content);
|
||||
}
|
||||
|
||||
if (efl_ui_nstate_value_get(tcd->icon_check))
|
||||
if (efl_ui_check_selected_get(tcd->icon_check))
|
||||
{
|
||||
icon = tab_icon_get();
|
||||
efl_ui_tab_page_part_tab_icon_set(efl_part(tab_page, "tab"), icon);
|
||||
|
@ -534,12 +534,12 @@ _tab_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|||
|
||||
label_check = efl_add(EFL_UI_CHECK_CLASS, box,
|
||||
efl_text_set(efl_added, "Tab Label + Page"),
|
||||
efl_ui_nstate_value_set(efl_added, EINA_FALSE),
|
||||
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_nstate_value_set(efl_added, EINA_FALSE),
|
||||
efl_ui_check_selected_set(efl_added, EINA_FALSE),
|
||||
efl_pack_end(box, efl_added));
|
||||
|
||||
tcd->tab_pager = tab_pager;
|
||||
|
|
|
@ -31,7 +31,7 @@ efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|||
bx.pack_end(radio);
|
||||
|
||||
auto cb_val = std::bind([] (efl::ui::Radio &obj)
|
||||
{ std::cout << "val is now: " << obj.value_get() << std::endl; },
|
||||
{ std::cout << "val is now: " << obj.group_value_get() << std::endl; },
|
||||
std::placeholders::_1);
|
||||
efl::eolian::event_add(efl::ui::Nstate::changed_event, radio, cb_val);
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@
|
|||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
#include "efl_ui_nstate.eo.h"
|
||||
#include "efl_ui_check_private.h"
|
||||
#include "efl_ui_nstate_private.h"
|
||||
#include "elm_part_helper.h"
|
||||
|
||||
#define MY_CLASS EFL_UI_CHECK_CLASS
|
||||
|
@ -28,6 +26,12 @@ static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
||||
{
|
||||
{"icon", "elm.swallow.content"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static const char SIG_CHANGED[] = "changed";
|
||||
|
||||
/* smart callbacks coming from elm check objects: */
|
||||
|
@ -50,26 +54,21 @@ static const Elm_Action key_actions[] = {
|
|||
static void
|
||||
_activate(Evas_Object *obj)
|
||||
{
|
||||
EFL_UI_CHECK_DATA_GET(obj, sd);
|
||||
|
||||
if (sd->statep) *sd->statep = !efl_ui_nstate_value_get(obj);
|
||||
|
||||
// state will be changed to 1 by efl_ui_nstate_activate(obj)
|
||||
if (efl_ui_nstate_value_get(obj) == 0)
|
||||
// state will be changed by the later call to the selected_set call
|
||||
if (!efl_ui_check_selected_get(obj))
|
||||
{
|
||||
// FIXME: to do animation during state change , we need different signal
|
||||
// so that we can distinguish between state change by user or state change
|
||||
// by calling state_change() api. Keep both the signal for backward compatibility
|
||||
// and remove "elm,state,check,on" signal emission when we can break ABI.
|
||||
// efl_ui_check_selected_set below will emit "elm,state,check,*" or "efl,state,check,*"
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,activate,check,on", "elm");
|
||||
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_layout_signal_emit(obj, "efl,activate,check,on", "efl");
|
||||
elm_layout_signal_emit(obj, "efl,state,check,on", "efl");
|
||||
}
|
||||
|
||||
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
||||
|
@ -81,27 +80,28 @@ _activate(Evas_Object *obj)
|
|||
// so that we can distinguish between state change by user or state change
|
||||
// by calling state_change() api. Keep both the signal for backward compatibility
|
||||
// and remove "elm,state,check,off" signal emission when we can break ABI.
|
||||
// efl_ui_check_selected_set below will emit "elm,state,check,*" or "efl,state,check,*"
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
elm_layout_signal_emit(obj, "elm,activate,check,off", "elm");
|
||||
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_layout_signal_emit(obj, "efl,activate,check,off", "efl");
|
||||
elm_layout_signal_emit(obj, "efl,state,check,off", "efl");
|
||||
}
|
||||
|
||||
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
||||
_elm_access_say(E_("State: Off"));
|
||||
}
|
||||
|
||||
efl_ui_nstate_activate(obj);
|
||||
//This commit will update the theme with the correct signals
|
||||
// "elm,state,check,on" or "elm,state,check,off" for legacy
|
||||
// "efl,state,check,on" or "efl,state,check,off" for eo-api
|
||||
efl_ui_check_selected_set(obj, !efl_ui_check_selected_get(obj));
|
||||
|
||||
if (_elm_config->atspi_mode)
|
||||
efl_access_state_changed_signal_emit(obj,
|
||||
EFL_ACCESS_STATE_TYPE_CHECKED,
|
||||
efl_ui_nstate_value_get(obj));
|
||||
efl_ui_check_selected_get(obj));
|
||||
}
|
||||
|
||||
EOLIAN static Efl_Access_State_Set
|
||||
|
@ -147,14 +147,14 @@ _efl_ui_check_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Check_Data *sd EINA_UNUS
|
|||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (efl_ui_nstate_value_get(obj) == 0)
|
||||
if (!efl_ui_check_selected_get(obj))
|
||||
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (efl_ui_nstate_value_get(obj) == 0)
|
||||
if (!efl_ui_check_selected_get(obj))
|
||||
elm_layout_signal_emit(obj, "efl,state,check,off", "efl");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "efl,state,check,on", "efl");
|
||||
|
@ -185,7 +185,7 @@ _access_state_cb(void *data, Evas_Object *obj)
|
|||
|
||||
if (elm_widget_disabled_get(obj))
|
||||
return strdup(E_("State: Disabled"));
|
||||
if (efl_ui_nstate_value_get(obj))
|
||||
if (efl_ui_check_selected_get(obj))
|
||||
{
|
||||
on_text = elm_layout_text_get(data, "on");
|
||||
|
||||
|
@ -212,6 +212,17 @@ _access_state_cb(void *data, Evas_Object *obj)
|
|||
return strdup(E_("State: Off"));
|
||||
}
|
||||
|
||||
static void
|
||||
_flush_selected(Eo *obj, Eina_Bool sel)
|
||||
{
|
||||
efl_ui_check_selected_set(obj, sel);
|
||||
|
||||
if (_elm_config->atspi_mode)
|
||||
efl_access_state_changed_signal_emit(obj,
|
||||
EFL_ACCESS_STATE_TYPE_CHECKED,
|
||||
efl_ui_check_selected_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
_on_check_off(void *data,
|
||||
Evas_Object *o EINA_UNUSED,
|
||||
|
@ -220,21 +231,7 @@ _on_check_off(void *data,
|
|||
{
|
||||
Evas_Object *obj = data;
|
||||
|
||||
EFL_UI_CHECK_DATA_GET(obj, sd);
|
||||
|
||||
if (sd->statep) *sd->statep = 0;
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "efl,state,check,off", "efl");
|
||||
|
||||
efl_ui_nstate_value_set(obj, 0);
|
||||
|
||||
if (_elm_config->atspi_mode)
|
||||
efl_access_state_changed_signal_emit(data,
|
||||
EFL_ACCESS_STATE_TYPE_CHECKED,
|
||||
efl_ui_nstate_value_get(obj));
|
||||
_flush_selected(obj, EINA_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -245,21 +242,7 @@ _on_check_on(void *data,
|
|||
{
|
||||
Evas_Object *obj = data;
|
||||
|
||||
EFL_UI_CHECK_DATA_GET(obj, sd);
|
||||
|
||||
if (sd->statep) *sd->statep = 1;
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "efl,state,check,on", "efl");
|
||||
|
||||
efl_ui_nstate_value_set(obj, 1);
|
||||
|
||||
if (_elm_config->atspi_mode)
|
||||
efl_access_state_changed_signal_emit(data,
|
||||
EFL_ACCESS_STATE_TYPE_CHECKED,
|
||||
efl_ui_nstate_value_get(obj));
|
||||
_flush_selected(obj, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -272,17 +255,23 @@ _on_check_toggle(void *data,
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_ui_check_selected_get(const Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
||||
_efl_ui_check_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
||||
{
|
||||
return !!efl_ui_nstate_value_get(obj);
|
||||
return pd->selected;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_check_selected_set(Eo *obj, Efl_Ui_Check_Data *sd, Eina_Bool value)
|
||||
_efl_ui_check_selected_set(Eo *obj, Efl_Ui_Check_Data *pd, Eina_Bool value)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
|
||||
if (sd->statep) *sd->statep = value;
|
||||
if (pd->selected == value) return;
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (pd->statep)
|
||||
*pd->statep = value;
|
||||
}
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
|
@ -301,16 +290,12 @@ _efl_ui_check_selected_set(Eo *obj, Efl_Ui_Check_Data *sd, Eina_Bool value)
|
|||
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
|
||||
efl_ui_nstate_value_set(obj, value);
|
||||
}
|
||||
pd->selected = value;
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_check_efl_ui_nstate_value_set(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED, int state)
|
||||
{
|
||||
Eina_Bool _state = !!state;
|
||||
if (_state == efl_ui_nstate_value_get(obj)) return;
|
||||
|
||||
efl_ui_nstate_value_set(efl_super(obj, MY_CLASS), _state);
|
||||
if (elm_widget_is_legacy(obj))
|
||||
evas_object_smart_callback_call(obj, "changed", NULL);
|
||||
else
|
||||
efl_event_callback_call(obj, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, &pd->selected);
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
|
@ -360,43 +345,21 @@ EAPI void
|
|||
elm_check_state_set(Evas_Object *obj, Eina_Bool state)
|
||||
{
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
||||
EFL_UI_NSTATE_DATA_GET_OR_RETURN(obj, nd);
|
||||
EFL_UI_CHECK_DATA_GET_OR_RETURN(obj, sd);
|
||||
|
||||
if (state != nd->state)
|
||||
{
|
||||
nd->state = state;
|
||||
if (sd->statep) *sd->statep = state;
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (state == 1)
|
||||
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state == 1)
|
||||
elm_layout_signal_emit(obj, "efl,state,check,on", "efl");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "efl,state,check,off", "efl");
|
||||
}
|
||||
edje_object_message_signal_process(wd->resize_obj);
|
||||
}
|
||||
efl_ui_check_selected_set(obj, state);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_check_state_get(const Evas_Object *obj)
|
||||
{
|
||||
return !!efl_ui_nstate_value_get(obj);
|
||||
return !!efl_ui_check_selected_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_check_state_pointer_set(Eo *obj, Eina_Bool *statep)
|
||||
{
|
||||
EFL_UI_CHECK_DATA_GET_OR_RETURN(obj, sd);
|
||||
EFL_UI_NSTATE_DATA_GET_OR_RETURN(obj, nd);
|
||||
|
||||
if (!statep)
|
||||
{
|
||||
|
@ -405,24 +368,9 @@ elm_check_state_pointer_set(Eo *obj, Eina_Bool *statep)
|
|||
}
|
||||
|
||||
sd->statep = statep;
|
||||
if (*sd->statep != nd->state)
|
||||
if (*sd->statep != sd->selected)
|
||||
{
|
||||
nd->state = *sd->statep;
|
||||
|
||||
if (elm_widget_is_legacy(obj))
|
||||
{
|
||||
if (nd->state == 1)
|
||||
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nd->state == 1)
|
||||
elm_layout_signal_emit(obj, "efl,state,check,on", "efl");
|
||||
else
|
||||
elm_layout_signal_emit(obj, "efl,state,check,off", "efl");
|
||||
}
|
||||
efl_ui_check_selected_set(obj, *sd->statep);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,14 +387,19 @@ _efl_ui_check_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED
|
|||
/* Standard widget overrides */
|
||||
|
||||
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data)
|
||||
ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data)
|
||||
ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data)
|
||||
ELM_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
||||
|
||||
/* Internal EO APIs and hidden overrides */
|
||||
|
||||
ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
||||
|
||||
#define EFL_UI_CHECK_EXTRA_OPS \
|
||||
ELM_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
|
||||
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX)
|
||||
|
||||
|
||||
#include "efl_ui_check.eo.c"
|
||||
#include "efl_ui_check_eo.legacy.c"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class @beta Efl.Ui.Check extends Efl.Ui.Nstate implements Efl.Access.Widget.Action
|
||||
class @beta Efl.Ui.Check extends Efl.Ui.Layout_Base implements Efl.Access.Widget.Action, Efl.Text, Efl.Content
|
||||
{
|
||||
[[Check widget
|
||||
|
||||
|
@ -24,8 +24,14 @@ class @beta Efl.Ui.Check extends Efl.Ui.Nstate implements Efl.Access.Widget.Acti
|
|||
Efl.Ui.Widget.on_access_activate;
|
||||
Efl.Ui.Widget.theme_apply;
|
||||
Efl.Ui.Widget.widget_input_event_handler;
|
||||
Efl.Ui.Nstate.value { set; }
|
||||
Efl.Access.Object.state_set { get; }
|
||||
Efl.Access.Widget.Action.elm_actions { get; }
|
||||
Efl.Content.content { get; set; }
|
||||
Efl.Content.content_unset;
|
||||
Efl.Text.text { get; set; }
|
||||
Efl.Ui.L10n.l10n_text { get; set; }
|
||||
}
|
||||
events {
|
||||
selected,changed : bool; [[Emitted each time selected has changed]]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ typedef struct _Efl_Ui_Check_Data Efl_Ui_Check_Data;
|
|||
struct _Efl_Ui_Check_Data
|
||||
{
|
||||
Eina_Bool *statep;
|
||||
Eina_Bool selected;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -286,7 +286,7 @@ _efl_ui_radio_state_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_radio_efl_ui_nstate_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int value)
|
||||
_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;
|
||||
|
@ -295,7 +295,7 @@ _efl_ui_radio_efl_ui_nstate_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd
|
|||
}
|
||||
|
||||
EOLIAN static int
|
||||
_efl_ui_radio_efl_ui_nstate_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
|
||||
_efl_ui_radio_group_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
|
||||
{
|
||||
return sd->group->value;
|
||||
}
|
||||
|
@ -486,13 +486,13 @@ elm_radio_add(Evas_Object *parent)
|
|||
EAPI void
|
||||
elm_radio_value_set(Evas_Object *obj, int value)
|
||||
{
|
||||
efl_ui_nstate_value_set(obj, value);
|
||||
efl_ui_radio_group_value_set(obj, value);
|
||||
}
|
||||
|
||||
EAPI int
|
||||
elm_radio_value_get(const Evas_Object *obj)
|
||||
{
|
||||
return efl_ui_nstate_value_get(obj);
|
||||
return efl_ui_radio_group_value_get(obj);
|
||||
}
|
||||
|
||||
#include "efl_ui_radio_legacy_eo.c"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class @beta Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Action, Efl.Content
|
||||
class @beta Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Action
|
||||
{
|
||||
[[Elementary radio class]]
|
||||
methods {
|
||||
|
@ -56,6 +56,15 @@ class @beta Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Actio
|
|||
to join.]]
|
||||
}
|
||||
}
|
||||
@property group_value {
|
||||
[[Change the value of the group.
|
||||
|
||||
This will enable the radio button in the group that is assosiated with this value. A value which is not assosiated with any radio button will result in every radio button beeing disabled.
|
||||
]]
|
||||
values {
|
||||
value : int; [[The value of the radio button in the group which should be enabled.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
|
@ -65,6 +74,5 @@ class @beta Efl.Ui.Radio extends Efl.Ui.Check implements Efl.Access.Widget.Actio
|
|||
Efl.Ui.Widget.widget_input_event_handler;
|
||||
Efl.Access.Object.state_set { get; }
|
||||
Efl.Access.Widget.Action.elm_actions { get; }
|
||||
Efl.Ui.Nstate.value { set; get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ static const Efl_Test_Case etc[] = {
|
|||
{ "Efl_Ui_Model", efl_ui_model },
|
||||
{ "efl_ui_widget", efl_ui_test_widget },
|
||||
{ "efl_ui_active_view", efl_ui_test_active_view},
|
||||
{ "efl_ui_check", efl_ui_test_check },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
|
@ -30,13 +30,12 @@ void efl_ui_test_image_zoomable(TCase *tc);
|
|||
void efl_ui_test_layout(TCase *tc);
|
||||
void efl_ui_test_image(TCase *tc);
|
||||
void efl_ui_test_callback(TCase *tc);
|
||||
|
||||
void efl_ui_test_focus(TCase *tc);
|
||||
void efl_ui_test_focus_sub(TCase *tc);
|
||||
|
||||
void efl_ui_model(TCase *tc);
|
||||
void efl_ui_test_widget(TCase *tc);
|
||||
void efl_ui_test_active_view(TCase *tc);
|
||||
void efl_ui_test_check(TCase *tc);
|
||||
|
||||
void loop_timer_interval_set(Eo *obj, double in);
|
||||
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#include <Efl_Ui.h>
|
||||
#include "efl_ui_suite.h"
|
||||
|
||||
static Eo *win, *check;
|
||||
|
||||
static void
|
||||
check_setup()
|
||||
{
|
||||
win = win_add();
|
||||
|
||||
check = efl_add(EFL_UI_CHECK_CLASS, win);
|
||||
}
|
||||
|
||||
EFL_START_TEST(check_content)
|
||||
{
|
||||
Eo *t = efl_add(EFL_UI_BUTTON_CLASS, win,
|
||||
efl_text_set(efl_added, "asdf")
|
||||
);
|
||||
efl_content_set(check, t);
|
||||
ck_assert_ptr_eq(efl_content_get(check), t);
|
||||
//TODO verify that signals can be emitted
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(check_text)
|
||||
{
|
||||
efl_text_set(check, "Test the Rest");
|
||||
ck_assert_str_eq(efl_text_get(check), "Test the Rest");
|
||||
//TODO verify that signals can be emitted
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
EFL_START_TEST(check_selection_state)
|
||||
{
|
||||
efl_ui_check_selected_set(check, EINA_TRUE);
|
||||
ck_assert_int_eq(efl_ui_check_selected_get(check), EINA_TRUE);
|
||||
efl_ui_check_selected_set(check, EINA_TRUE);
|
||||
ck_assert_int_eq(efl_ui_check_selected_get(check), EINA_TRUE);
|
||||
//TODO verify that signals can be emitted
|
||||
|
||||
efl_ui_check_selected_set(check, EINA_FALSE);
|
||||
ck_assert_int_eq(efl_ui_check_selected_get(check), EINA_FALSE);
|
||||
efl_ui_check_selected_set(check, EINA_FALSE);
|
||||
ck_assert_int_eq(efl_ui_check_selected_get(check), EINA_FALSE);
|
||||
//TODO verify that signals can be emitted
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
static void
|
||||
_check(void *data, const Efl_Event *ev)
|
||||
{
|
||||
Eina_Bool *flag = data;
|
||||
|
||||
*flag = *((Eina_Bool*)ev->info);
|
||||
}
|
||||
|
||||
EFL_START_TEST(check_selection_events)
|
||||
{
|
||||
Eina_Bool bool_event_info = EINA_FALSE;
|
||||
|
||||
efl_event_callback_add(check, EFL_UI_CHECK_EVENT_SELECTED_CHANGED, _check, &bool_event_info);
|
||||
efl_ui_check_selected_set(check, EINA_TRUE);
|
||||
ck_assert_int_eq(bool_event_info, EINA_TRUE);
|
||||
efl_ui_check_selected_set(check, EINA_FALSE);
|
||||
ck_assert_int_eq(bool_event_info, EINA_FALSE);
|
||||
}
|
||||
EFL_END_TEST
|
||||
|
||||
void efl_ui_test_check(TCase *tc)
|
||||
{
|
||||
tcase_add_checked_fixture(tc, check_setup, NULL);
|
||||
tcase_add_test(tc, check_selection_state);
|
||||
tcase_add_test(tc, check_text);
|
||||
tcase_add_test(tc, check_content);
|
||||
tcase_add_test(tc, check_selection_events);
|
||||
}
|
|
@ -139,6 +139,7 @@ efl_ui_suite_src = [
|
|||
'efl_ui_model.c',
|
||||
'efl_ui_test_widget.c',
|
||||
'efl_ui_test_active_view.c',
|
||||
'efl_ui_test_check.c',
|
||||
]
|
||||
|
||||
efl_ui_suite = executable('efl_ui_suite',
|
||||
|
|
Loading…
Reference in New Issue