2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
|
|
|
#define ELM_INTERFACE_ATSPI_WIDGET_ACTION_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2009-02-24 01:23:51 -08:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2009-02-24 01:23:51 -08:00
|
|
|
#include "elm_priv.h"
|
2017-05-22 02:56:52 -07:00
|
|
|
#include "efl_ui_radio_private.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2009-02-24 01:23:51 -08:00
|
|
|
|
2017-05-22 02:56:52 -07:00
|
|
|
#define MY_CLASS EFL_UI_RADIO_CLASS
|
2017-07-27 23:35:10 -07:00
|
|
|
#define MY_CLASS_PFX efl_ui_radio
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-05-22 02:56:52 -07:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Radio"
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_radio"
|
2012-05-03 15:43:31 -07:00
|
|
|
|
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
{"default", "elm.text"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2012-05-03 15:43:31 -07:00
|
|
|
static const char SIG_CHANGED[] = "changed";
|
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|
|
|
{SIG_CHANGED, ""},
|
2014-01-23 03:07:20 -08:00
|
|
|
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-07 21:05:06 -08:00
|
|
|
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
2014-02-05 23:18:57 -08:00
|
|
|
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
|
|
|
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
|
2012-05-03 15:43:31 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2014-04-14 22:54:58 -07:00
|
|
|
static Eina_Bool _key_action_activate(Evas_Object *obj, const char *params);
|
|
|
|
|
|
|
|
static const Elm_Action key_actions[] = {
|
|
|
|
{"activate", _key_action_activate},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
static void
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
_state_set(Evas_Object *obj, Eina_Bool state, Eina_Bool activate)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
ELM_RADIO_DATA_GET(obj, sd);
|
|
|
|
|
2015-07-29 11:20:20 -07:00
|
|
|
if (state != sd->state)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
sd->state = state;
|
|
|
|
if (sd->state)
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
{
|
|
|
|
// 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 only emit "elm,state,radio,on" when activate is false when we can break ABI.
|
|
|
|
if (activate) elm_layout_signal_emit(obj, "elm,activate,radio,on", "elm");
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,radio,on", "elm");
|
|
|
|
}
|
2011-04-01 04:24:15 -07:00
|
|
|
else
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
{
|
|
|
|
// 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 only emit "elm,state,radio,off"when activate is false when we can break ABI.
|
|
|
|
if (activate) elm_layout_signal_emit(obj, "elm,activate,radio,off", "elm");
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,radio,off", "elm");
|
|
|
|
}
|
2014-10-24 04:32:08 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
{
|
|
|
|
if (sd->state)
|
|
|
|
{
|
|
|
|
elm_interface_atspi_accessible_state_changed_signal_emit(obj, ELM_ATSPI_STATE_CHECKED, EINA_TRUE);
|
|
|
|
}
|
|
|
|
}
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-25 11:50:45 -08:00
|
|
|
static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_state_set_all(Efl_Ui_Radio_Data *sd, Eina_Bool activate)
|
2009-02-25 11:50:45 -08:00
|
|
|
{
|
|
|
|
const Eina_List *l;
|
2012-05-02 18:19:05 -07:00
|
|
|
Eina_Bool disabled = EINA_FALSE;
|
2012-05-03 15:43:31 -07:00
|
|
|
Evas_Object *child, *selected = NULL;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->group->radios, l, child)
|
2009-02-25 11:50:45 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
ELM_RADIO_DATA_GET(child, sdc);
|
|
|
|
|
|
|
|
if (sdc->state) selected = child;
|
|
|
|
if (sdc->value == sd->group->value)
|
2009-08-27 01:09:17 -07:00
|
|
|
{
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
_state_set(child, EINA_TRUE, activate);
|
2012-05-03 15:43:31 -07:00
|
|
|
if (!sdc->state) disabled = EINA_TRUE;
|
2009-08-27 01:09:17 -07:00
|
|
|
}
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
else _state_set(child, EINA_FALSE, activate);
|
2009-02-25 11:50:45 -08:00
|
|
|
}
|
2012-05-03 15:43:31 -07:00
|
|
|
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
if ((disabled) && (selected)) _state_set(selected, 1, activate);
|
2009-02-25 11:50:45 -08:00
|
|
|
}
|
|
|
|
|
2009-02-24 01:23:51 -08:00
|
|
|
static void
|
2010-09-22 10:45:43 -07:00
|
|
|
_activate(Evas_Object *obj)
|
2009-02-24 01:23:51 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
ELM_RADIO_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (sd->group->value == sd->value) return;
|
|
|
|
|
2012-11-26 03:18:04 -08:00
|
|
|
if ((!_elm_config->access_mode) ||
|
2011-09-18 22:22:22 -07:00
|
|
|
(_elm_access_2nd_click_timeout(obj)))
|
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
sd->group->value = sd->value;
|
|
|
|
if (sd->group->valuep) *(sd->group->valuep) = sd->group->value;
|
|
|
|
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
_state_set_all(sd, EINA_TRUE);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2012-11-26 03:18:04 -08:00
|
|
|
if (_elm_config->access_mode)
|
2011-09-18 22:22:22 -07:00
|
|
|
_elm_access_say(E_("State: On"));
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2017-05-22 23:41:17 -07:00
|
|
|
(obj, EFL_UI_RADIO_EVENT_CHANGED, NULL);
|
2015-06-09 06:33:29 -07:00
|
|
|
|
2011-09-18 22:22:22 -07:00
|
|
|
}
|
2010-09-22 10:45:43 -07:00
|
|
|
}
|
|
|
|
|
2014-04-14 22:54:58 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_activate(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_elm_widget_widget_event(Eo *obj, Efl_Ui_Radio_Data *_pd EINA_UNUSED, Evas_Object *src, Evas_Callback_Type type, void *event_info)
|
2010-09-22 10:45:43 -07:00
|
|
|
{
|
2013-10-28 07:06:14 -07:00
|
|
|
(void) src;
|
2014-03-26 00:50:10 -07:00
|
|
|
Evas_Event_Key_Down *ev = event_info;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2015-12-21 04:55:23 -08:00
|
|
|
if (!_elm_config_key_binding_call(obj, MY_CLASS_NAME, ev, key_actions))
|
2014-03-26 00:50:10 -07:00
|
|
|
return EINA_FALSE;
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2013-11-12 16:54:37 -08:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2014-03-26 00:50:10 -07:00
|
|
|
return EINA_TRUE;
|
2010-09-22 10:45:43 -07:00
|
|
|
}
|
|
|
|
|
2016-03-02 22:28:21 -08:00
|
|
|
/* FIXME: replicated from elm_layout just because radio's icon spot
|
|
|
|
* is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
|
|
|
|
* can changed the theme API */
|
|
|
|
static void
|
|
|
|
_icon_signal_emit(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
char buf[64];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,icon,%s",
|
|
|
|
elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
|
|
|
|
|
|
|
|
elm_layout_signal_emit(obj, buf, "elm");
|
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
|
|
|
}
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
EOLIAN static Elm_Theme_Apply
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_elm_widget_theme_apply(Eo *obj, Efl_Ui_Radio_Data *sd)
|
2012-05-02 10:00:42 -07:00
|
|
|
{
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ELM_THEME_APPLY_FAILED);
|
|
|
|
Elm_Theme_Apply int_ret = ELM_THEME_APPLY_FAILED;
|
2017-05-21 19:27:13 -07:00
|
|
|
int_ret = elm_obj_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_CLASS));
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
if (!int_ret) return ELM_THEME_APPLY_FAILED;
|
2012-05-03 15:43:31 -07:00
|
|
|
|
|
|
|
if (sd->state) elm_layout_signal_emit(obj, "elm,state,radio,on", "elm");
|
|
|
|
else elm_layout_signal_emit(obj, "elm,state,radio,off", "elm");
|
|
|
|
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
if (sd->state) _state_set(obj, EINA_FALSE, EINA_FALSE);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
|
|
|
/* FIXME: replicated from elm_layout just because radio's icon
|
|
|
|
* spot is elm.swallow.content, not elm.swallow.icon. Fix that
|
|
|
|
* whenever we can changed the theme API */
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2012-05-03 15:43:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_radio_on_cb(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *obj EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2011-07-04 03:13:43 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
_activate(data);
|
2011-07-04 03:13:43 -07:00
|
|
|
}
|
|
|
|
|
2011-09-18 22:22:22 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2011-09-18 22:22:22 -07:00
|
|
|
{
|
|
|
|
const char *txt = elm_widget_access_info_get(obj);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
|
|
|
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
2011-09-18 22:22:22 -07:00
|
|
|
if (txt) return strdup(txt);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2011-09-18 22:22:22 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2011-09-18 22:22:22 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
ELM_RADIO_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
if (elm_widget_disabled_get(obj)) return strdup(E_("State: Disabled"));
|
|
|
|
if (sd->state) return strdup(E_("State: On"));
|
|
|
|
|
2011-09-18 22:22:22 -07:00
|
|
|
return strdup(E_("State: Off"));
|
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Radio_Data *priv)
|
2011-10-30 19:56:03 -07:00
|
|
|
{
|
2013-10-05 01:15:22 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, EFL_UI_CHECK_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 22:19:19 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set(obj, "radio", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-03 15:43:31 -07:00
|
|
|
|
|
|
|
elm_layout_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(obj, "elm,action,radio,toggle", "*", _radio_on_cb, obj);
|
2012-05-03 15:43:31 -07:00
|
|
|
|
|
|
|
priv->group = calloc(1, sizeof(Group));
|
|
|
|
priv->group->radios = eina_list_append(priv->group->radios, obj);
|
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_access_object_register(obj, wd->resize_obj);
|
2012-05-03 15:43:31 -07:00
|
|
|
_elm_access_text_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Radio"));
|
2012-05-03 15:43:31 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, obj);
|
2012-05-03 15:43:31 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, obj);
|
2011-10-30 19:56:03 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Radio_Data *sd)
|
2011-10-30 19:56:03 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
sd->group->radios = eina_list_remove(sd->group->radios, obj);
|
|
|
|
if (!sd->group->radios) free(sd->group);
|
2011-11-16 04:51:53 -08:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, EFL_UI_CHECK_CLASS));
|
2011-10-30 19:56:03 -07:00
|
|
|
}
|
|
|
|
|
2009-02-24 01:23:51 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_radio_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-07-06 00:47:41 -07:00
|
|
|
return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_efl_object_constructor(Eo *obj, Efl_Ui_Radio_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-20 21:26:15 -07:00
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_ROLE_RADIO_BUTTON);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_group_add(Eo *obj, Efl_Ui_Radio_Data *sd, Evas_Object *group)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
ELM_RADIO_DATA_GET(group, sdg);
|
|
|
|
|
|
|
|
if (!sdg)
|
2009-12-18 12:21:39 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
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);
|
2009-12-18 12:21:39 -08:00
|
|
|
}
|
2012-05-03 15:43:31 -07:00
|
|
|
else if (sd->group == sdg->group)
|
|
|
|
return;
|
2009-12-18 12:21:39 -08:00
|
|
|
else
|
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
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);
|
2009-12-18 12:21:39 -08:00
|
|
|
}
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
if (sd->value == sd->group->value) _state_set(obj, EINA_TRUE, EINA_FALSE);
|
|
|
|
else _state_set(obj, EINA_FALSE, EINA_FALSE);
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_state_value_set(Eo *obj, Efl_Ui_Radio_Data *sd, int value)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
sd->value = value;
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
if (sd->value == sd->group->value) _state_set(obj, EINA_TRUE, EINA_FALSE);
|
|
|
|
else _state_set(obj, EINA_FALSE, EINA_FALSE);
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static int
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_state_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
|
2010-11-10 06:10:08 -08:00
|
|
|
{
|
2014-03-26 00:50:10 -07:00
|
|
|
return sd->value;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int value)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
if (value == sd->group->value) return;
|
|
|
|
sd->group->value = value;
|
|
|
|
if (sd->group->valuep) *(sd->group->valuep) = sd->group->value;
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
_state_set_all(sd, EINA_FALSE);
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static int
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 00:50:10 -07:00
|
|
|
return sd->group->value;
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_value_pointer_set(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd, int *valuep)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2009-02-24 01:23:51 -08:00
|
|
|
if (valuep)
|
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
sd->group->valuep = valuep;
|
|
|
|
if (*(sd->group->valuep) != sd->group->value)
|
2011-04-01 04:24:15 -07:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
sd->group->value = *(sd->group->valuep);
|
radio: add "elm,activate,radio,on" and "elm,activate,radio,off" signal to support value change animation.
Summary:
Currently when user clicks on the radio, and when api value_set() called by
the developer we emit "elm,state,radio,*" signal. To support value change animation when
user interacts with radio. There is no way to distinguish the action in EDC.
This "elm,activate,radio,*" is a way which edc can make use to distinguish the state change signal
by the user action or due to api call.
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D2829
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:14:30 -07:00
|
|
|
_state_set_all(sd, EINA_FALSE);
|
2011-04-01 04:24:15 -07:00
|
|
|
}
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
2012-05-03 15:43:31 -07:00
|
|
|
else sd->group->valuep = NULL;
|
2009-02-24 01:23:51 -08:00
|
|
|
}
|
2012-02-21 03:46:01 -08:00
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static Evas_Object*
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_selected_object_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *sd)
|
2012-02-21 03:46:01 -08:00
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
Evas_Object *child;
|
|
|
|
|
2012-10-01 00:36:27 -07:00
|
|
|
EINA_LIST_FOREACH(sd->group->radios, l, child)
|
2012-02-21 03:46:01 -08:00
|
|
|
{
|
2012-05-03 15:43:31 -07:00
|
|
|
ELM_RADIO_DATA_GET(child, sdc);
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
if (sdc->value == sd->group->value) return child;
|
2012-02-21 03:46:01 -08:00
|
|
|
}
|
2012-05-03 15:43:31 -07:00
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
return NULL;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_elm_widget_activate(Eo *obj, Efl_Ui_Radio_Data *_pd EINA_UNUSED, Elm_Activate act)
|
2012-11-26 03:18:04 -08:00
|
|
|
{
|
2014-03-26 00:50:10 -07:00
|
|
|
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
|
|
|
|
if (act != ELM_ACTIVATE_DEFAULT) return EINA_FALSE;
|
2012-11-26 03:18:04 -08:00
|
|
|
|
|
|
|
_activate(obj);
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-26 03:18:04 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:50:10 -07:00
|
|
|
EOLIAN static void
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_class_constructor(Efl_Class *klass)
|
2014-03-26 00:50:10 -07:00
|
|
|
{
|
2013-11-07 03:44:22 -08:00
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2014-03-26 00:50:10 -07:00
|
|
|
|
2014-07-25 01:33:19 -07:00
|
|
|
EOLIAN const Elm_Atspi_Action *
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUSED, Efl_Ui_Radio_Data *pd EINA_UNUSED)
|
2014-07-25 01:33:19 -07:00
|
|
|
{
|
|
|
|
static Elm_Atspi_Action atspi_actions[] = {
|
|
|
|
{ "activate", "activate", NULL, _key_action_activate},
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_actions[0];
|
|
|
|
}
|
|
|
|
|
2014-10-24 04:32:08 -07:00
|
|
|
EOLIAN Elm_Atspi_State_Set
|
2017-05-22 02:56:52 -07:00
|
|
|
_efl_ui_radio_elm_interface_atspi_accessible_state_set_get(Eo *obj, Efl_Ui_Radio_Data *pd EINA_UNUSED)
|
2014-10-24 04:32:08 -07:00
|
|
|
{
|
|
|
|
Elm_Atspi_State_Set ret;
|
|
|
|
|
2017-05-22 02:56:52 -07:00
|
|
|
ret = elm_interface_atspi_accessible_state_set_get(efl_super(obj, EFL_UI_RADIO_CLASS));
|
2014-10-24 04:32:08 -07:00
|
|
|
if (obj == elm_radio_selected_object_get(obj))
|
|
|
|
STATE_TYPE_SET(ret, ELM_ATSPI_STATE_CHECKED);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-07-27 23:35:10 -07:00
|
|
|
ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT()
|
|
|
|
|
2017-05-22 02:56:52 -07:00
|
|
|
#define EFL_UI_RADIO_EXTRA_OPS \
|
2017-07-27 23:35:10 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_radio), \
|
|
|
|
ELM_LAYOUT_TEXT_ALIASES_OPS()
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2017-05-22 02:56:52 -07:00
|
|
|
#include "efl_ui_radio.eo.c"
|