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
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_PROTECTED
|
2018-05-03 16:34:17 -07:00
|
|
|
#define EFL_PART_PROTECTED
|
2014-10-17 08:56:11 -07:00
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include "elm_priv.h"
|
2012-07-31 15:06:16 -07:00
|
|
|
#include "elm_widget_actionslider.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_actionslider_eo.h"
|
2016-10-18 03:34:12 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_actionslider_part.eo.h"
|
2017-06-04 07:25:36 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_ACTIONSLIDER_CLASS
|
2017-07-27 23:35:10 -07:00
|
|
|
#define MY_CLASS_FPX elm_actionslider
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME "Elm_Actionslider"
|
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_actionslider"
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
|
|
|
{
|
|
|
|
{"indicator", "elm.text.indicator"},
|
|
|
|
{"left", "elm.text.left"},
|
|
|
|
{"right", "elm.text.right"},
|
|
|
|
{"center", "elm.text.center"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2013-09-02 16:39:02 -07:00
|
|
|
#define ELM_PRIV_ACTIONSLIDER_SIGNALS(cmd) \
|
|
|
|
cmd(SIG_CHANGED, "pos_changed", "") \
|
|
|
|
cmd(SIG_SELECTED, "selected", "")
|
|
|
|
|
|
|
|
ELM_PRIV_ACTIONSLIDER_SIGNALS(ELM_PRIV_STATIC_VARIABLE_DECLARE);
|
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
static const Evas_Smart_Cb_Description _smart_callbacks[] =
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2013-09-02 16:39:02 -07:00
|
|
|
ELM_PRIV_ACTIONSLIDER_SIGNALS(ELM_PRIV_SMART_CALLBACKS_DESC)
|
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 */
|
2012-05-03 15:42:32 -07:00
|
|
|
{NULL, NULL}
|
2010-10-16 18:44:57 -07:00
|
|
|
};
|
2013-10-18 10:20:34 -07:00
|
|
|
#undef ELM_PRIV_ACTIONSLIDER_SIGNALS
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static Elm_Actionslider_Pos
|
2012-05-03 15:42:32 -07:00
|
|
|
_get_pos_by_orientation(const Evas_Object *obj,
|
|
|
|
Elm_Actionslider_Pos pos)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(obj))
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
|
|
|
switch (pos)
|
|
|
|
{
|
|
|
|
case ELM_ACTIONSLIDER_LEFT:
|
2012-05-03 15:42:32 -07:00
|
|
|
pos = ELM_ACTIONSLIDER_RIGHT;
|
|
|
|
break;
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
case ELM_ACTIONSLIDER_RIGHT:
|
2012-05-03 15:42:32 -07:00
|
|
|
pos = ELM_ACTIONSLIDER_LEFT;
|
|
|
|
break;
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
default:
|
2012-05-03 15:42:32 -07:00
|
|
|
break;
|
2011-02-08 04:08:28 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_actionslider_elm_layout_sizing_eval(Eo *obj, Elm_Actionslider_Data *sd)
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2012-05-02 18:19:05 -07:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
|
|
|
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2010-12-07 07:55:14 -08:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
2012-05-03 15:42:32 -07:00
|
|
|
evas_object_size_hint_min_set(sd->drag_button_base, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(sd->drag_button_base, -1, -1);
|
2010-12-07 07:55:14 -08:00
|
|
|
|
|
|
|
minw = -1;
|
|
|
|
minh = -1;
|
|
|
|
elm_coords_finger_size_adjust(3, &minw, 1, &minh);
|
2012-05-03 15:42:32 -07:00
|
|
|
edje_object_size_min_restricted_calc
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, &minw, &minh, minw, minh);
|
2010-12-07 07:55:11 -08:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
|
|
|
}
|
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
static void
|
2012-05-03 15:42:32 -07:00
|
|
|
_mirroredness_change_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
double pos;
|
|
|
|
char *left;
|
|
|
|
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
left = (char *)elm_layout_text_get(obj, "elm.text.left");
|
|
|
|
if (left) left = strdup(left);
|
|
|
|
|
|
|
|
elm_layout_text_set
|
|
|
|
(obj, "elm.text.left", elm_layout_text_get(obj, "elm.text.right"));
|
|
|
|
elm_layout_text_set(obj, "elm.text.right", left);
|
|
|
|
|
|
|
|
free(left);
|
|
|
|
|
|
|
|
edje_object_part_drag_value_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base", &pos, NULL);
|
2012-05-03 15:42:32 -07:00
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base", 1.0 - pos, 0.5);
|
2012-05-03 15:42:32 -07:00
|
|
|
}
|
|
|
|
|
2019-03-04 10:37:07 -08:00
|
|
|
EOLIAN static Eina_Error
|
2018-01-07 20:55:35 -08:00
|
|
|
_elm_actionslider_efl_ui_widget_theme_apply(Eo *obj, Elm_Actionslider_Data *sd EINA_UNUSED)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
Eina_Bool mirrored;
|
2019-03-04 10:37:07 -08:00
|
|
|
Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
|
2012-05-03 15:42:32 -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-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
mirrored = elm_object_mirrored_get(obj);
|
|
|
|
|
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-03 15:42:32 -07:00
|
|
|
|
|
|
|
if (elm_object_mirrored_get(obj) != mirrored)
|
|
|
|
_mirroredness_change_eval(obj);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2012-05-03 15:42:32 -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;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-03 15:42:32 -07:00
|
|
|
_drag_button_down_cb(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)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Elm_Actionslider_Data *sd = efl_data_scope_get(data, MY_CLASS);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
sd->mouse_down = EINA_TRUE;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-05-03 15:42:32 -07:00
|
|
|
_drag_button_move_cb(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)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
Evas_Object *obj = data;
|
2010-10-16 18:44:57 -07:00
|
|
|
double pos = 0.0;
|
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
ELM_ACTIONSLIDER_DATA_GET(obj, sd);
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
if (!sd->mouse_down) return;
|
|
|
|
|
|
|
|
edje_object_part_drag_value_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base", &pos, NULL);
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_DBL_EQ(pos, 0.0))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2017-06-13 03:41:15 -07:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, !efl_ui_mirrored_get(obj) ? "left" : "right");
|
2017-01-06 09:57:46 -08:00
|
|
|
else if (EINA_DBL_EQ(pos, 1.0))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2017-06-13 03:41:15 -07:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, !efl_ui_mirrored_get(obj) ? "right" : "left");
|
2010-10-16 18:44:57 -07:00
|
|
|
else if (pos >= 0.45 && pos <= 0.55)
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "center");
|
2012-05-03 15:42:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_text_get(const Evas_Object *obj,
|
|
|
|
const char **left,
|
|
|
|
const char **right,
|
|
|
|
const char **center)
|
|
|
|
{
|
|
|
|
/* mirroredness already evaluated by the two calls below */
|
|
|
|
*left = elm_layout_text_get(obj, "left");
|
|
|
|
*right = elm_layout_text_get(obj, "right");
|
|
|
|
*center = elm_layout_text_get(obj, "center");
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2010-12-07 07:55:11 -08:00
|
|
|
static Eina_Bool
|
2012-05-03 15:42:32 -07:00
|
|
|
_button_animator(void *data)
|
2010-12-07 07:55:11 -08:00
|
|
|
{
|
2011-02-08 04:08:28 -08:00
|
|
|
Evas_Object *obj = data;
|
2010-12-07 07:55:11 -08:00
|
|
|
double move_amount = 0.05;
|
|
|
|
Eina_Bool flag_finish_animation = EINA_FALSE;
|
2012-05-03 15:42:32 -07:00
|
|
|
double cur_position = 0.0, new_position = 0.0;
|
2010-12-07 07:55:11 -08:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
ELM_ACTIONSLIDER_DATA_GET(obj, sd);
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ECORE_CALLBACK_CANCEL);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
edje_object_part_drag_value_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base",
|
2012-05-03 15:42:32 -07:00
|
|
|
&cur_position, NULL);
|
|
|
|
{
|
|
|
|
double adjusted_final;
|
|
|
|
|
2017-06-13 03:41:15 -07:00
|
|
|
adjusted_final = (!efl_ui_mirrored_get(obj)) ?
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position : 1.0 - sd->final_position;
|
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((EINA_DBL_EQ(adjusted_final, 0.0)) ||
|
|
|
|
(EINA_DBL_EQ(adjusted_final, 0.5) && cur_position >= adjusted_final))
|
2012-05-03 15:42:32 -07:00
|
|
|
{
|
|
|
|
new_position = cur_position - move_amount;
|
|
|
|
|
|
|
|
if (new_position <= adjusted_final)
|
|
|
|
{
|
|
|
|
new_position = adjusted_final;
|
|
|
|
flag_finish_animation = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
2017-01-06 09:57:46 -08:00
|
|
|
else if ((EINA_DBL_EQ(adjusted_final, 1.0)) ||
|
|
|
|
(EINA_DBL_EQ(adjusted_final, 0.5) && cur_position < adjusted_final))
|
2012-05-03 15:42:32 -07:00
|
|
|
{
|
|
|
|
new_position = cur_position + move_amount;
|
|
|
|
|
|
|
|
if (new_position >= adjusted_final)
|
|
|
|
{
|
|
|
|
new_position = adjusted_final;
|
|
|
|
flag_finish_animation = EINA_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base",
|
2012-05-03 15:42:32 -07:00
|
|
|
new_position, 0.5);
|
|
|
|
}
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2010-12-07 07:55:11 -08:00
|
|
|
if (flag_finish_animation)
|
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
const char *left, *right, *center;
|
|
|
|
|
|
|
|
_text_get(obj, &left, &right, ¢er);
|
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((!EINA_DBL_EQ(sd->final_position, 0)) &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_LEFT))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-03-19 13:29:39 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTED, (char *)left);
|
2017-01-06 09:57:46 -08:00
|
|
|
else if ((EINA_DBL_EQ(sd->final_position, 0.5)) &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_CENTER))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-03-19 13:29:39 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTED, (char *)center);
|
2017-01-06 09:57:46 -08:00
|
|
|
else if ((EINA_DBL_EQ(sd->final_position, 1)) &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_RIGHT))
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-03-19 13:29:39 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTED, (char *)right);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
sd->button_animator = NULL;
|
|
|
|
|
2011-06-13 20:00:41 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2010-12-07 07:55:11 -08:00
|
|
|
}
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2011-06-13 20:00:41 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
2010-12-07 07:55:11 -08:00
|
|
|
}
|
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
static void
|
2012-05-03 15:42:32 -07:00
|
|
|
_drag_button_up_cb(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)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
Evas_Object *obj = data;
|
2010-10-16 18:44:57 -07:00
|
|
|
double position = 0.0;
|
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
ELM_ACTIONSLIDER_DATA_GET(obj, sd);
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
sd->mouse_down = EINA_FALSE;
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
edje_object_part_drag_value_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base", &position,
|
2012-05-03 15:42:32 -07:00
|
|
|
NULL);
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
const char *left, *right, *center;
|
|
|
|
|
|
|
|
_text_get(obj, &left, &right, ¢er);
|
|
|
|
|
|
|
|
if ((sd->enabled_position & ELM_ACTIONSLIDER_LEFT) &&
|
2017-06-13 03:41:15 -07:00
|
|
|
((!efl_ui_mirrored_get(obj) && EINA_DBL_EQ(position, 0.0)) ||
|
|
|
|
(efl_ui_mirrored_get(obj) && EINA_DBL_EQ(position, 1.0))))
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position = 0;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-03-19 13:29:39 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTED, (char *)left);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
if (position >= 0.45 && position <= 0.55 &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_CENTER))
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position = 0.5;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-03-19 13:29:39 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTED, (char *)center);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_animator_del(sd->button_animator);
|
2018-09-18 07:42:50 -07:00
|
|
|
sd->button_animator = ecore_evas_animator_add(obj, _button_animator, obj);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
return;
|
|
|
|
}
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
if ((sd->enabled_position & ELM_ACTIONSLIDER_RIGHT) &&
|
2017-06-13 03:41:15 -07:00
|
|
|
((!efl_ui_mirrored_get(obj) && EINA_DBL_EQ(position, 1)) ||
|
|
|
|
(efl_ui_mirrored_get(obj) && EINA_DBL_EQ(position, 0))))
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position = 1;
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2019-03-19 13:29:39 -07:00
|
|
|
(obj, EFL_UI_EVENT_SELECTED, (char *)right);
|
2010-10-16 18:44:57 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
if (sd->magnet_position == ELM_ACTIONSLIDER_NONE) return;
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
#define _FIX_POS_ON_MIRROREDNESS(x) \
|
2017-06-13 03:41:15 -07:00
|
|
|
((!efl_ui_mirrored_get(obj)) ? x : 1.0 - x)
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
position = _FIX_POS_ON_MIRROREDNESS(position);
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
if (position < 0.3)
|
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
if (sd->magnet_position & ELM_ACTIONSLIDER_LEFT)
|
|
|
|
sd->final_position = 0;
|
|
|
|
else if (sd->magnet_position & ELM_ACTIONSLIDER_CENTER)
|
|
|
|
sd->final_position = 0.5;
|
|
|
|
else if (sd->magnet_position & ELM_ACTIONSLIDER_RIGHT)
|
|
|
|
sd->final_position = 1;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
else if ((position >= 0.3) && (position <= 0.7))
|
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
if (sd->magnet_position & ELM_ACTIONSLIDER_CENTER)
|
|
|
|
sd->final_position = 0.5;
|
2010-10-16 18:44:57 -07:00
|
|
|
else if (position < 0.5)
|
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
if (sd->magnet_position & ELM_ACTIONSLIDER_LEFT)
|
|
|
|
sd->final_position = 0;
|
2010-10-16 18:44:57 -07:00
|
|
|
else
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position = 1;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
if (sd->magnet_position & ELM_ACTIONSLIDER_RIGHT)
|
|
|
|
sd->final_position = 1;
|
2010-10-16 18:44:57 -07:00
|
|
|
else
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position = 0;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
if (sd->magnet_position & ELM_ACTIONSLIDER_RIGHT)
|
|
|
|
sd->final_position = 1;
|
|
|
|
else if (sd->magnet_position & ELM_ACTIONSLIDER_CENTER)
|
|
|
|
sd->final_position = 0.5;
|
2010-10-16 18:44:57 -07:00
|
|
|
else
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->final_position = 0;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_animator_del(sd->button_animator);
|
2018-09-18 07:42:50 -07:00
|
|
|
sd->button_animator = ecore_evas_animator_add(obj, _button_animator, obj);
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2014-01-12 22:44:44 -08:00
|
|
|
static void
|
|
|
|
_track_move_cb(void *data,
|
2014-01-12 22:46:31 -08:00
|
|
|
Evas_Object *o EINA_UNUSED,
|
2014-01-12 22:44:44 -08:00
|
|
|
const char *emission,
|
2014-01-12 22:46:31 -08:00
|
|
|
const char *source EINA_UNUSED)
|
2014-01-12 22:44:44 -08:00
|
|
|
{
|
|
|
|
Evas_Object *obj = data;
|
|
|
|
|
|
|
|
ELM_ACTIONSLIDER_DATA_GET(obj, sd);
|
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
2014-03-10 07:24:37 -07:00
|
|
|
if (!strcmp(emission, "elm,action,down,right"))
|
2014-01-12 22:44:44 -08:00
|
|
|
{
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_DBL_EQ(sd->final_position, 0.0))
|
2014-01-12 22:44:44 -08:00
|
|
|
{
|
|
|
|
if (sd->enabled_position & ELM_ACTIONSLIDER_CENTER)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "center");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 0.5;
|
|
|
|
}
|
|
|
|
else if (sd->enabled_position & ELM_ACTIONSLIDER_RIGHT)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "right");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 1.0;
|
|
|
|
}
|
|
|
|
}
|
2017-01-06 09:57:46 -08:00
|
|
|
else if (EINA_DBL_EQ(sd->final_position, 0.5) &&
|
2014-01-12 22:44:44 -08:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_RIGHT))
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "right");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 1.0;
|
|
|
|
}
|
|
|
|
}
|
2014-03-10 07:24:37 -07:00
|
|
|
else if (!strcmp(emission, "elm,action,down,center"))
|
2014-01-12 22:44:44 -08:00
|
|
|
{
|
|
|
|
if (sd->enabled_position & ELM_ACTIONSLIDER_CENTER)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "center");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_DBL_EQ(sd->final_position, 1.0))
|
2014-01-12 22:44:44 -08:00
|
|
|
{
|
|
|
|
if (sd->enabled_position & ELM_ACTIONSLIDER_CENTER)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "center");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 0.5;
|
|
|
|
}
|
|
|
|
else if (sd->enabled_position & ELM_ACTIONSLIDER_LEFT)
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "left");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 0.0;
|
|
|
|
}
|
|
|
|
}
|
2017-01-06 09:57:46 -08:00
|
|
|
else if (EINA_DBL_EQ(sd->final_position, 0.5) &&
|
2014-01-12 22:44:44 -08:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_LEFT))
|
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2016-03-02 04:10:48 -08:00
|
|
|
(obj, ELM_ACTIONSLIDER_EVENT_POS_CHANGED, "left");
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->final_position = 0.0;
|
|
|
|
}
|
|
|
|
}
|
2014-01-21 06:16:41 -08:00
|
|
|
ecore_animator_del(sd->button_animator);
|
2018-09-18 07:42:50 -07:00
|
|
|
sd->button_animator = ecore_evas_animator_add(obj, _button_animator, obj);
|
2014-01-12 22:44:44 -08:00
|
|
|
}
|
|
|
|
|
2011-07-04 02:18:04 -07:00
|
|
|
static void
|
2012-05-03 15:42:32 -07:00
|
|
|
_mirrored_part_fix(const Evas_Object *obj,
|
|
|
|
const char **part)
|
2011-07-04 02:18:04 -07:00
|
|
|
{
|
2017-06-13 03:41:15 -07:00
|
|
|
if (efl_ui_mirrored_get(obj))
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
/* exchange left and right */
|
|
|
|
if (!strcmp(*part, "left")) *part = "right";
|
|
|
|
else if (!strcmp(*part, "right"))
|
|
|
|
*part = "left";
|
|
|
|
else if (!strcmp(*part, "elm.text.right"))
|
|
|
|
*part = "elm.text.left";
|
|
|
|
else if (!strcmp(*part, "elm.text.left"))
|
|
|
|
*part = "elm.text.right";
|
2011-07-04 02:18:04 -07:00
|
|
|
}
|
2012-05-02 09:59:12 -07:00
|
|
|
}
|
|
|
|
|
2017-07-05 04:06:24 -07:00
|
|
|
static Eina_Bool
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_actionslider_text_set(Eo *obj, Elm_Actionslider_Data *_pd EINA_UNUSED, const char *part, const char *text)
|
2012-05-03 15:42:32 -07:00
|
|
|
{
|
2017-06-04 07:25:36 -07:00
|
|
|
Eina_Bool int_ret = EINA_TRUE;
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_mirrored_part_fix(obj, &part);
|
2017-06-29 11:33:12 -07:00
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
efl_text_set(efl_part(efl_super(obj, MY_CLASS), part), text);
|
2013-07-22 14:05:16 -07:00
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
return int_ret;
|
2012-05-03 15:42:32 -07:00
|
|
|
}
|
|
|
|
|
2017-07-05 04:06:24 -07:00
|
|
|
static const char *
|
2017-06-04 07:25:36 -07:00
|
|
|
_elm_actionslider_text_get(Eo *obj, Elm_Actionslider_Data *_pd EINA_UNUSED, const char *part)
|
2012-05-02 09:59:12 -07:00
|
|
|
{
|
2014-04-03 06:09:52 -07:00
|
|
|
const char *text = NULL;
|
2012-05-02 09:59:12 -07:00
|
|
|
|
2017-07-04 02:54:44 -07:00
|
|
|
if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
|
|
|
|
return NULL;
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_mirrored_part_fix(obj, &part);
|
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
text = efl_text_get(efl_part(efl_super(obj, MY_CLASS), part));
|
2014-03-18 05:27:07 -07:00
|
|
|
|
|
|
|
return text;
|
2012-05-03 15:42:32 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static void
|
2016-06-17 01:26:08 -07:00
|
|
|
_elm_actionslider_efl_canvas_group_group_add(Eo *obj, Elm_Actionslider_Data *priv)
|
2012-05-03 15:42:32 -07:00
|
|
|
{
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_add(efl_super(obj, MY_CLASS));
|
2013-09-24 21:33:39 -07:00
|
|
|
elm_widget_sub_object_parent_add(obj);
|
2013-08-26 08:29:45 -07:00
|
|
|
|
2012-05-03 15:42:32 -07:00
|
|
|
priv->enabled_position = ELM_ACTIONSLIDER_ALL;
|
|
|
|
|
|
|
|
priv->drag_button_base =
|
|
|
|
evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_color_set(priv->drag_button_base, 0, 0, 0, 0);
|
|
|
|
|
actionslider: Fixed wrong signal names but still support backward
compatibility.
- "elm.drag_button,mouse,up" -> "elm,action,up,drag_button"
- "elm.drag_button,mouse,down" -> "elm,action,down,drag_button"
- "elm.drag_button,mouse,move" -> "elm,action,move,drag_button"
This is not the target of backport.
2014-03-10 10:27:26 -07:00
|
|
|
// dirty support for the backward compatibility
|
2012-05-03 15:42:32 -07:00
|
|
|
edje_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(wd->resize_obj, "elm.drag_button,mouse,up", "*",
|
2012-05-03 15:42:32 -07:00
|
|
|
_drag_button_up_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(wd->resize_obj, "elm.drag_button,mouse,down", "*",
|
2013-04-24 04:41:37 -07:00
|
|
|
_drag_button_down_cb, obj);
|
2012-05-03 15:42:32 -07:00
|
|
|
edje_object_signal_callback_add
|
2013-10-05 05:35:27 -07:00
|
|
|
(wd->resize_obj, "elm.drag_button,mouse,move", "*",
|
2012-05-03 15:42:32 -07:00
|
|
|
_drag_button_move_cb, obj);
|
actionslider: Fixed wrong signal names but still support backward
compatibility.
- "elm.drag_button,mouse,up" -> "elm,action,up,drag_button"
- "elm.drag_button,mouse,down" -> "elm,action,down,drag_button"
- "elm.drag_button,mouse,move" -> "elm,action,move,drag_button"
This is not the target of backport.
2014-03-10 10:27:26 -07:00
|
|
|
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,up,drag_button", "elm",
|
|
|
|
_drag_button_up_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,down,drag_button", "elm",
|
|
|
|
_drag_button_down_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
|
|
|
(wd->resize_obj, "elm,action,move,drag_button", "elm",
|
|
|
|
_drag_button_move_cb, obj);
|
2014-01-12 22:44:44 -08:00
|
|
|
edje_object_signal_callback_add
|
2014-03-10 07:24:37 -07:00
|
|
|
(wd->resize_obj, "elm,action,down,right", "*",
|
2014-01-12 22:44:44 -08:00
|
|
|
_track_move_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
2014-03-10 07:24:37 -07:00
|
|
|
(wd->resize_obj, "elm,action,down,left", "*",
|
2014-01-12 22:44:44 -08:00
|
|
|
_track_move_cb, obj);
|
|
|
|
edje_object_signal_callback_add
|
2014-03-10 07:24:37 -07:00
|
|
|
(wd->resize_obj, "elm,action,down,center", "*",
|
2014-01-12 22:44:44 -08:00
|
|
|
_track_move_cb, obj);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "actionslider", "base", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
elm_layout_content_set(obj, "elm.drag_button_base", priv->drag_button_base);
|
2012-07-17 11:45:04 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-05-03 15:42:32 -07:00
|
|
|
}
|
|
|
|
|
2010-10-16 18:44:57 -07:00
|
|
|
EAPI Evas_Object *
|
2010-12-01 01:54:20 -08:00
|
|
|
elm_actionslider_add(Evas_Object *parent)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2017-11-06 21:00:43 -08:00
|
|
|
return elm_legacy_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_actionslider_efl_object_constructor(Eo *obj, Elm_Actionslider_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);
|
2018-04-03 04:27:30 -07:00
|
|
|
efl_access_object_role_set(obj, EFL_ACCESS_ROLE_SLIDER);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_actionslider_indicator_pos_set(Eo *obj, Elm_Actionslider_Data *_pd EINA_UNUSED, Elm_Actionslider_Pos pos)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
|
|
|
double position = 0.0;
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2013-10-05 01:13:23 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
pos = _get_pos_by_orientation(obj, pos);
|
2010-12-01 01:54:20 -08:00
|
|
|
if (pos == ELM_ACTIONSLIDER_CENTER) position = 0.5;
|
2012-05-03 15:42:32 -07:00
|
|
|
else if (pos == ELM_ACTIONSLIDER_RIGHT)
|
|
|
|
position = 1.0;
|
|
|
|
|
|
|
|
edje_object_part_drag_value_set
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base", position, 0.5);
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static Elm_Actionslider_Pos
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_actionslider_indicator_pos_get(const Eo *obj, Elm_Actionslider_Data *_pd EINA_UNUSED)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
|
|
|
double position;
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
Elm_Actionslider_Pos ret = ELM_ACTIONSLIDER_NONE;
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ELM_ACTIONSLIDER_NONE);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
edje_object_part_drag_value_get
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, "elm.drag_button_base", &position,
|
2012-05-03 15:42:32 -07:00
|
|
|
NULL);
|
2010-10-16 18:44:57 -07:00
|
|
|
if (position < 0.3)
|
2014-03-18 05:27:07 -07:00
|
|
|
ret = _get_pos_by_orientation(obj, ELM_ACTIONSLIDER_LEFT);
|
2010-10-16 18:44:57 -07:00
|
|
|
else if (position < 0.7)
|
2014-03-18 05:27:07 -07:00
|
|
|
ret = ELM_ACTIONSLIDER_CENTER;
|
2010-10-16 18:44:57 -07:00
|
|
|
else
|
2014-03-18 05:27:07 -07:00
|
|
|
ret = _get_pos_by_orientation(obj, ELM_ACTIONSLIDER_RIGHT);
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
return ret;
|
|
|
|
}
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_actionslider_magnet_pos_set(Eo *obj EINA_UNUSED, Elm_Actionslider_Data *sd, Elm_Actionslider_Pos pos)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
sd->magnet_position = pos;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static Elm_Actionslider_Pos
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_actionslider_magnet_pos_get(const Eo *obj EINA_UNUSED, Elm_Actionslider_Data *sd)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
return sd->magnet_position;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15:42:32 -07:00
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static void
|
|
|
|
_elm_actionslider_enabled_pos_set(Eo *obj EINA_UNUSED, Elm_Actionslider_Data *sd, Elm_Actionslider_Pos pos)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->enabled_position = pos;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static Elm_Actionslider_Pos
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_actionslider_enabled_pos_get(const Eo *obj EINA_UNUSED, Elm_Actionslider_Data *sd)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
return sd->enabled_position;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static const char*
|
2018-04-17 11:09:44 -07:00
|
|
|
_elm_actionslider_selected_label_get(const Eo *obj, Elm_Actionslider_Data *sd)
|
2010-10-16 18:44:57 -07:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
const char *ret;
|
|
|
|
ret = NULL;
|
2012-05-03 15:42:32 -07:00
|
|
|
const char *left, *right, *center;
|
|
|
|
|
|
|
|
_text_get(obj, &left, &right, ¢er);
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((EINA_DBL_EQ(sd->final_position, 0.0)) &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_LEFT))
|
2014-03-18 05:27:07 -07:00
|
|
|
ret = left;
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((EINA_DBL_EQ(sd->final_position, 0.5)) &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_CENTER))
|
2014-03-18 05:27:07 -07:00
|
|
|
ret = center;
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2017-01-06 09:57:46 -08:00
|
|
|
if ((EINA_DBL_EQ(sd->final_position, 1.0)) &&
|
2012-05-03 15:42:32 -07:00
|
|
|
(sd->enabled_position & ELM_ACTIONSLIDER_RIGHT))
|
2014-03-18 05:27:07 -07:00
|
|
|
ret = right;
|
|
|
|
|
|
|
|
return ret;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2010-10-16 18:44:57 -07:00
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
static void
|
2016-08-10 07:23:04 -07:00
|
|
|
_elm_actionslider_class_constructor(Efl_Class *klass)
|
2012-11-25 22:32:53 -08: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-18 05:27:07 -07:00
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
/* Efl.Part begin */
|
2017-09-19 04:02:26 -07:00
|
|
|
ELM_PART_OVERRIDE(elm_actionslider, ELM_ACTIONSLIDER, Elm_Actionslider_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(elm_actionslider, ELM_ACTIONSLIDER, Elm_Actionslider_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_GET(elm_actionslider, ELM_ACTIONSLIDER, Elm_Actionslider_Data)
|
2017-06-04 07:25:36 -07:00
|
|
|
|
edje/elm: Rename _internal_ to _part_ (EO)
In Edje and Elementary, we have part objects, which are what is returned
by the interface efl_part(). Those objects can't be of an opaque type as
this doesn't work nicely with strongly typed languages such as C++ or
C#. In JS, Lua, C the types are weak and mostly runtime-based so it
doesn't matter much.
As a consequence, the documentation and the types need to look nice in
this EO API. Thus, we remove the abusive term "internal" and explicitly
call all those classes "part" something.
Eventually we want the types to be declared in the EO file so bindings
(C#, C++, ...) can generate the proper access methods, returning the
best possible types.
Note that right now a few of those part types are used in the legacy API
but don't actually need to be exposed externally.
This is kind of a mega commit that does all the renaming at once, but
it's really just a big sed operation. The power of good IDEs :)
Ref T5315
Ref T5306
2017-09-12 21:29:25 -07:00
|
|
|
#include "elm_actionslider_part.eo.c"
|
2017-06-04 07:25:36 -07:00
|
|
|
/* Efl.Part end */
|
|
|
|
|
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-18 01:52:17 -07:00
|
|
|
#define ELM_ACTIONSLIDER_EXTRA_OPS \
|
2017-08-07 19:48:31 -07:00
|
|
|
ELM_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
|
2017-08-07 00:13:38 -07:00
|
|
|
ELM_LAYOUT_SIZING_EVAL_OPS(elm_actionslider), \
|
2017-05-18 01:52:17 -07:00
|
|
|
EFL_CANVAS_GROUP_ADD_OPS(elm_actionslider)
|
|
|
|
|
2019-03-05 14:00:37 -08:00
|
|
|
#include "elm_actionslider_eo.c"
|