2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_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
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
|
2009-02-23 00:05:05 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
2017-05-21 19:27:13 -07:00
|
|
|
#include "efl_ui_check_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}
|
|
|
|
};
|
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
|
|
|
{
|
|
|
|
{"icon", "elm.swallow.content"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-05-03 15:42:03 -07:00
|
|
|
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}
|
|
|
|
};
|
|
|
|
|
2019-09-18 09:02:35 -07:00
|
|
|
static void
|
|
|
|
_check_legacy_event(Eo *obj)
|
|
|
|
{
|
|
|
|
EFL_UI_CHECK_DATA_GET(obj, pd);
|
|
|
|
if (pd->selected)
|
|
|
|
{
|
|
|
|
if (pd->legacy_changed_emitted_select) return;
|
|
|
|
pd->legacy_changed_emitted_select = EINA_TRUE;
|
|
|
|
pd->legacy_changed_emitted_unselect = EINA_FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pd->legacy_changed_emitted_unselect) return;
|
|
|
|
pd->legacy_changed_emitted_unselect = EINA_TRUE;
|
|
|
|
pd->legacy_changed_emitted_select = EINA_FALSE;
|
|
|
|
}
|
|
|
|
evas_object_smart_callback_call(obj, "changed", 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
|
|
|
{
|
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
2019-06-13 06:21:38 -07:00
|
|
|
// state will be changed by the later call to the selected_set call
|
2019-08-05 10:42:02 -07:00
|
|
|
if (!efl_ui_selectable_selected_get(obj))
|
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.
|
2019-09-25 14:55:24 -07:00
|
|
|
// efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,*selected"
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,activate,check,on", "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-25 14:55:24 -07:00
|
|
|
elm_layout_signal_emit(obj, "efl,state,selected", "efl");
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
|
|
|
|
2015-04-19 22:24:10 -07:00
|
|
|
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.
|
2019-09-25 14:55:24 -07:00
|
|
|
// efl_ui_selectable_selected_set below will emit "elm,state,check,*" or "efl,state,*selected"
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
elm_layout_signal_emit(obj, "elm,activate,check,off", "elm");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-09-25 14:55:24 -07:00
|
|
|
elm_layout_signal_emit(obj, "efl,state,unselected", "efl");
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
|
|
|
|
2015-04-19 22:24:10 -07:00
|
|
|
if (_elm_config->access_mode != ELM_ACCESS_MODE_OFF)
|
|
|
|
_elm_access_say(E_("State: Off"));
|
2010-09-22 10:45:46 -07:00
|
|
|
}
|
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
2019-06-13 06:21:38 -07:00
|
|
|
//This commit will update the theme with the correct signals
|
|
|
|
// "elm,state,check,on" or "elm,state,check,off" for legacy
|
2019-09-25 14:55:24 -07:00
|
|
|
// "efl,state,selected" or "efl,state,unselected" for eo-api
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_ui_selectable_selected_set(obj, !efl_ui_selectable_selected_get(obj));
|
2019-07-02 12:05:07 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
2019-09-18 09:02:35 -07:00
|
|
|
_check_legacy_event(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,
|
2019-03-05 14:00:37 -08:00
|
|
|
EFL_ACCESS_STATE_TYPE_CHECKED,
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_ui_selectable_selected_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-03 04:27:30 -07:00
|
|
|
_efl_ui_check_efl_access_object_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
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
states = efl_access_object_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))
|
2019-03-05 14:00:37 -08:00
|
|
|
STATE_TYPE_SET(states, EFL_ACCESS_STATE_TYPE_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;
|
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
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
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2011-10-28 01:57:33 -07:00
|
|
|
|
2019-03-04 10:36:41 -08:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC);
|
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));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
2012-05-02 09:58:46 -07:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
2019-08-05 10:42:02 -07:00
|
|
|
if (!efl_ui_selectable_selected_get(obj))
|
2018-04-26 04:24:09 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
|
|
|
}
|
2018-02-13 05:50:14 -08:00
|
|
|
else
|
2018-04-26 04:24:09 -07:00
|
|
|
{
|
2019-08-05 10:42:02 -07:00
|
|
|
if (!efl_ui_selectable_selected_get(obj))
|
2019-09-25 14:55:24 -07:00
|
|
|
elm_layout_signal_emit(obj, "efl,state,unselected", "efl");
|
2018-04-26 04:24:09 -07:00
|
|
|
else
|
2019-09-25 14:55:24 -07:00
|
|
|
elm_layout_signal_emit(obj, "efl,state,selected", "efl");
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
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
|
|
|
|
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"));
|
2019-08-05 10:42:02 -07:00
|
|
|
if (efl_ui_selectable_selected_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
|
|
|
}
|
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
static void
|
|
|
|
_flush_selected(Eo *obj, Eina_Bool sel)
|
|
|
|
{
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_ui_selectable_selected_set(obj, sel);
|
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
2019-06-13 06:21:38 -07:00
|
|
|
|
|
|
|
if (_elm_config->atspi_mode)
|
|
|
|
efl_access_state_changed_signal_emit(obj,
|
|
|
|
EFL_ACCESS_STATE_TYPE_CHECKED,
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_ui_selectable_selected_get(obj));
|
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
2019-06-13 06:21:38 -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;
|
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
_flush_selected(obj, EINA_FALSE);
|
2019-09-18 09:02:35 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
_check_legacy_event(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;
|
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
_flush_selected(obj, EINA_TRUE);
|
2019-09-18 09:02:35 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
_check_legacy_event(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);
|
|
|
|
}
|
|
|
|
|
2019-07-31 06:02:05 -07:00
|
|
|
static void
|
|
|
|
_clicked_cb(void *data, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
_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
|
2019-08-05 10:42:02 -07:00
|
|
|
_efl_ui_check_efl_ui_selectable_selected_get(const Eo *obj EINA_UNUSED, Efl_Ui_Check_Data *pd EINA_UNUSED)
|
2012-05-03 15:42:03 -07:00
|
|
|
{
|
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
2019-06-13 06:21:38 -07:00
|
|
|
return pd->selected;
|
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
|
2019-08-05 10:42:02 -07:00
|
|
|
_efl_ui_check_efl_ui_selectable_selected_set(Eo *obj, Efl_Ui_Check_Data *pd, 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);
|
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
if (pd->selected == value) return;
|
|
|
|
|
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
if (pd->statep)
|
|
|
|
*pd->statep = value;
|
|
|
|
}
|
2018-02-13 05:50:14 -08:00
|
|
|
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
if (value == 1)
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,on", "elm");
|
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,check,off", "elm");
|
|
|
|
}
|
2018-02-13 05:50:14 -08:00
|
|
|
else
|
2018-04-26 04:24:09 -07:00
|
|
|
{
|
|
|
|
if (value == 1)
|
2019-09-25 14:55:24 -07:00
|
|
|
elm_layout_signal_emit(obj, "efl,state,selected", "efl");
|
2018-04-26 04:24:09 -07:00
|
|
|
else
|
2019-09-25 14:55:24 -07:00
|
|
|
elm_layout_signal_emit(obj, "efl,state,unselected", "efl");
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
2017-05-18 02:21:26 -07:00
|
|
|
|
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2018-02-13 05:50:14 -08:00
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
pd->selected = 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
|
|
|
|
2019-11-06 04:46:42 -08:00
|
|
|
pd->legacy_changed_emitted_select = !pd->selected;
|
|
|
|
pd->legacy_changed_emitted_unselect = pd->selected;
|
|
|
|
|
2019-07-02 12:05:07 -07:00
|
|
|
if (!elm_widget_is_legacy(obj))
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_event_callback_call(obj, EFL_UI_EVENT_SELECTED_CHANGED, &pd->selected);
|
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);
|
2019-08-01 22:03:38 -07:00
|
|
|
efl_ui_action_connector_bind_clickable_to_theme(wd->resize_obj, obj);
|
2018-04-26 04:24:09 -07:00
|
|
|
if (elm_widget_is_legacy(obj))
|
|
|
|
{
|
|
|
|
efl_layout_signal_callback_add
|
2019-02-06 10:48:43 -08:00
|
|
|
(wd->resize_obj, "elm,action,check,on", "*", obj, _on_check_on, NULL);
|
2018-04-26 04:24:09 -07:00
|
|
|
efl_layout_signal_callback_add
|
2019-02-06 10:48:43 -08:00
|
|
|
(wd->resize_obj, "elm,action,check,off", "*", obj, _on_check_off, NULL);
|
2018-04-26 04:24:09 -07:00
|
|
|
efl_layout_signal_callback_add
|
2019-02-06 10:48:43 -08:00
|
|
|
(wd->resize_obj, "elm,action,check,toggle", "*", obj, _on_check_toggle, NULL);
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
efl_layout_signal_callback_add
|
2019-09-25 14:55:24 -07:00
|
|
|
(wd->resize_obj, "efl,action,select", "*", obj, _on_check_on, NULL);
|
2018-04-26 04:24:09 -07:00
|
|
|
efl_layout_signal_callback_add
|
2019-09-25 14:55:24 -07:00
|
|
|
(wd->resize_obj, "efl,action,unselect", "*", obj, _on_check_off, NULL);
|
2019-07-31 06:02:05 -07:00
|
|
|
efl_event_callback_add(obj, EFL_INPUT_EVENT_CLICKED, _clicked_cb, obj);
|
2018-04-26 04:24:09 -07:00
|
|
|
}
|
2017-10-23 19:13:51 -07:00
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_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_CHECK_DATA_GET_OR_RETURN(obj, sd);
|
|
|
|
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_ui_selectable_selected_set(obj, state);
|
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
|
|
|
{
|
2019-08-05 10:42:02 -07:00
|
|
|
return !!efl_ui_selectable_selected_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
|
|
|
|
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;
|
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
2019-06-13 06:21:38 -07:00
|
|
|
if (*sd->statep != sd->selected)
|
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
|
|
|
{
|
2019-08-05 10:42:02 -07:00
|
|
|
efl_ui_selectable_selected_set(obj, *sd->statep);
|
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
|
|
|
}
|
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)
|
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
2019-06-13 06:21:38 -07:00
|
|
|
ELM_PART_TEXT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data)
|
|
|
|
ELM_PART_CONTENT_DEFAULT_IMPLEMENT(efl_ui_check, Efl_Ui_Check_Data)
|
2019-09-23 10:24:51 -07:00
|
|
|
EFL_UI_LAYOUT_CONTENT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
|
2017-08-16 23:08:00 -07:00
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2019-09-23 10:24:51 -07:00
|
|
|
EFL_UI_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 \
|
2019-09-23 10:24:51 -07:00
|
|
|
EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
|
|
|
|
EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX)
|
2017-05-18 01:52:17 -07:00
|
|
|
|
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
2019-06-13 06:21:38 -07:00
|
|
|
|
2017-05-21 19:27:13 -07:00
|
|
|
#include "efl_ui_check.eo.c"
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_check_eo.legacy.c"
|
2018-01-23 22:50:58 -08:00
|
|
|
|
2019-03-05 14:00:37 -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);
|
2018-10-22 04:39:06 -07:00
|
|
|
legacy_object_focus_handle(obj);
|
2018-01-23 22:50:58 -08:00
|
|
|
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
|
2018-06-18 20:42:09 -07:00
|
|
|
_icon_signal_emit(Evas_Object *obj)
|
2018-02-26 03:28:37 -08:00
|
|
|
{
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
char buf[64];
|
|
|
|
|
|
|
|
if (!elm_widget_resize_object_get(obj)) return;
|
2019-05-29 06:25:08 -07:00
|
|
|
if (!edje_object_part_exists(obj, "elm.swallow.content")) return;
|
2018-06-18 20:42:09 -07:00
|
|
|
snprintf(buf, sizeof(buf), "elm,state,icon,%s",
|
|
|
|
elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
|
2018-02-26 03:28:37 -08:00
|
|
|
|
|
|
|
elm_layout_signal_emit(obj, buf, "elm");
|
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
|
|
|
|
2019-07-30 10:11:19 -07:00
|
|
|
efl_canvas_group_change(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 */
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-02-26 03:28:37 -08:00
|
|
|
_efl_ui_check_legacy_efl_ui_widget_theme_apply(Eo *obj, void *_pd EINA_UNUSED)
|
|
|
|
{
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2018-02-26 03:28:37 -08:00
|
|
|
|
|
|
|
int_ret = efl_ui_widget_theme_apply(efl_super(obj, EFL_UI_CHECK_LEGACY_CLASS));
|
2019-03-04 10:36:41 -08:00
|
|
|
if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
|
2018-02-26 03:28:37 -08:00
|
|
|
|
2018-06-18 20:42:09 -07:00
|
|
|
_icon_signal_emit(obj);
|
2018-02-26 03:28:37 -08:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-06-18 20:42:09 -07:00
|
|
|
_icon_signal_emit(obj);
|
2018-02-26 03:28:37 -08:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2018-06-18 20:42:09 -07:00
|
|
|
_icon_signal_emit(obj);
|
2018-02-26 03:28:37 -08:00
|
|
|
|
|
|
|
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)
|
2018-06-20 09:24:06 -07:00
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET_NO_SD(efl_ui_check_legacy)
|
2018-02-26 03:28:37 -08:00
|
|
|
#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);
|
|
|
|
}
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "efl_ui_check_legacy_eo.c"
|