2013-04-25 22:13:00 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-17 08:56:11 -07:00
|
|
|
#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
|
2016-04-20 05:07:38 -07:00
|
|
|
#define ELM_LAYOUT_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
|
|
|
|
2016-10-18 03:34:12 -07:00
|
|
|
#include "elm_actionslider.eo.h"
|
|
|
|
|
2017-06-04 07:25:36 -07:00
|
|
|
#include "elm_actionslider_internal_part.eo.h"
|
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2014-06-03 03:35:28 -07:00
|
|
|
#define MY_CLASS ELM_ACTIONSLIDER_CLASS
|
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
|
|
|
}
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
EOLIAN static Elm_Theme_Apply
|
2014-03-18 05:27:07 -07:00
|
|
|
_elm_actionslider_elm_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;
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
Elm_Theme_Apply int_ret = ELM_THEME_APPLY_FAILED;
|
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
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ELM_THEME_APPLY_FAILED);
|
2012-05-03 15:42:32 -07:00
|
|
|
|
|
|
|
mirrored = elm_object_mirrored_get(obj);
|
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = elm_obj_widget_theme_apply(efl_super(obj, MY_CLASS));
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
if (!int_ret) return ELM_THEME_APPLY_FAILED;
|
2012-05-03 15: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
|
2016-06-10 01:58:17 -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
|
2016-06-10 01:58:17 -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
|
2016-06-10 01:58:17 -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
|
2016-06-10 01:58:17 -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
|
2016-06-10 01:58:17 -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);
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->button_animator = ecore_animator_add(_button_animator, obj);
|
|
|
|
|
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
|
2016-06-10 01:58:17 -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);
|
2012-05-03 15:42:32 -07:00
|
|
|
sd->button_animator = ecore_animator_add(_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);
|
2014-01-12 22:44:44 -08:00
|
|
|
sd->button_animator = ecore_animator_add(_button_animator, obj);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static const Elm_Layout_Part_Alias_Description*
|
|
|
|
_elm_actionslider_elm_layout_text_aliases_get(Eo *obj EINA_UNUSED, Elm_Actionslider_Data *_pd EINA_UNUSED)
|
2012-07-31 15:06:16 -07:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
return _text_aliases;
|
2011-07-04 02:18:04 -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-07-06 00:47:41 -07:00
|
|
|
return efl_add(MY_CLASS, parent, efl_canvas_object_legacy_ctor(efl_added));
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
2012-05-03 15: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);
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_interface_atspi_accessible_role_set(obj, ELM_ATSPI_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
|
|
|
|
_elm_actionslider_indicator_pos_get(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
|
|
|
|
_elm_actionslider_magnet_pos_get(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
|
|
|
|
_elm_actionslider_enabled_pos_get(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*
|
|
|
|
_elm_actionslider_selected_label_get(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
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_actionslider_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Elm_Actionslider_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
return EINA_FALSE;
|
2010-10-16 18:44:57 -07:00
|
|
|
}
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
EOLIAN static Eina_Bool
|
|
|
|
_elm_actionslider_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Actionslider_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-18 05:27:07 -07:00
|
|
|
return EINA_FALSE;
|
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 */
|
|
|
|
ELM_PART_OVERRIDE(elm_actionslider, ELM_ACTIONSLIDER, ELM_LAYOUT, Elm_Actionslider_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_SET(elm_actionslider, ELM_ACTIONSLIDER, ELM_LAYOUT, Elm_Actionslider_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_TEXT_GET(elm_actionslider, ELM_ACTIONSLIDER, ELM_LAYOUT, Elm_Actionslider_Data, Elm_Part_Data)
|
|
|
|
|
|
|
|
#include "elm_actionslider_internal_part.eo.c"
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
|
|
|
#define ELM_ACTIONSLIDER_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_OPS(elm_actionslider)
|
|
|
|
|
2014-03-18 05:27:07 -07:00
|
|
|
#include "elm_actionslider.eo.c"
|