forked from enlightenment/efl
Added get functions in elm progressbar and added elm progressbar support in edje externals.By Fidencio
Author: Fabiano Fidêncio <fidencio at profusion.mobi> SVN revision: 47647
This commit is contained in:
parent
c00911ee84
commit
eb475b53bd
|
@ -18,6 +18,7 @@ ico_clock.png \
|
|||
ico_fileselector.png \
|
||||
ico_hoversel.png \
|
||||
ico_notepad.png \
|
||||
ico_progressbar.png \
|
||||
ico_radio.png \
|
||||
ico_scrolled_entry.png \
|
||||
ico_slider.png \
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 138 B |
|
@ -19,6 +19,7 @@ ICON("clock")
|
|||
ICON("fileselector")
|
||||
ICON("hoversel")
|
||||
ICON("notepad")
|
||||
ICON("progressbar")
|
||||
ICON("radio")
|
||||
ICON("scrolled_entry")
|
||||
ICON("slider")
|
||||
|
|
|
@ -35,6 +35,7 @@ elm_clock.c \
|
|||
elm_fileselector.c \
|
||||
elm_hoversel.c \
|
||||
elm_notepad.c \
|
||||
elm_progressbar.c \
|
||||
elm_radio.c \
|
||||
elm_scrolled_entry.c \
|
||||
elm_slider.c \
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
#include "private.h"
|
||||
|
||||
typedef struct _Elm_Params_Progressbar
|
||||
{
|
||||
Elm_Params base;
|
||||
Evas_Object *icon;
|
||||
const char *unit;
|
||||
double value;
|
||||
Evas_Coord span;
|
||||
Eina_Bool value_exists:1;
|
||||
Eina_Bool span_exists:1;
|
||||
Eina_Bool inverted:1;
|
||||
Eina_Bool inverted_exists:1;
|
||||
Eina_Bool horizontal:1;
|
||||
Eina_Bool horizontal_exists:1;
|
||||
} Elm_Params_Progressbar;
|
||||
|
||||
static void
|
||||
external_progressbar_state_set(void *data __UNUSED__, Evas_Object *obj, const void *from_params, const void *to_params, float pos __UNUSED__)
|
||||
{
|
||||
const Elm_Params_Progressbar *p;
|
||||
|
||||
if (to_params) p = to_params;
|
||||
else if (from_params) p = from_params;
|
||||
else return;
|
||||
|
||||
if (p->base.label)
|
||||
elm_progressbar_label_set(obj, p->base.label);
|
||||
if (p->icon)
|
||||
elm_progressbar_icon_set(obj, p->icon);
|
||||
if (p->span_exists)
|
||||
elm_progressbar_span_size_set(obj, p->span);
|
||||
if (p->value_exists)
|
||||
elm_progressbar_value_set(obj, p->value);
|
||||
if (p->inverted_exists)
|
||||
elm_progressbar_inverted_set(obj, p->inverted);
|
||||
if (p->horizontal_exists)
|
||||
elm_progressbar_horizontal_set(obj, p->horizontal);
|
||||
if (p->unit)
|
||||
elm_progressbar_unit_format_set(obj, p->unit);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
external_progressbar_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_External_Param *param)
|
||||
{
|
||||
if (!strcmp(param->name, "label"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
elm_progressbar_label_set(obj, param->s);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "icon"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
Evas_Object *icon = external_common_param_icon_get(obj, param);
|
||||
if (icon)
|
||||
{
|
||||
elm_progressbar_icon_set(obj, icon);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "value"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
|
||||
{
|
||||
elm_progressbar_value_set(obj, param->d);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "horizontal"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
elm_progressbar_horizontal_set(obj, param->i);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "inverted"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
elm_progressbar_inverted_set(obj, param->i);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "span"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
|
||||
{
|
||||
elm_progressbar_span_size_set(obj, param->i);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "unit format"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
elm_progressbar_unit_format_set(obj, param->s);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ERR("unknown parameter '%s' of type '%s'",
|
||||
param->name, edje_external_param_type_str(param->type));
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
external_progressbar_param_get(void *data __UNUSED__, const Evas_Object *obj, Edje_External_Param *param)
|
||||
{
|
||||
if (!strcmp(param->name, "label"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
param->s = elm_progressbar_label_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "icon"))
|
||||
{
|
||||
/* not easy to get icon name back from live object */
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (!strcmp(param->name, "value"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_DOUBLE)
|
||||
{
|
||||
param->d = elm_progressbar_value_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "horizontal"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
param->i = elm_progressbar_horizontal_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "inverted"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_BOOL)
|
||||
{
|
||||
param->i = elm_progressbar_inverted_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "span"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_INT)
|
||||
{
|
||||
param->i = elm_progressbar_span_size_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "unit format"))
|
||||
{
|
||||
if (param->type == EDJE_EXTERNAL_PARAM_TYPE_STRING)
|
||||
{
|
||||
param->s = elm_progressbar_unit_format_get(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
ERR("unknown parameter '%s' of type '%s'",
|
||||
param->name, edje_external_param_type_str(param->type));
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void *
|
||||
external_progressbar_params_parse(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const Eina_List *params)
|
||||
{
|
||||
Elm_Params_Progressbar *mem;
|
||||
Edje_External_Param *param;
|
||||
const Eina_List *l;
|
||||
|
||||
mem = external_common_params_parse(Elm_Params_Progressbar, data, obj, params);
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
external_common_icon_param_parse(&mem->icon, obj, params);
|
||||
|
||||
EINA_LIST_FOREACH(params, l, param)
|
||||
{
|
||||
if (!strcmp(param->name, "span"))
|
||||
{
|
||||
mem->span = param->i;
|
||||
mem->span_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "value"))
|
||||
{
|
||||
mem->value = param->d;
|
||||
mem->value_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "inverted"))
|
||||
{
|
||||
mem->inverted = !!param->i;
|
||||
mem->inverted_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "horizontal"))
|
||||
{
|
||||
mem->horizontal = !!param->i;
|
||||
mem->horizontal_exists = EINA_TRUE;
|
||||
}
|
||||
else if (!strcmp(param->name, "unit format"))
|
||||
mem->unit = eina_stringshare_add(param->s);
|
||||
}
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
static void
|
||||
external_progressbar_params_free(void *params)
|
||||
{
|
||||
Elm_Params_Progressbar *mem = params;
|
||||
|
||||
if (mem->icon)
|
||||
evas_object_del(mem->icon);
|
||||
if (mem->unit)
|
||||
eina_stringshare_del(mem->unit);
|
||||
external_common_params_free(params);
|
||||
}
|
||||
|
||||
static Edje_External_Param_Info external_progressbar_params[] = {
|
||||
DEFINE_EXTERNAL_COMMON_PARAMS,
|
||||
EDJE_EXTERNAL_PARAM_INFO_STRING("icon"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_DOUBLE("value"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("horizontal"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_BOOL("inverted"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_INT("span"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_STRING_DEFAULT("unit format", "%1.2f"),
|
||||
EDJE_EXTERNAL_PARAM_INFO_SENTINEL
|
||||
};
|
||||
|
||||
DEFINE_EXTERNAL_ICON_ADD(progressbar, "progressbar")
|
||||
DEFINE_EXTERNAL_TYPE_SIMPLE(progressbar, "Progressbar")
|
|
@ -7,6 +7,7 @@ DEFINE_TYPE(clock)
|
|||
DEFINE_TYPE(fileselector)
|
||||
DEFINE_TYPE(hoversel)
|
||||
DEFINE_TYPE(notepad)
|
||||
DEFINE_TYPE(progressbar)
|
||||
DEFINE_TYPE(radio)
|
||||
DEFINE_TYPE(scrolled_entry)
|
||||
DEFINE_TYPE(slider)
|
||||
|
|
|
@ -1057,15 +1057,22 @@ extern "C" {
|
|||
|
||||
EAPI Evas_Object *elm_progressbar_add(Evas_Object *parent);
|
||||
EAPI void elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse);
|
||||
EAPI Eina_Bool elm_progressbar_pulse_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state);
|
||||
EAPI void elm_progressbar_value_set(Evas_Object *obj, double val);
|
||||
EAPI double elm_progressbar_value_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_label_set(Evas_Object *obj, const char *label);
|
||||
EAPI const char *elm_progressbar_label_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon);
|
||||
EAPI Evas_Object *elm_progressbar_icon_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size);
|
||||
EAPI Evas_Coord elm_progressbar_span_size_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_unit_format_set(Evas_Object *obj, const char *format);
|
||||
EAPI const char *elm_progressbar_unit_format_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
|
||||
EAPI Eina_Bool elm_progressbar_horizontal_get(const Evas_Object *obj);
|
||||
EAPI void elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted);
|
||||
EAPI Eina_Bool elm_progressbar_inverted_get(const Evas_Object *obj);
|
||||
/* smart callbacks called:
|
||||
*/
|
||||
/* available item styles:
|
||||
|
|
|
@ -229,7 +229,7 @@ elm_progressbar_add(Evas_Object *parent)
|
|||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_pulse_set (Evas_Object *obj, Eina_Bool pulse)
|
||||
elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
|
@ -246,12 +246,30 @@ elm_progressbar_pulse_set (Evas_Object *obj, Eina_Bool pulse)
|
|||
* (the cursor pulse right to left and left to right, and loop) if pulse is set to 1.
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param state The pulse flag. 1 == pulse, 0 == normal
|
||||
* @return The pulse flag
|
||||
* (1 == pulse, 0 == normal)
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_progressbar_pulse_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return EINA_FALSE;
|
||||
return wd->pulse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stat/Stop de pulse action
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param state The pulse flag. 1 == start pulse, 0 == stop pulse
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_pulse (Evas_Object *obj, Eina_Bool state)
|
||||
elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
|
@ -274,7 +292,7 @@ elm_progressbar_pulse (Evas_Object *obj, Eina_Bool state)
|
|||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_value_set (Evas_Object *obj, double val)
|
||||
elm_progressbar_value_set(Evas_Object *obj, double val)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
|
@ -334,6 +352,23 @@ elm_progressbar_label_set(Evas_Object *obj, const char *label)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the label of the progressbar
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The text label string in UTF-8
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_progressbar_label_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
return wd->label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the icon object of the progressbar object
|
||||
*
|
||||
|
@ -367,6 +402,23 @@ elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the icon object of the progressbar object
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The icon object
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_progressbar_icon_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
return wd->icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the length of the progression region of the progressbar
|
||||
*
|
||||
|
@ -396,6 +448,23 @@ elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the length of the progression region of the progressbar
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The length of the progressbar area
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI Evas_Coord
|
||||
elm_progressbar_span_size_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) 0;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return 0;
|
||||
return wd->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the format string of the unit area
|
||||
*
|
||||
|
@ -430,6 +499,23 @@ elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the format string of the unit area
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The format string for the units display
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI const char *
|
||||
elm_progressbar_unit_format_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
return wd->units;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set orientation of the progressbar
|
||||
*
|
||||
|
@ -450,6 +536,24 @@ elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
|||
_theme_hook(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets orientation of the progressbar
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The orientation
|
||||
* (0 = vertical, 1 = horizontal)
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_progressbar_horizontal_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return EINA_FALSE;
|
||||
return wd->horizontal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invert the progressbar display
|
||||
*
|
||||
|
@ -480,3 +584,21 @@ elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted)
|
|||
_val_set(obj);
|
||||
_units_set(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the progressbar will displayed inverted
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The inverted flag
|
||||
* (1 == inverted, 0 == normal)
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_progressbar_inverted_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return EINA_FALSE;
|
||||
return wd->inverted;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue