2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
#define EFL_ACCESS_PROTECTED
|
2017-11-15 18:31:26 -08:00
|
|
|
#define EFL_ACCESS_WIDGET_ACTION_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2016-05-09 23:31:53 -07:00
|
|
|
#define EFL_UI_NSTATE_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
|
2009-02-23 00:05:05 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2016-05-09 23:31:53 -07:00
|
|
|
#include "efl_ui_nstate.eo.h"
|
2017-05-21 19:27:13 -07:00
|
|
|
#include "efl_ui_check_private.h"
|
2018-02-13 05:50:14 -08:00
|
|
|
#include "efl_ui_nstate_private.h"
|
2018-02-26 03:28:37 -08:00
|
|
|
#include "elm_part_helper.h"
|
2009-02-23 00:05:05 -08:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
#define MY_CLASS EFL_UI_CHECK_CLASS
|
2017-07-27 23:35:10 -07:00
|
|
|
#define MY_CLASS_PFX efl_ui_check
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Check"
|
2012-05-03 15:42:03 -07:00
|
|
|
|
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
2010-09-22 10:45:46 -07:00
|
|
|
{
|
2012-05-03 15:42:03 -07:00
|
|
|
{"default", "elm.text"},
|
|
|
|
{"on", "elm.ontext"},
|
|
|
|
{"off", "elm.offtext"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char SIG_CHANGED[] = "changed";
|
|
|
|
|
|
|
|
/* smart callbacks coming from elm check objects: */
|
|
|
|
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:42:03 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2014-03-31 19:10:25 -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
|
2012-05-03 15:42:03 -07:00
|
|
|
_activate(Evas_Object *obj)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2017-06-16 00:11:42 -07:00
|
|
|
EFL_UI_CHECK_DATA_GET(obj, sd);
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2018-02-13 05:50:14 -08:00
|
|
|
if (sd->statep) *sd->statep = !efl_ui_nstate_value_get(obj);
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
|
2018-02-13 05:50:14 -08:00
|
|
|
// state will be changed to 1 by efl_ui_nstate_activate(obj)
|
|
|
|
if (efl_ui_nstate_value_get(obj) == 0)
|
2010-09-22 10:45:46 -07:00
|
|
|
{
|
check: add "elm,activate,check,on" and "elm,activate,check,off" signal to support state change animation.
Summary:
Currently when user clicks on the checkbox, and when api state_check() called by
the developer we emit "elm,state,check,*" signal. To support state change animation when
user interacts with check box. There is no way to distinguish the action in EDC.
This "elm,activate,check,*" is a way which edc can make use to distinguish the stae change signal
by the user action or due to api call.
Reviewers: woohyun, raster, cedric, Hermet
Reviewed By: Hermet
Subscribers: id213sin
Differential Revision: https://phab.enlightenment.org/D2817
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:10:49 -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 remove "elm,state,check,on" signal emission when we can break ABI.
|
|
|
|
elm_layout_signal_emit(obj, "elm,activate,check,on", "elm");
|
2015-04-19 22:24:10 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
_elm_access_say(E_("State: On"));
|
2010-09-22 10:45:46 -07:00
|
|
|
}
|
2018-02-13 05:50:14 -08:00
|
|
|
else
|
2010-09-22 10:45:46 -07:00
|
|
|
{
|
check: add "elm,activate,check,on" and "elm,activate,check,off" signal to support state change animation.
Summary:
Currently when user clicks on the checkbox, and when api state_check() called by
the developer we emit "elm,state,check,*" signal. To support state change animation when
user interacts with check box. There is no way to distinguish the action in EDC.
This "elm,activate,check,*" is a way which edc can make use to distinguish the stae change signal
by the user action or due to api call.
Reviewers: woohyun, raster, cedric, Hermet
Reviewed By: Hermet
Subscribers: id213sin
Differential Revision: https://phab.enlightenment.org/D2817
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2015-07-29 14:10:49 -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 remove "elm,state,check,off" signal emission when we can break ABI.
|
|
|
|
elm_layout_signal_emit(obj, "elm,activate,check,off", "elm");
|
2015-04-19 22:24:10 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
_elm_access_say(E_("State: Off"));
|
2010-09-22 10:45:46 -07:00
|
|
|
}
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2018-02-13 05:50:14 -08:00
|
|
|
efl_ui_nstate_activate(obj);
|
|
|
|
|
2014-06-11 20:57:54 -07:00
|
|
|
if (_elm_config->atspi_mode)
|
2018-02-13 05:50:14 -08:00
|
|
|
efl_access_state_changed_signal_emit(obj,
|
|
|
|
EFL_ACCESS_STATE_CHECKED,
|
|
|
|
efl_ui_nstate_value_get(obj));
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
EOLIAN static Efl_Access_State_Set
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_check_efl_access_state_set_get(const Eo *obj, Efl_Ui_Check_Data *_pd EINA_UNUSED)
|
2014-06-11 20:57:54 -07:00
|
|
|
{
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_State_Set states = 0;
|
2014-06-11 20:57:54 -07:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
states = efl_access_state_set_get(efl_super(obj, EFL_UI_CHECK_CLASS));
|
2014-06-11 20:57:54 -07:00
|
|
|
|
2015-04-19 22:24:10 -07:00
|
|
|
if (elm_check_state_get(obj))
|
2017-10-18 18:13:54 -07:00
|
|
|
STATE_TYPE_SET(states, EFL_ACCESS_STATE_CHECKED);
|
2014-06-11 20:57:54 -07:00
|
|
|
|
|
|
|
return states;
|
|
|
|
}
|
|
|
|
|
2014-03-20 01:27:21 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-01-07 20:55:35 -08:00
|
|
|
_efl_ui_check_efl_ui_widget_on_access_activate(Eo *obj EINA_UNUSED, Efl_Ui_Check_Data *_pd EINA_UNUSED, Efl_Ui_Activate act)
|
2012-11-16 02:00:24 -08:00
|
|
|
{
|
2014-03-20 01:27:21 -07:00
|
|
|
if (elm_widget_disabled_get(obj)) return EINA_FALSE;
|
2017-10-15 21:33:52 -07:00
|
|
|
if (act != EFL_UI_ACTIVATE_DEFAULT) return EINA_FALSE;
|
2012-11-16 02:00:24 -08:00
|
|
|
|
|
|
|
_activate(obj);
|
|
|
|
|
2014-03-20 01:27:21 -07:00
|
|
|
return EINA_TRUE;
|
2012-11-16 02:00:24 -08:00
|
|
|
}
|
|
|
|
|
2014-03-31 19:10:25 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_key_action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_activate(obj);
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
2018-01-07 20:55:35 -08:00
|
|
|
_efl_ui_check_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Check_Data *sd EINA_UNUSED)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2017-08-09 00:13:06 -07:00
|
|
|
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
2011-10-28 01:57:33 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_FAILED);
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-10-23 22:03:46 -07:00
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
|
2017-08-09 00:13:06 -07:00
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
2012-05-02 09:58:46 -07:00
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
if (efl_ui_nstate_value_get(obj) == 0)
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
2018-02-13 05:50:14 -08:00
|
|
|
else
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
2009-02-23 00:05:05 -08:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2011-07-04 02:18:10 -07:00
|
|
|
|
2017-08-02 23:20:58 -07:00
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-02 09:58:46 -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;
|
2011-08-23 00:44:49 -07:00
|
|
|
}
|
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2011-08-23 00:44:49 -07:00
|
|
|
{
|
2012-05-02 18:19:05 -07:00
|
|
|
const char *txt = elm_widget_access_info_get(obj);
|
2012-05-03 15:42:03 -07:00
|
|
|
|
|
|
|
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
2012-05-02 18:19:05 -07:00
|
|
|
if (txt) return strdup(txt);
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
2011-10-20 17:24:15 -07:00
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
static char *
|
2012-12-23 06:50:56 -08:00
|
|
|
_access_state_cb(void *data, Evas_Object *obj)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2015-04-19 22:24:10 -07:00
|
|
|
const char *on_text, *off_text;
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
if (elm_widget_disabled_get(obj))
|
|
|
|
return strdup(E_("State: Disabled"));
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
if (efl_ui_nstate_value_get(obj))
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
on_text = elm_layout_text_get(data, "on");
|
2012-05-03 15:42:03 -07:00
|
|
|
|
|
|
|
if (on_text)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
|
|
|
char buf[1024];
|
2011-10-20 17:24:15 -07:00
|
|
|
|
2012-05-03 15:42:03 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s: %s", E_("State"), on_text);
|
2012-05-02 18:19:05 -07:00
|
|
|
return strdup(buf);
|
|
|
|
}
|
|
|
|
else
|
2012-05-03 15:42:03 -07:00
|
|
|
return strdup(E_("State: On"));
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2015-04-19 22:24:10 -07:00
|
|
|
off_text = elm_layout_text_get(data, "off");
|
|
|
|
|
|
|
|
if (off_text)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2015-04-19 22:24:10 -07:00
|
|
|
char buf[1024];
|
2012-05-02 09:58:46 -07:00
|
|
|
|
2015-04-19 22:24:10 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s: %s", E_("State"), off_text);
|
|
|
|
return strdup(buf);
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2015-04-19 22:24:10 -07:00
|
|
|
return strdup(E_("State: Off"));
|
2011-08-23 00:44:49 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:42:03 -07:00
|
|
|
static void
|
|
|
|
_on_check_off(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *o EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-05-03 15:42:03 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
|
2017-06-16 00:11:42 -07:00
|
|
|
EFL_UI_CHECK_DATA_GET(obj, sd);
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2018-02-13 05:50:14 -08:00
|
|
|
if (sd->statep) *sd->statep = 0;
|
2012-05-03 15:42:03 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
2018-02-13 05:50:14 -08:00
|
|
|
efl_ui_nstate_value_set(obj, 0);
|
2014-06-11 20:57:54 -07:00
|
|
|
|
|
|
|
if (_elm_config->atspi_mode)
|
2018-02-13 05:50:14 -08:00
|
|
|
efl_access_state_changed_signal_emit(data,
|
|
|
|
EFL_ACCESS_STATE_CHECKED,
|
|
|
|
efl_ui_nstate_value_get(obj));
|
2012-05-03 15:42:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_on_check_on(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *o EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-05-03 15:42:03 -07:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
|
2017-06-16 00:11:42 -07:00
|
|
|
EFL_UI_CHECK_DATA_GET(obj, sd);
|
2012-05-03 15:42:03 -07:00
|
|
|
|
2018-02-13 05:50:14 -08:00
|
|
|
if (sd->statep) *sd->statep = 1;
|
2012-05-03 15:42:03 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
2018-02-13 05:50:14 -08:00
|
|
|
efl_ui_nstate_value_set(obj, 1);
|
2014-06-11 20:57:54 -07:00
|
|
|
|
|
|
|
if (_elm_config->atspi_mode)
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_state_changed_signal_emit(data,
|
2018-02-13 05:50:14 -08:00
|
|
|
EFL_ACCESS_STATE_CHECKED,
|
|
|
|
efl_ui_nstate_value_get(obj));
|
2012-05-03 15:42:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_on_check_toggle(void *data,
|
2014-01-06 06:30:02 -08:00
|
|
|
Evas_Object *o EINA_UNUSED,
|
|
|
|
const char *emission EINA_UNUSED,
|
|
|
|
const char *source EINA_UNUSED)
|
2012-05-03 15:42:03 -07:00
|
|
|
{
|
|
|
|
_activate(data);
|
|
|
|
}
|
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_check_selected_get(const Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
2012-05-03 15:42:03 -07:00
|
|
|
{
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
return !!efl_ui_nstate_value_get(obj);
|
2012-08-01 14:03:05 -07:00
|
|
|
}
|
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
EOLIAN static void
|
2017-05-21 19:27:13 -07:00
|
|
|
_efl_ui_check_selected_set(Eo *obj, Efl_Ui_Check_Data *sd, Eina_Bool value)
|
2012-08-01 14:03:05 -07:00
|
|
|
{
|
2017-05-18 02:21:26 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
2018-02-13 05:50:14 -08:00
|
|
|
if (sd->statep) *sd->statep = value;
|
|
|
|
|
|
|
|
if (value == 1)
|
2017-05-18 02:21:26 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
2018-02-13 05:50:14 -08:00
|
|
|
else
|
2017-05-18 02:21:26 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
|
|
|
|
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2018-02-13 05:50:14 -08:00
|
|
|
|
|
|
|
efl_ui_nstate_value_set(obj, value);
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-05-21 19:27:13 -07:00
|
|
|
_efl_ui_check_efl_ui_nstate_count_set(Eo *obj EINA_UNUSED, Efl_Ui_Check_Data *pd EINA_UNUSED, int nstate EINA_UNUSED)
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
{
|
|
|
|
//NOP;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-05-21 19:27:13 -07:00
|
|
|
_efl_ui_check_efl_ui_nstate_value_set(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED, int state)
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
{
|
|
|
|
Eina_Bool _state = !!state;
|
|
|
|
if (_state == efl_ui_nstate_value_get(obj)) return;
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_ui_nstate_value_set(efl_super(obj, MY_CLASS), _state);
|
2012-05-03 15:42:03 -07:00
|
|
|
}
|
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2017-10-23 19:13:51 -07:00
|
|
|
_efl_ui_check_efl_object_constructor(Eo *obj, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2017-11-14 05:03:25 -08:00
|
|
|
if (!elm_widget_theme_klass_get(obj))
|
|
|
|
elm_widget_theme_klass_set(obj, "check");
|
2016-08-15 06:44:41 -07:00
|
|
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
2016-06-16 22:12:02 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
|
2017-10-23 19:13:51 -07:00
|
|
|
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_add
|
2017-10-23 19:13:51 -07:00
|
|
|
(wd->resize_obj, "elm,action,check,on", "*", _on_check_on, obj);
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_add
|
2017-10-23 19:13:51 -07:00
|
|
|
(wd->resize_obj, "elm,action,check,off", "*", _on_check_off, obj);
|
2017-12-04 21:39:20 -08:00
|
|
|
efl_layout_signal_callback_add
|
2017-10-23 19:13:51 -07:00
|
|
|
(wd->resize_obj, "elm,action,check,toggle", "*", _on_check_toggle, obj);
|
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
efl_access_role_set(obj, EFL_ACCESS_ROLE_CHECK_BOX);
|
2017-10-23 19:13:51 -07:00
|
|
|
_elm_access_object_register(obj, wd->resize_obj);
|
|
|
|
_elm_access_text_set
|
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("Check"));
|
|
|
|
_elm_access_callback_set
|
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, obj);
|
|
|
|
_elm_access_callback_set
|
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, obj);
|
|
|
|
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2009-02-23 00:05:05 -08:00
|
|
|
}
|
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
EAPI void
|
|
|
|
elm_check_state_set(Evas_Object *obj, Eina_Bool state)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2018-02-13 05:50:14 -08:00
|
|
|
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 (state == 1)
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
|
|
|
}
|
2009-02-23 00:05:05 -08:00
|
|
|
}
|
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_check_state_get(const Evas_Object *obj)
|
2009-02-23 17:23:18 -08:00
|
|
|
{
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
return !!efl_ui_nstate_value_get(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:03 -07:00
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
EAPI void
|
|
|
|
elm_check_state_pointer_set(Eo *obj, Eina_Bool *statep)
|
2009-02-23 00:05:05 -08:00
|
|
|
{
|
2017-06-16 00:11:42 -07:00
|
|
|
EFL_UI_CHECK_DATA_GET_OR_RETURN(obj, sd);
|
2018-02-13 05:50:14 -08:00
|
|
|
EFL_UI_NSTATE_DATA_GET_OR_RETURN(obj, nd);
|
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
if (!statep)
|
2009-02-23 00:05:05 -08:00
|
|
|
{
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
sd->statep = NULL;
|
|
|
|
return;
|
2009-02-23 00:05:05 -08:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
sd->statep = statep;
|
2018-02-13 05:50:14 -08:00
|
|
|
if (*sd->statep != nd->state)
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
{
|
2018-02-13 05:50:14 -08:00
|
|
|
nd->state = *sd->statep;
|
|
|
|
if (nd->state == 1)
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
2018-02-13 05:50:14 -08:00
|
|
|
else
|
elm_nstate: introduce nstate widget and inherit check from it
Test Plan:
elementary_test -to "nstate"
@feature
Reviewers: yashu21985, tasn, Hermet, seoz, smohanty, felipealmeida, JackDanielZ, jypark, woohyun, herdsman, raster, cedric, jpeg
Subscribers: saurabhbunty, seoz
Differential Revision: https://phab.enlightenment.org/D3786
2016-04-07 02:25:59 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2017-11-15 18:55:06 -08:00
|
|
|
EOLIAN const Efl_Access_Action_Data *
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_ui_check_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
2014-07-10 04:11:28 -07:00
|
|
|
{
|
2017-11-15 18:55:06 -08:00
|
|
|
static Efl_Access_Action_Data atspi_action[] = {
|
2014-07-25 01:33:19 -07:00
|
|
|
{ "activate", "activate", NULL, _key_action_activate },
|
|
|
|
{ NULL, NULL, NULL, NULL }
|
|
|
|
};
|
|
|
|
return &atspi_action[0];
|
2014-07-10 04:11:28 -07:00
|
|
|
}
|
|
|
|
|
2017-08-16 23:08:00 -07:00
|
|
|
/* Standard widget overrides */
|
|
|
|
|
|
|
|
ELM_WIDGET_KEY_DOWN_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data)
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
2017-07-27 23:35:10 -07:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
#define EFL_UI_CHECK_EXTRA_OPS \
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX)
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
#include "efl_ui_check.eo.c"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
#include "efl_ui_check_legacy.eo.h"
|
2018-02-26 03:28:37 -08:00
|
|
|
#include "efl_ui_check_legacy_part.eo.h"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_check"
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_ui_check_legacy_class_constructor(Efl_Class *klass)
|
|
|
|
{
|
|
|
|
evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eo *
|
|
|
|
_efl_ui_check_legacy_efl_object_constructor(Eo *obj, void *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
obj = efl_constructor(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS));
|
|
|
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2018-02-26 03:28:37 -08:00
|
|
|
/* FIXME: replicated from elm_layout just because check'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];
|
|
|
|
|
|
|
|
if (!elm_widget_resize_object_get(obj)) return;
|
|
|
|
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);
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: replicated from elm_layout just because check's icon spot
|
|
|
|
* is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
|
|
|
|
* can changed the theme API */
|
|
|
|
EOLIAN static Efl_Ui_Theme_Apply
|
|
|
|
_efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Efl_Ui_Theme_Apply int_ret = EFL_UI_THEME_APPLY_FAILED;
|
|
|
|
|
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS));
|
|
|
|
if (!int_ret) return EFL_UI_THEME_APPLY_FAILED;
|
|
|
|
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
|
|
|
return int_ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: replicated from elm_layout just because check's icon spot
|
|
|
|
* is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
|
|
|
|
* can changed the theme API */
|
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_efl_ui_check_legacy_efl_ui_widget_widget_sub_object_del(Eo *obj, void *_pd EINA_UNUSED, Evas_Object *sobj)
|
|
|
|
{
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
|
|
|
int_ret = elm_widget_sub_object_del(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), sobj);
|
|
|
|
if (!int_ret) return EINA_FALSE;
|
|
|
|
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* FIXME: replicated from elm_layout just because check's icon spot
|
|
|
|
* is elm.swallow.content, not elm.swallow.icon. Fix that whenever we
|
|
|
|
* can changed the theme API */
|
|
|
|
static Eina_Bool
|
|
|
|
_efl_ui_check_legacy_content_set(Eo *obj, void *_pd EINA_UNUSED, const char *part, Evas_Object *content)
|
|
|
|
{
|
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
|
|
|
|
|
|
|
int_ret = efl_content_set(efl_part(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS), part), content);
|
|
|
|
if (!int_ret) return EINA_FALSE;
|
|
|
|
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Efl.Part begin */
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_part_is_efl_ui_check_legacy_part(const Eo *obj EINA_UNUSED, const char *part)
|
|
|
|
{
|
|
|
|
return eina_streq(part, "elm.swallow.content");
|
|
|
|
}
|
|
|
|
|
|
|
|
ELM_PART_OVERRIDE_PARTIAL(efl_ui_check_legacy, EFL_UI_CHECK_LEGACY, void, _part_is_efl_ui_check_legacy_part)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_check_legacy, EFL_UI_CHECK_LEGACY, void)
|
|
|
|
#include "efl_ui_check_legacy_part.eo.c"
|
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2018-01-23 22:50:58 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_check_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
|
|
|
return elm_legacy_add(EFL_UI_CHECK_LEGACY_CLASS, parent);
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "efl_ui_check_legacy.eo.c"
|