forked from enlightenment/efl
From: Daniel Willmann <d.willmann@samsung.com>
Subject: Re: [E-devel] [PATCH] elementary: Add elm_progressbar_maxunit_{set, get} functions Some more discussion in IRC led to the conclusion that this should be a handled in a signal callback I've attached the new patch where I also updated the progress bar example. SVN revision: 72459
This commit is contained in:
parent
70c459c487
commit
2e9ae9f539
|
@ -127,10 +127,12 @@
|
||||||
_Elm_Win_Smart_Data to allow grouping based on engine.
|
_Elm_Win_Smart_Data to allow grouping based on engine.
|
||||||
|
|
||||||
2012-05-29 Rob Bradford
|
2012-05-29 Rob Bradford
|
||||||
|
|
||||||
* Move X related cursor items into their own substruct of Elm_Cursor
|
* Move X related cursor items into their own substruct of Elm_Cursor
|
||||||
to make supporting cursors on other platforms cleaner.
|
to make supporting cursors on other platforms cleaner.
|
||||||
|
|
||||||
2012-05-30 Rob Bradford
|
2012-05-30 Rob Bradford
|
||||||
|
|
||||||
* Add support for setting the cursor under Wayland:
|
* Add support for setting the cursor under Wayland:
|
||||||
* Introduce a configure option and #define to as per other engines
|
* Introduce a configure option and #define to as per other engines
|
||||||
* Add always-built API function to allow identification of running
|
* Add always-built API function to allow identification of running
|
||||||
|
@ -190,13 +192,20 @@
|
||||||
After the item is long-pressed, it can be moved.
|
After the item is long-pressed, it can be moved.
|
||||||
|
|
||||||
2012-06-14 Michael Bouchaud
|
2012-06-14 Michael Bouchaud
|
||||||
|
|
||||||
* Add an enum to Elm_Calendar_Mark_Repeat_Type:
|
* Add an enum to Elm_Calendar_Mark_Repeat_Type:
|
||||||
ELM_CALENDAR_LAST_DAY_OF_MONTH
|
ELM_CALENDAR_LAST_DAY_OF_MONTH
|
||||||
|
|
||||||
2012-06-15 Michael Bouchaud
|
2012-06-15 Michael Bouchaud
|
||||||
|
|
||||||
* elm_progressbar: elm_progressbar_format_function_set to add a callback
|
* elm_progressbar: elm_progressbar_format_function_set to add a callback
|
||||||
function to format the unit string.
|
function to format the unit string.
|
||||||
|
|
||||||
2012-06-16 Davide Andreoli
|
2012-06-16 Davide Andreoli
|
||||||
|
|
||||||
* elm_map: add elm_map_overlay_del_cb_set to be notify when
|
* elm_map: add elm_map_overlay_del_cb_set to be notify when
|
||||||
an overlay is deleted.
|
an overlay is deleted.
|
||||||
|
|
||||||
|
2012-06-14 Daniel Willmann
|
||||||
|
* elm_progressbar: Add "changed" signal to be emitted when the value
|
||||||
|
is changed. Can be used for complex custom unit formats.
|
||||||
|
|
|
@ -17,9 +17,10 @@ typedef struct Progressbar_Example
|
||||||
Evas_Object *pb2; /* pulsing */
|
Evas_Object *pb2; /* pulsing */
|
||||||
Evas_Object *pb3;
|
Evas_Object *pb3;
|
||||||
Evas_Object *pb4;
|
Evas_Object *pb4;
|
||||||
Evas_Object *pb5; /* pulsing */
|
Evas_Object *pb5;
|
||||||
Evas_Object *pb6;
|
Evas_Object *pb6; /* pulsing */
|
||||||
Evas_Object *pb7; /* pulsing */
|
Evas_Object *pb7;
|
||||||
|
Evas_Object *pb8; /* pulsing */
|
||||||
|
|
||||||
Eina_Bool run;
|
Eina_Bool run;
|
||||||
Ecore_Timer *timer;
|
Ecore_Timer *timer;
|
||||||
|
@ -40,7 +41,8 @@ _progressbar_example_value_set(void *data)
|
||||||
elm_progressbar_value_set(example_data.pb1, progress);
|
elm_progressbar_value_set(example_data.pb1, progress);
|
||||||
elm_progressbar_value_set(example_data.pb3, progress);
|
elm_progressbar_value_set(example_data.pb3, progress);
|
||||||
elm_progressbar_value_set(example_data.pb4, progress);
|
elm_progressbar_value_set(example_data.pb4, progress);
|
||||||
elm_progressbar_value_set(example_data.pb6, progress);
|
elm_progressbar_value_set(example_data.pb5, progress);
|
||||||
|
elm_progressbar_value_set(example_data.pb7, progress);
|
||||||
|
|
||||||
if (progress < 1.0) return ECORE_CALLBACK_RENEW;
|
if (progress < 1.0) return ECORE_CALLBACK_RENEW;
|
||||||
|
|
||||||
|
@ -54,8 +56,8 @@ _progressbar_example_start(void *data,
|
||||||
void *event_info)
|
void *event_info)
|
||||||
{
|
{
|
||||||
elm_progressbar_pulse(example_data.pb2, EINA_TRUE);
|
elm_progressbar_pulse(example_data.pb2, EINA_TRUE);
|
||||||
elm_progressbar_pulse(example_data.pb5, EINA_TRUE);
|
elm_progressbar_pulse(example_data.pb6, EINA_TRUE);
|
||||||
elm_progressbar_pulse(example_data.pb7, EINA_TRUE);
|
elm_progressbar_pulse(example_data.pb8, EINA_TRUE);
|
||||||
|
|
||||||
if (!example_data.run)
|
if (!example_data.run)
|
||||||
{
|
{
|
||||||
|
@ -72,8 +74,8 @@ _progressbar_example_stop(void *data,
|
||||||
void *event_info)
|
void *event_info)
|
||||||
{
|
{
|
||||||
elm_progressbar_pulse(example_data.pb2, EINA_FALSE);
|
elm_progressbar_pulse(example_data.pb2, EINA_FALSE);
|
||||||
elm_progressbar_pulse(example_data.pb5, EINA_FALSE);
|
elm_progressbar_pulse(example_data.pb6, EINA_FALSE);
|
||||||
elm_progressbar_pulse(example_data.pb7, EINA_FALSE);
|
elm_progressbar_pulse(example_data.pb8, EINA_FALSE);
|
||||||
|
|
||||||
if (example_data.run)
|
if (example_data.run)
|
||||||
{
|
{
|
||||||
|
@ -98,6 +100,21 @@ _progress_format_free(char *str)
|
||||||
free(fstr);
|
free(fstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_on_changed(void *data, Evas_Object *obj, void *event_info)
|
||||||
|
{
|
||||||
|
double progress;
|
||||||
|
int files;
|
||||||
|
char text[30];
|
||||||
|
|
||||||
|
/* Count down from 3 minutes */
|
||||||
|
progress = elm_progressbar_value_get(obj);
|
||||||
|
files = (1-progress) * 12000;
|
||||||
|
snprintf(text, 29, "%i files remaining", files);
|
||||||
|
|
||||||
|
elm_progressbar_unit_format_set(obj, text);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_on_done(void *data,
|
_on_done(void *data,
|
||||||
Evas_Object *obj,
|
Evas_Object *obj,
|
||||||
|
@ -167,6 +184,17 @@ elm_main(int argc,
|
||||||
evas_object_show(pb);
|
evas_object_show(pb);
|
||||||
example_data.pb3 = pb;
|
example_data.pb3 = pb;
|
||||||
|
|
||||||
|
/* pb with callback function */
|
||||||
|
pb = elm_progressbar_add(win);
|
||||||
|
elm_progressbar_unit_format_set(pb, NULL);
|
||||||
|
evas_object_size_hint_align_set(pb, EVAS_HINT_FILL, 0.5);
|
||||||
|
evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
elm_box_pack_end(bx, pb);
|
||||||
|
evas_object_show(ic1);
|
||||||
|
evas_object_show(pb);
|
||||||
|
evas_object_smart_callback_add(pb, "changed", _on_changed, NULL);
|
||||||
|
example_data.pb4 = pb;
|
||||||
|
|
||||||
hbx = elm_box_add(win);
|
hbx = elm_box_add(win);
|
||||||
elm_box_horizontal_set(hbx, EINA_TRUE);
|
elm_box_horizontal_set(hbx, EINA_TRUE);
|
||||||
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
@ -182,7 +210,7 @@ elm_main(int argc,
|
||||||
elm_box_pack_end(hbx, pb);
|
elm_box_pack_end(hbx, pb);
|
||||||
elm_object_text_set(pb, "percent");
|
elm_object_text_set(pb, "percent");
|
||||||
evas_object_show(pb);
|
evas_object_show(pb);
|
||||||
example_data.pb4 = pb;
|
example_data.pb5 = pb;
|
||||||
|
|
||||||
/* vertical pb, with pulse and custom (small) span size */
|
/* vertical pb, with pulse and custom (small) span size */
|
||||||
pb = elm_progressbar_add(win);
|
pb = elm_progressbar_add(win);
|
||||||
|
@ -195,7 +223,7 @@ elm_main(int argc,
|
||||||
elm_object_text_set(pb, "Infinite bounce");
|
elm_object_text_set(pb, "Infinite bounce");
|
||||||
elm_box_pack_end(hbx, pb);
|
elm_box_pack_end(hbx, pb);
|
||||||
evas_object_show(pb);
|
evas_object_show(pb);
|
||||||
example_data.pb5 = pb;
|
example_data.pb6 = pb;
|
||||||
|
|
||||||
ic2 = elm_icon_add(win);
|
ic2 = elm_icon_add(win);
|
||||||
elm_icon_file_set(ic2, buf, NULL);
|
elm_icon_file_set(ic2, buf, NULL);
|
||||||
|
@ -214,7 +242,7 @@ elm_main(int argc,
|
||||||
elm_box_pack_end(hbx, pb);
|
elm_box_pack_end(hbx, pb);
|
||||||
evas_object_show(ic2);
|
evas_object_show(ic2);
|
||||||
evas_object_show(pb);
|
evas_object_show(pb);
|
||||||
example_data.pb6 = pb;
|
example_data.pb7 = pb;
|
||||||
|
|
||||||
/* "wheel" style progress bar */
|
/* "wheel" style progress bar */
|
||||||
pb = elm_progressbar_add(win);
|
pb = elm_progressbar_add(win);
|
||||||
|
@ -224,7 +252,7 @@ elm_main(int argc,
|
||||||
evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(pb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
elm_box_pack_end(bx, pb);
|
elm_box_pack_end(bx, pb);
|
||||||
evas_object_show(pb);
|
evas_object_show(pb);
|
||||||
example_data.pb7 = pb;
|
example_data.pb8 = pb;
|
||||||
|
|
||||||
bt_bx = elm_box_add(win);
|
bt_bx = elm_box_add(win);
|
||||||
elm_box_horizontal_set(bt_bx, EINA_TRUE);
|
elm_box_horizontal_set(bt_bx, EINA_TRUE);
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
static const char PROGRESSBAR_SMART_NAME[] = "elm_progressbar";
|
static const char PROGRESSBAR_SMART_NAME[] = "elm_progressbar";
|
||||||
|
|
||||||
|
static const char SIG_CHANGED[] = "changed";
|
||||||
|
|
||||||
#define MIN_RATIO_LVL 0.0
|
#define MIN_RATIO_LVL 0.0
|
||||||
#define MAX_RATIO_LVL 1.0
|
#define MAX_RATIO_LVL 1.0
|
||||||
|
|
||||||
|
@ -54,11 +56,18 @@ struct _Elm_Progressbar_Smart_Data
|
||||||
((obj), PROGRESSBAR_SMART_NAME, __func__)) \
|
((obj), PROGRESSBAR_SMART_NAME, __func__)) \
|
||||||
return
|
return
|
||||||
|
|
||||||
|
/* smart callbacks coming from elm progressbar objects (besides the
|
||||||
|
* ones coming from elm layout): */
|
||||||
|
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||||
|
{SIG_CHANGED, ""},
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
/* Inheriting from elm_layout. Besides, we need no more than what is
|
/* Inheriting from elm_layout. Besides, we need no more than what is
|
||||||
* there */
|
* there */
|
||||||
EVAS_SMART_SUBCLASS_NEW
|
EVAS_SMART_SUBCLASS_NEW
|
||||||
(PROGRESSBAR_SMART_NAME, _elm_progressbar, Elm_Layout_Smart_Class,
|
(PROGRESSBAR_SMART_NAME, _elm_progressbar, Elm_Layout_Smart_Class,
|
||||||
Elm_Layout_Smart_Class, elm_layout_smart_class_get, NULL);
|
Elm_Layout_Smart_Class, elm_layout_smart_class_get, _smart_callbacks);
|
||||||
|
|
||||||
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
static const Elm_Layout_Part_Alias_Description _content_aliases[] =
|
||||||
{
|
{
|
||||||
|
@ -364,6 +373,7 @@ elm_progressbar_value_set(Evas_Object *obj,
|
||||||
|
|
||||||
_val_set(obj);
|
_val_set(obj);
|
||||||
_units_set(obj);
|
_units_set(obj);
|
||||||
|
evas_object_smart_callback_call(obj, SIG_CHANGED, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI double
|
EAPI double
|
||||||
|
|
|
@ -33,6 +33,10 @@
|
||||||
* This widget inherits from the @ref Layout one, so that all the
|
* This widget inherits from the @ref Layout one, so that all the
|
||||||
* functions acting on it also work for progress bar objects.
|
* functions acting on it also work for progress bar objects.
|
||||||
*
|
*
|
||||||
|
* This widget emits the following signals, besides the ones sent from
|
||||||
|
* @ref Layout:
|
||||||
|
* @li @c "changed" - when the value is changed
|
||||||
|
*
|
||||||
* This widget has the following styles:
|
* This widget has the following styles:
|
||||||
* - @c "default"
|
* - @c "default"
|
||||||
* - @c "wheel" (simple style, no text, no progression, only
|
* - @c "wheel" (simple style, no text, no progression, only
|
||||||
|
|
Loading…
Reference in New Issue