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
|
|
|
|
2009-08-12 09:16:31 -07:00
|
|
|
#include <Elementary.h>
|
2013-04-25 22:13:00 -07:00
|
|
|
|
2009-08-12 09:16:31 -07:00
|
|
|
#include "elm_priv.h"
|
2017-05-23 02:30:00 -07:00
|
|
|
#include "efl_ui_progressbar_private.h"
|
2012-11-25 22:32:53 -08:00
|
|
|
#include "elm_widget_layout.h"
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
#include "efl_ui_progressbar_internal_part.eo.h"
|
2016-05-24 04:40:18 -07:00
|
|
|
#include "elm_part_helper.h"
|
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
#define MY_CLASS EFL_UI_PROGRESSBAR_CLASS
|
2012-11-25 22:32:53 -08:00
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
#define MY_CLASS_NAME "Efl.Ui.Progressbar"
|
2013-11-07 03:44:22 -08:00
|
|
|
#define MY_CLASS_NAME_LEGACY "elm_progressbar"
|
2009-08-12 09:16:31 -07:00
|
|
|
|
2012-06-22 15:45:13 -07:00
|
|
|
static const char SIG_CHANGED[] = "changed";
|
|
|
|
|
2009-08-12 09:16:31 -07:00
|
|
|
#define MIN_RATIO_LVL 0.0
|
|
|
|
#define MAX_RATIO_LVL 1.0
|
|
|
|
|
2012-06-22 15:45:13 -07:00
|
|
|
/* smart callbacks coming from elm progressbar objects (besides the
|
|
|
|
* ones coming from elm layout): */
|
|
|
|
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-06-22 15:45:13 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2012-05-03 15:43:37 -07:00
|
|
|
{"icon", "elm.swallow.content"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2009-08-12 09:16:31 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
static const Elm_Layout_Part_Alias_Description _text_aliases[] =
|
2011-02-08 04:08:28 -08:00
|
|
|
{
|
2012-05-03 15:43:37 -07:00
|
|
|
{"default", "elm.text"},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2011-02-08 04:08:28 -08:00
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
static Efl_Ui_Progress_Status *
|
2013-09-09 23:47:13 -07:00
|
|
|
_progress_status_new(const char *part_name, double val)
|
|
|
|
{
|
2017-05-23 02:30:00 -07:00
|
|
|
Efl_Ui_Progress_Status *ps;
|
|
|
|
ps = calloc(1, sizeof(Efl_Ui_Progress_Status));
|
2013-09-09 23:47:13 -07:00
|
|
|
ps->part_name = eina_stringshare_add(part_name);
|
|
|
|
ps->val = val;
|
|
|
|
return ps;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
2017-05-23 02:30:00 -07:00
|
|
|
_progress_status_free(Efl_Ui_Progress_Status *ps)
|
2013-09-09 23:47:13 -07:00
|
|
|
{
|
|
|
|
eina_stringshare_del(ps->part_name);
|
|
|
|
free(ps);
|
|
|
|
}
|
2016-04-07 00:50:03 -07:00
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_is_horizontal(Efl_Orient orientation)
|
|
|
|
{
|
|
|
|
if (orientation == EFL_ORIENT_LEFT ||
|
|
|
|
orientation == EFL_ORIENT_RIGHT)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline Eina_Bool
|
|
|
|
_is_inverted(Efl_Orient orientation)
|
|
|
|
{
|
|
|
|
if (orientation == EFL_ORIENT_LEFT ||
|
|
|
|
orientation == EFL_ORIENT_UP)
|
|
|
|
return EINA_TRUE;
|
|
|
|
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-05-02 18:19:05 -07:00
|
|
|
static void
|
2012-05-03 15:43:37 -07:00
|
|
|
_units_set(Evas_Object *obj)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2012-05-03 15:43:37 -07:00
|
|
|
ELM_PROGRESSBAR_DATA_GET(obj, sd);
|
2009-08-12 09:16:31 -07:00
|
|
|
|
2012-06-15 09:32:54 -07:00
|
|
|
if (sd->unit_format_func)
|
|
|
|
{
|
|
|
|
char *buf;
|
|
|
|
|
|
|
|
buf = sd->unit_format_func(sd->val);
|
|
|
|
elm_layout_text_set(obj, "elm.text.status", buf);
|
|
|
|
if (sd->unit_format_free) sd->unit_format_free(buf);
|
|
|
|
}
|
|
|
|
else if (sd->units)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-05-03 15:43:37 -07:00
|
|
|
char buf[1024];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), sd->units, 100 * sd->val);
|
|
|
|
elm_layout_text_set(obj, "elm.text.status", buf);
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-03 15:43:37 -07:00
|
|
|
else elm_layout_text_set(obj, "elm.text.status", NULL);
|
|
|
|
}
|
2009-10-22 15:10:23 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
static void
|
|
|
|
_val_set(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Eina_Bool rtl;
|
|
|
|
double pos;
|
2012-05-02 10:00:48 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
ELM_PROGRESSBAR_DATA_GET(obj, sd);
|
2013-10-05 01:15:19 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-02 10:00:48 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
rtl = elm_widget_mirrored_get(obj);
|
2017-05-23 02:30:00 -07:00
|
|
|
Efl_Ui_Progress_Status *ps;
|
2013-09-09 23:47:13 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->progress_status, l, ps)
|
|
|
|
{
|
|
|
|
pos = ps->val;
|
2016-04-07 00:50:03 -07:00
|
|
|
if ((!rtl && _is_inverted(sd->orientation)) ||
|
|
|
|
(rtl && ((sd->orientation == EFL_ORIENT_UP) ||
|
|
|
|
(sd->orientation == EFL_ORIENT_RIGHT))))
|
2013-09-09 23:47:13 -07:00
|
|
|
pos = MAX_RATIO_LVL - pos;
|
2011-04-01 04:24:15 -07:00
|
|
|
|
2013-09-09 23:47:13 -07:00
|
|
|
edje_object_part_drag_value_set
|
|
|
|
(wd->resize_obj, ps->part_name, pos, pos);
|
|
|
|
}
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2009-11-09 04:55:50 -08:00
|
|
|
Evas_Coord minw = -1, minh = -1;
|
2013-10-05 01:15:19 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
edje_object_size_min_restricted_calc
|
2012-11-25 22:32:53 -08:00
|
|
|
(wd->resize_obj, &minw, &minh, minw, minh);
|
2009-08-12 09:16:31 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
2009-11-09 04:55:50 -08:00
|
|
|
evas_object_size_hint_max_set(obj, -1, -1);
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
/* FIXME: replicated from elm_layout just because progressbar's icon
|
|
|
|
* spot is elm.swallow.content, not elm.swallow.icon. Fix that
|
|
|
|
* whenever we can changed the theme API */
|
2009-08-12 09:16:31 -07:00
|
|
|
static void
|
2012-05-03 15:43:37 -07:00
|
|
|
_icon_signal_emit(Evas_Object *obj)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2012-05-03 15:43:37 -07:00
|
|
|
char buf[64];
|
|
|
|
|
|
|
|
snprintf(buf, sizeof(buf), "elm,state,icon,%s",
|
|
|
|
elm_layout_content_get(obj, "icon") ? "visible" : "hidden");
|
|
|
|
|
|
|
|
elm_layout_signal_emit(obj, buf, "elm");
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 10:00:48 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
/* FIXME: replicated from elm_layout just because progressbar's icon
|
|
|
|
* spot is elm.swallow.content, not elm.swallow.icon. Fix that
|
|
|
|
* whenever we can changed the theme API */
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_widget_sub_object_del(Eo *obj, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED, Evas_Object *sobj)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = elm_obj_widget_sub_object_del(efl_super(obj, MY_CLASS), sobj);
|
2014-05-10 07:15:54 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
return EINA_TRUE;
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2012-05-02 10:00:48 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
/* FIXME: replicated from elm_layout just because progressbar's icon
|
|
|
|
* spot is elm.swallow.content, not elm.swallow.icon. Fix that
|
|
|
|
* whenever we can changed the theme API */
|
2016-05-24 04:40:18 -07:00
|
|
|
static Eina_Bool
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_content_set(Eo *obj, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED, const char *part, Evas_Object *content)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2012-11-25 22:32:53 -08:00
|
|
|
Eina_Bool int_ret = EINA_FALSE;
|
2016-08-15 06:44:41 -07:00
|
|
|
int_ret = efl_content_set(efl_part(efl_super(obj, MY_CLASS), part), content);
|
2014-05-10 07:15:54 -07:00
|
|
|
if (!int_ret) return EINA_FALSE;
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
return EINA_TRUE;
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
EOLIAN static Elm_Theme_Apply
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_widget_theme_apply(Eo *obj, Efl_Ui_Progressbar_Data *sd)
|
2011-07-04 03:13:53 -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_Theme_Apply int_ret = ELM_THEME_APPLY_FAILED;
|
2013-10-05 01:29:13 -07:00
|
|
|
ELM_LAYOUT_DATA_GET(obj, ld);
|
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:43:37 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
if (_is_horizontal(sd->orientation))
|
2012-11-25 22:32:53 -08:00
|
|
|
eina_stringshare_replace(&ld->group, "horizontal");
|
|
|
|
else eina_stringshare_replace(&ld->group, "vertical");
|
2012-05-03 15:43:37 -07:00
|
|
|
|
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:43:37 -07:00
|
|
|
|
|
|
|
if (sd->pulse)
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,pulse", "elm");
|
2012-05-02 18:19:05 -07:00
|
|
|
else
|
2012-05-03 15:43:37 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,fraction", "elm");
|
2011-07-04 03:13:53 -07:00
|
|
|
|
2012-05-03 15:43:37 -07:00
|
|
|
if (sd->pulse_state)
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,pulse,start", "elm");
|
|
|
|
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
if (((sd->units) || (sd->unit_format_func)) && (!sd->pulse))
|
2012-05-03 15:43:37 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,units,visible", "elm");
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
if (_is_horizontal(sd->orientation))
|
2012-05-03 15:43:37 -07:00
|
|
|
evas_object_size_hint_min_set
|
|
|
|
(sd->spacer, (double)sd->size * elm_widget_scale_get(obj) *
|
|
|
|
elm_config_scale_get(), 1);
|
2012-05-02 18:19:05 -07:00
|
|
|
else
|
2012-05-03 15:43:37 -07:00
|
|
|
evas_object_size_hint_min_set
|
|
|
|
(sd->spacer, 1, (double)sd->size * elm_widget_scale_get(obj) *
|
|
|
|
elm_config_scale_get());
|
2012-05-02 10:00:48 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
if (_is_inverted(sd->orientation))
|
2012-05-03 15:43:37 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,inverted,on", "elm");
|
2016-04-07 00:50:03 -07:00
|
|
|
else
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,inverted,off", "elm");
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
_units_set(obj);
|
|
|
|
_val_set(obj);
|
|
|
|
|
|
|
|
/* FIXME: replicated from elm_layout just because progressbar's
|
|
|
|
* icon spot is elm.swallow.content, not elm.swallow.icon. Fix that
|
|
|
|
* whenever we can changed the theme API */
|
|
|
|
_icon_signal_emit(obj);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
|
theme: return enum from elm_widget_style_set instead of bool
Summary:
if trying to apply incorrect theme, widget apply default theme and return TRUE.
so there is no way to check it really apply correct theme.
To resolve this problem, _elm_theme_set return three type enum
* related history : 4ca3ef45146e05908a13d1010909abeba9693ad6
* elm_object_style_set is public api, so I didn't change it.
* typedef name [ Theme_Apply ] is temporarily, please suggest better one.
@fix
Reviewers: singh.amitesh, herb, Hermet, cedric, jpeg, raster
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4073
2016-06-30 23:09:42 -07:00
|
|
|
return int_ret;
|
2011-07-04 03:13:53 -07:00
|
|
|
}
|
|
|
|
|
2012-08-18 06:52:03 -07:00
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
const char *txt = elm_widget_access_info_get(obj);
|
|
|
|
|
|
|
|
if (!txt) txt = elm_layout_text_get(obj, NULL);
|
|
|
|
if (txt) return strdup(txt);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
2014-01-06 06:30:02 -08:00
|
|
|
_access_state_cb(void *data EINA_UNUSED, Evas_Object *obj)
|
2012-08-18 06:52:03 -07:00
|
|
|
{
|
|
|
|
char *ret;
|
|
|
|
Eina_Strbuf *buf;
|
|
|
|
buf = eina_strbuf_new();
|
|
|
|
|
|
|
|
const char *txt = elm_layout_text_get(obj, "elm.text.status");
|
|
|
|
if (txt) eina_strbuf_append(buf, txt);
|
|
|
|
|
|
|
|
if (elm_widget_disabled_get(obj))
|
|
|
|
eina_strbuf_append(buf, " state: disabled");
|
|
|
|
|
|
|
|
if (eina_strbuf_length_get(buf))
|
|
|
|
{
|
|
|
|
ret = eina_strbuf_string_steal(buf);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Progressbar_Data *priv)
|
2011-10-30 19:56:03 -07:00
|
|
|
{
|
2013-10-05 01:15:19 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2012-05-03 15:43:37 -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 22:19:19 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
priv->orientation = EFL_ORIENT_RIGHT;
|
2012-05-03 15:43:37 -07:00
|
|
|
priv->units = eina_stringshare_add("%.0f %%");
|
|
|
|
priv->val = MIN_RATIO_LVL;
|
|
|
|
|
2013-03-01 18:04:31 -08:00
|
|
|
if (!elm_layout_theme_set
|
|
|
|
(obj, "progressbar", "horizontal", elm_widget_style_get(obj)))
|
2013-12-25 20:03:55 -08:00
|
|
|
CRI("Failed to set layout!");
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
priv->spacer = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
evas_object_color_set(priv->spacer, 0, 0, 0, 0);
|
|
|
|
evas_object_pass_events_set(priv->spacer, EINA_TRUE);
|
|
|
|
|
|
|
|
elm_layout_content_set(obj, "elm.swallow.bar", priv->spacer);
|
|
|
|
|
|
|
|
_units_set(obj);
|
|
|
|
_val_set(obj);
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
|
|
|
|
if (_elm_config->access_mode == ELM_ACCESS_MODE_ON)
|
|
|
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
|
|
|
|
2012-11-25 22:32:53 -08:00
|
|
|
_elm_access_object_register(obj, wd->resize_obj);
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_text_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_TYPE, E_("progressbar"));
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_INFO, _access_info_cb, NULL);
|
2012-08-18 06:52:03 -07:00
|
|
|
_elm_access_callback_set
|
2013-07-30 20:53:04 -07:00
|
|
|
(_elm_access_info_get(obj), ELM_ACCESS_STATE, _access_state_cb, NULL);
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2011-10-30 19:56:03 -07:00
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_canvas_group_group_del(Eo *obj, Efl_Ui_Progressbar_Data *sd)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2017-05-23 02:30:00 -07:00
|
|
|
Efl_Ui_Progress_Status *progress_obj;
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2014-01-21 17:12:44 -08:00
|
|
|
eina_stringshare_del(sd->units);
|
2015-01-06 23:49:08 -08:00
|
|
|
sd->units = NULL;
|
2013-09-09 23:47:13 -07:00
|
|
|
if (sd->progress_status)
|
|
|
|
{
|
|
|
|
EINA_LIST_FREE(sd->progress_status, progress_obj)
|
|
|
|
{
|
|
|
|
_progress_status_free(progress_obj);
|
|
|
|
}
|
|
|
|
}
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2016-08-15 06:44:41 -07:00
|
|
|
efl_canvas_group_del(efl_super(obj, MY_CLASS));
|
2012-05-02 18:19:05 -07:00
|
|
|
}
|
2011-10-30 19:56:03 -07:00
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static const Elm_Layout_Part_Alias_Description*
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_layout_text_aliases_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED)
|
2012-05-02 18:19:05 -07:00
|
|
|
{
|
2014-03-26 00:36:41 -07:00
|
|
|
return _text_aliases;
|
2012-07-31 15:06:41 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static const Elm_Layout_Part_Alias_Description*
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_layout_content_aliases_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED)
|
2012-07-31 15:06:41 -07:00
|
|
|
{
|
2014-03-26 00:36:41 -07:00
|
|
|
return _content_aliases;
|
2012-05-03 15:43:37 -07:00
|
|
|
}
|
2012-05-02 18:19:05 -07:00
|
|
|
|
2009-08-12 09:16:31 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_progressbar_add(Evas_Object *parent)
|
|
|
|
{
|
2012-05-03 15:43:37 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object *obj = efl_add(MY_CLASS, parent);
|
2012-11-25 22:32:53 -08:00
|
|
|
return obj;
|
|
|
|
}
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2015-05-19 05:34:07 -07:00
|
|
|
EOLIAN static Eo *
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_object_constructor(Eo *obj, Efl_Ui_Progressbar_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_PROGRESS_BAR);
|
2015-05-19 05:34:07 -07:00
|
|
|
|
|
|
|
return obj;
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 22:12:34 -07:00
|
|
|
_efl_ui_progressbar_pulse_mode_set(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd, Eina_Bool pulse)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
|
|
|
pulse = !!pulse;
|
2012-05-03 15:43:37 -07:00
|
|
|
if (sd->pulse == pulse) return;
|
|
|
|
|
|
|
|
sd->pulse = pulse;
|
|
|
|
|
2016-03-02 04:10:48 -08:00
|
|
|
elm_obj_widget_theme_apply(obj);
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-23 22:12:34 -07:00
|
|
|
_efl_ui_progressbar_pulse_mode_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2014-03-26 00:36:41 -07:00
|
|
|
return sd->pulse;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_orientation_orientation_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Efl_Orient dir)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
sd->orientation = dir;
|
|
|
|
|
|
|
|
elm_obj_widget_theme_apply(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Orient
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_orientation_orientation_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
return sd->orientation;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_ui_progress_span_size_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Evas_Coord size)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
if (sd->size == size) return;
|
|
|
|
|
|
|
|
sd->size = size;
|
|
|
|
|
|
|
|
if (_is_horizontal(sd->orientation))
|
|
|
|
evas_object_size_hint_min_set
|
|
|
|
(sd->spacer, (double)sd->size * elm_widget_scale_get(obj) *
|
|
|
|
elm_config_scale_get(), 1);
|
|
|
|
else
|
|
|
|
evas_object_size_hint_min_set
|
|
|
|
(sd->spacer, 1, (double)sd->size * elm_widget_scale_get(obj) *
|
|
|
|
elm_config_scale_get());
|
|
|
|
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Evas_Coord
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_ui_progress_span_size_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
return sd->size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_ui_progress_progress_value_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, double val)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
2017-01-06 09:57:46 -08:00
|
|
|
if (EINA_DBL_EQ(sd->val, val)) return;
|
2016-04-07 00:50:03 -07:00
|
|
|
|
|
|
|
elm_progressbar_part_value_set(obj, "elm.cur.progressbar", val);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static double
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_ui_progress_progress_value_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
return sd->val;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_ui_progress_unit_format_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, const char *units)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
const char *sig;
|
2016-04-07 00:50:03 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
|
|
|
|
|
|
|
eina_stringshare_replace(&sd->units, units);
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
sig = (units) ? "elm,state,units,visible" : "elm,state,units,hidden";
|
|
|
|
elm_layout_signal_emit(obj, sig, "elm");
|
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2016-04-07 00:50:03 -07:00
|
|
|
|
|
|
|
_units_set(obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_efl_ui_progress_unit_format_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
return sd->units;
|
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 22:12:34 -07:00
|
|
|
_efl_ui_progressbar_pulse_set(Eo *obj, Efl_Ui_Progressbar_Data *sd, Eina_Bool state)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2009-08-12 09:16:31 -07:00
|
|
|
state = !!state;
|
2013-02-19 19:08:33 -08:00
|
|
|
if ((!sd->pulse) || (sd->pulse_state == state)) return;
|
2012-05-03 15:43:37 -07:00
|
|
|
|
|
|
|
sd->pulse_state = state;
|
|
|
|
|
|
|
|
if (sd->pulse_state)
|
|
|
|
elm_layout_signal_emit(obj, "elm,state,pulse,start", "elm");
|
2009-08-12 09:16:31 -07:00
|
|
|
else
|
2012-05-03 15:43:37 -07:00
|
|
|
elm_layout_signal_emit(obj, "elm,state,pulse,stop", "elm");
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2016-09-01 16:58:27 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-23 22:12:34 -07:00
|
|
|
_efl_ui_progressbar_pulse_get(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd)
|
2016-09-01 16:58:27 -07:00
|
|
|
{
|
|
|
|
return (sd->pulse_state && sd->pulse);
|
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_part_value_set(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd, const char *part_name, double val)
|
2013-09-09 23:47:13 -07:00
|
|
|
{
|
2017-05-23 02:30:00 -07:00
|
|
|
Efl_Ui_Progress_Status *ps;
|
2013-09-09 23:47:13 -07:00
|
|
|
Eina_Bool existing_ps = EINA_FALSE;
|
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
if (val < MIN_RATIO_LVL) val = MIN_RATIO_LVL;
|
|
|
|
if (val > MAX_RATIO_LVL) val = MAX_RATIO_LVL;
|
|
|
|
|
|
|
|
if (!strcmp(part_name, "elm.cur.progressbar"))
|
|
|
|
sd->val = val;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->progress_status, l, ps)
|
|
|
|
{
|
|
|
|
if (!strcmp(ps->part_name, part_name))
|
|
|
|
{
|
|
|
|
existing_ps = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!existing_ps)
|
|
|
|
{
|
|
|
|
ps = _progress_status_new(part_name, val);
|
|
|
|
sd->progress_status = eina_list_append(sd->progress_status, ps);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ps->val = val;
|
|
|
|
|
|
|
|
_val_set(obj);
|
|
|
|
_units_set(obj);
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call
|
2017-05-23 02:30:00 -07:00
|
|
|
(obj, EFL_UI_PROGRESSBAR_EVENT_CHANGED, NULL);
|
2013-09-09 23:47:13 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static double
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_part_value_get(const Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *sd, const char* part)
|
2013-09-09 23:47:13 -07:00
|
|
|
{
|
2017-05-23 02:30:00 -07:00
|
|
|
Efl_Ui_Progress_Status *ps;
|
2013-09-09 23:47:13 -07:00
|
|
|
Eina_List *l;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(sd->progress_status, l, ps)
|
|
|
|
{
|
2014-03-26 00:36:41 -07:00
|
|
|
if (!strcmp(ps->part_name, part)) return ps->val;
|
2013-09-09 23:47:13 -07:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
return 0.0;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI void
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_value_set(Evas_Object *obj, double val)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
efl_ui_progress_value_set(obj, val);
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI double
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_value_get(const Evas_Object *obj)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
return efl_ui_progress_value_get(obj);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI void
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
efl_ui_progress_span_size_set(obj, size);
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI Evas_Coord
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_span_size_get(const Evas_Object *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
return efl_ui_progress_span_size_get(obj);
|
2010-04-01 07:22:36 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI void
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
efl_ui_progress_unit_format_set(obj, units);
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI const char *
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_unit_format_get(const Evas_Object *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
return efl_ui_progress_unit_format_get(obj);
|
2010-04-01 07:22:36 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI void
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_unit_format_function_set(Evas_Object *obj, progressbar_func_type func, progressbar_freefunc_type free_func)
|
2012-06-15 09:32:54 -07:00
|
|
|
{
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
const char *sig;
|
2016-04-07 00:50:03 -07:00
|
|
|
ELM_PROGRESSBAR_DATA_GET(obj, sd);
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
|
2016-04-07 00:50:03 -07:00
|
|
|
|
2012-06-15 09:32:54 -07:00
|
|
|
sd->unit_format_func = func;
|
|
|
|
sd->unit_format_free = free_func;
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
sig = (func) ? "elm,state,units,visible" : "elm,state,units,hidden";
|
2016-09-21 01:41:58 -07:00
|
|
|
elm_layout_signal_emit(obj, sig, "elm");
|
elm_progressbar: show status when unit_format_func is set
Summary:
- elm,state,units,visible signal is emitted only when
unit is set, but not when unit_format_func is set.
- Since default unit has been set, this signal is emitted
but signal will not be emitted after unit is set to NULL.
Test Plan:
1. Create a progressbar.
2. elm_progressbar_unit_format_set(obj, NULL);
3. set unit_format_func by elm_progressbar_unit_format_function_set()
and observe elm.text.status part visible.
Reviewers: Hermet, jpeg, cedric
Reviewed By: cedric
Subscribers: D-TAU, eunue, conr2d, cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D4210
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
2016-09-20 16:07:18 -07:00
|
|
|
edje_object_message_signal_process(wd->resize_obj);
|
2012-06-15 09:32:54 -07:00
|
|
|
|
|
|
|
_units_set(obj);
|
|
|
|
elm_layout_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
static Efl_Orient
|
|
|
|
_orientation_get(Eina_Bool horizontal, Eina_Bool inverted)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
if (horizontal)
|
|
|
|
{
|
|
|
|
if (inverted)
|
|
|
|
return EFL_ORIENT_LEFT;
|
|
|
|
else
|
|
|
|
return EFL_ORIENT_RIGHT;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (inverted)
|
|
|
|
return EFL_ORIENT_UP;
|
|
|
|
else
|
|
|
|
return EFL_ORIENT_DOWN;
|
|
|
|
}
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI void
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
2009-08-12 09:16:31 -07:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
Efl_Orient dir;
|
|
|
|
ELM_PROGRESSBAR_DATA_GET(obj, sd);
|
|
|
|
|
|
|
|
dir = _orientation_get(horizontal, _is_inverted(sd->orientation));
|
|
|
|
|
|
|
|
efl_orientation_set(obj, dir);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI Eina_Bool
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_horizontal_get(const Evas_Object *obj)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
Efl_Orient dir;
|
|
|
|
dir = efl_orientation_get(obj);
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
return _is_horizontal(dir);
|
|
|
|
}
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI void
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted)
|
2016-04-07 00:50:03 -07:00
|
|
|
{
|
|
|
|
Efl_Orient dir;
|
|
|
|
ELM_PROGRESSBAR_DATA_GET(obj, sd);
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
dir = _orientation_get(_is_horizontal(sd->orientation), inverted);
|
2012-05-03 15:43:37 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
efl_orientation_set(obj, dir);
|
2009-08-12 09:16:31 -07:00
|
|
|
}
|
2010-04-01 07:22:36 -07:00
|
|
|
|
2016-04-07 00:50:03 -07:00
|
|
|
EAPI Eina_Bool
|
2017-05-23 02:30:00 -07:00
|
|
|
elm_progressbar_inverted_get(const Evas_Object *obj)
|
2010-04-01 07:22:36 -07:00
|
|
|
{
|
2016-04-07 00:50:03 -07:00
|
|
|
Efl_Orient dir;
|
|
|
|
dir = efl_orientation_get(obj);
|
|
|
|
|
|
|
|
return _is_inverted(dir);
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_widget_focus_next_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 00:36:41 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static Eina_Bool
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Efl_Ui_Progressbar_Data *_pd EINA_UNUSED)
|
2012-11-25 22:32:53 -08:00
|
|
|
{
|
2014-03-26 00:36:41 -07:00
|
|
|
return EINA_FALSE;
|
2012-11-25 22:32:53 -08:00
|
|
|
}
|
|
|
|
|
2014-03-26 00:36:41 -07:00
|
|
|
EOLIAN static void
|
2017-05-23 02:30:00 -07:00
|
|
|
_efl_ui_progressbar_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);
|
2010-04-01 07:22:36 -07:00
|
|
|
}
|
2014-03-26 00:36:41 -07:00
|
|
|
|
2016-05-24 04:40:18 -07:00
|
|
|
/* Efl.Part begin */
|
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
ELM_PART_OVERRIDE(efl_ui_progressbar, EFL_UI_PROGRESSBAR, ELM_LAYOUT, Efl_Ui_Progressbar_Data, Elm_Part_Data)
|
|
|
|
ELM_PART_OVERRIDE_CONTENT_SET(efl_ui_progressbar, EFL_UI_PROGRESSBAR, ELM_LAYOUT, Efl_Ui_Progressbar_Data, Elm_Part_Data)
|
|
|
|
#include "efl_ui_progressbar_internal_part.eo.c"
|
2016-05-24 04:40:18 -07:00
|
|
|
|
|
|
|
/* Efl.Part end */
|
|
|
|
|
2017-05-18 01:52:17 -07:00
|
|
|
/* Internal EO APIs and hidden overrides */
|
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
#define EFL_UI_PROGRESSBAR_EXTRA_OPS \
|
|
|
|
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_ui_progressbar)
|
2017-05-18 01:52:17 -07:00
|
|
|
|
2017-05-23 02:30:00 -07:00
|
|
|
#include "efl_ui_progressbar.eo.c"
|
2017-05-23 22:12:34 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse)
|
|
|
|
{
|
|
|
|
efl_ui_progressbar_pulse_mode_set(obj, pulse);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_progressbar_pulse_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return efl_ui_progressbar_pulse_mode_get(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state)
|
|
|
|
{
|
|
|
|
efl_ui_progressbar_pulse_set(obj, state);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_progressbar_is_pulsing_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
return efl_ui_progressbar_pulse_get(obj);
|
|
|
|
}
|