Hi Everybody, I have made a patch to add a progressbar to elementary toolkit. this is a first shot. No invert or vertical display. I can made some modifications if you want or add some features. Sure if you accept this patch, I'm going to add vertical and invert function. I'm a beginner in edje and I would to learn more.
Regards
Index: src/lib/Elementary.h.in =================================================================== --- src/lib/Elementary.h.in (révision 41208) +++ src/lib/Elementary.h.in (copie de travail) @@ -700,6 +700,18 @@ /* smart callbacks called: */ + EAPI Evas_Object *elm_progressbar_add(Evas_Object *parent); + EAPI void elm_progressbar_label_set(Evas_Object *obj, const char *label); + EAPI void elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon); + EAPI void elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size); +// EAPI void elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal); +// EAPI void elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted); + EAPI void elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse); + EAPI void elm_progressbar_min_max_set(Evas_Object *obj, double min, double max); + EAPI void elm_progressbar_unit_format_set(Evas_Object *obj, const char *format); + EAPI void elm_progressbar_value_set(Evas_Object *obj, double val); + EAPI double elm_progressbar_value_get(const Evas_Object *obj); + #ifdef __cplusplus } #endif Index: src/lib/elm_progressbar.c =================================================================== --- src/lib/elm_progressbar.c (révision 0) +++ src/lib/elm_progressbar.c (révision 0) @@ -0,0 +1,494 @@ +#include <Elementary.h> +#include "elm_priv.h" + +/** + * @defgroup Progressbar Progressbar + * + * The progressbar adds a widget for representing current progress + * of a job status + * + * Signals that you can add callbacks for are: + * + * changed - Whenever the Progressbar value is changed by the user. + * + * delay,changed - A short time after the value is changed by the user. + * This will be called only when the user stops dragging for a very short + * period or when they release their finger/mouse, so it avoids possibly + * expensive reactions to the value change. + * + * A progressbar can be horizontal or vertical. It can contain an Icon and has a + * primary label as well as a units label (that is formatted with floating + * point values and thus accepts a printf-style format string, like + * “%1.2f units”. + * + * Label, Icon and Unit strings/objects are optional. + * + * A progressbar may be inverted which means values invert, with high vales being + * on the left or top and low values on the right or bottom (as opposed to + * normally being low on the left or top and high on the bottom and right). + * + * The progressbar should have its minimum and maximum values set by the + * application with elm_progressbar_min_max_set() and value should also be set by + * the application before use with elm_progressbar_value_set(). The span of the + * progressbar is its length (horizontally or vertically). This will be scaled by + * the object or applications scaling factor. At any point code can query the + * progressbar for its value with elm_progressbar_value_get(). + */ + +typedef struct _Widget_Data Widget_Data; + +struct _Widget_Data +{ + Evas_Object *progressbar; + Evas_Object *spacer; + Evas_Object *icon; + Evas_Coord size; + Eina_Bool horizontal : 1; + Eina_Bool inverted : 1; + Eina_Bool pulse : 1; + const char *units; + const char *label; + double val, val_min, val_max; + Ecore_Timer *delay; +}; + +static void _del_hook(Evas_Object *obj); +static void _theme_hook(Evas_Object *obj); +static void _sizing_eval(Evas_Object *obj); +static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _sub_del(void *data, Evas_Object *obj, void *event_info); +static void _units_set(Evas_Object *obj); + +static void +_del_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + free(wd); +} + +static void +_theme_hook(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); +/* + if (wd->horizontal) + _elm_theme_set(wd->progressbar, "progressbar", "horizontal", elm_widget_style_get(obj)); + else + _elm_theme_set(wd->progressbar, "progressbar", "vertical", elm_widget_style_get(obj)); + if (wd->inverted) + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,on", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,off", "elm"); +*/ + if (wd->icon) + edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,icon,hidden", "elm"); + if (wd->label) + edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm"); + edje_object_part_text_set(wd->progressbar, "elm.text", wd->label); + if (wd->pulse) + edje_object_signal_emit(wd->progressbar, "elm,state,pulse,start", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,pulse,stop", "elm"); + if (wd->units && !wd->pulse) + edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,units,hidden", "elm"); + + edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer); + _units_set(obj); + edje_object_message_signal_process(wd->progressbar); + edje_object_scale_set(wd->progressbar, elm_widget_scale_get(obj) * _elm_config->scale); + _sizing_eval(obj); +} + +static void +_sizing_eval(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1; + + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + edje_object_size_min_restricted_calc(wd->progressbar, &minw, &minh, minw, minh); + elm_coords_finger_size_adjust(1, &minw, 1, &minh); + evas_object_size_hint_min_set(obj, minw, minh); + evas_object_size_hint_max_set(obj, maxw, maxh); +} + +static void +_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(data); + if (obj != wd->icon) return; + edje_object_part_swallow(wd->progressbar, "elm.swallow.content", obj); + _sizing_eval(data); +} + +static void +_sub_del(void *data, Evas_Object *obj, void *event_info) +{ + Widget_Data *wd = elm_widget_data_get(obj); + Evas_Object *sub = event_info; + if (sub == wd->icon) + { + edje_object_signal_emit(wd->progressbar, "elm,state,icon,hidden", "elm"); + evas_object_event_callback_del + (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints); + wd->icon = NULL; + _sizing_eval(obj); + } +} + +static int +_delay_change(void *data) +{ + Widget_Data *wd = elm_widget_data_get(data); + wd->delay = NULL; + evas_object_smart_callback_call(data, "delay,changed", NULL); + return 0; +} + +static void +_val_fetch(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double posx = 0.0, posy = 0.0, pos = 0.0, val; + + edje_object_part_drag_value_get(wd->progressbar, "elm.cur.progressbar", + &posx, &posy); + if (wd->horizontal) pos = posx; + else pos = posy; + if (wd->inverted) pos = 1.0 - pos; + val = (pos * (wd->val_max - wd->val_min)) + wd->val_min; + if (val != wd->val) + { + wd->val = val; + evas_object_smart_callback_call(obj, "changed", NULL); + if (wd->delay) ecore_timer_del(wd->delay); + wd->delay = ecore_timer_add(0.2, _delay_change, obj); + } +} + +static void +_val_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + double pos; + if (wd->val_max > wd->val_min) + pos = (wd->val - wd->val_min) / (wd->val_max - wd->val_min); + else + pos = 0.0; + if (pos < 0.0) pos = 0.0; + else if (pos > 1.0) pos = 1.0; + if (wd->inverted) pos = 1.0 - pos; + edje_object_part_drag_value_set(wd->progressbar, "elm.cur.progressbar", pos, pos); +} + +static void +_units_set(Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->units) + { + char buf[1024]; + + snprintf(buf, sizeof(buf), wd->units, wd->val); + edje_object_part_text_set(wd->progressbar, "elm.text.content", buf); + } + else + edje_object_part_text_set(wd->progressbar, "elm.text.content", NULL); +} + +/** + * Add a new progressbar to the parent + * + * @param parent The parent object + * @return The new object or NULL if it cannot be created + * + * @ingroup Progressbar + */ +EAPI Evas_Object * +elm_progressbar_add(Evas_Object *parent) +{ + Evas_Object *obj; + Evas *e; + Widget_Data *wd; + + wd = ELM_NEW(Widget_Data); + e = evas_object_evas_get(parent); + obj = elm_widget_add(e); + elm_widget_type_set(obj, "progressbar"); + elm_widget_sub_object_add(parent, obj); + elm_widget_data_set(obj, wd); + elm_widget_del_hook_set(obj, _del_hook); + elm_widget_theme_hook_set(obj, _theme_hook); + + wd->horizontal = EINA_TRUE; + wd->inverted = EINA_FALSE; + wd->pulse = EINA_FALSE; + wd->val = 0.0; + wd->val_min = 0.0; + wd->val_max = 1.0; + + wd->progressbar = edje_object_add(e); + _elm_theme_set(wd->progressbar, "progressbar", "horizontal", "default"); + elm_widget_resize_object_set(obj, wd->progressbar); + + wd->spacer = evas_object_rectangle_add(e); + evas_object_color_set(wd->spacer, 0, 0, 0, 0); + evas_object_pass_events_set(wd->spacer, 1); + elm_widget_sub_object_add(obj, wd->spacer); + edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer); + + evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj); + _sizing_eval(obj); + return obj; +} + +/* + * Set the value the progressbar indicates + * + * @param obj The progressbar object + * @param val The value (must be beween min and max for the progressbar) + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_pulse_set (Evas_Object *obj, Eina_Bool pulse) { + Widget_Data *wd = elm_widget_data_get(obj); + pulse = !!pulse; + if (wd->pulse == pulse) return; + wd->pulse = pulse; + _theme_hook(obj); +} + +/* + * Set the value the progressbar indicates + * + * @param obj The progressbar object + * @param val The value (must be beween min and max for the progressbar) + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_value_set (Evas_Object *obj, double val) { + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->val == val) return; + wd->val = val; + if (wd->val < wd->val_min) wd->val = wd->val_min; + if (wd->val > wd->val_max) wd->val = wd->val_max; + _val_set(obj); + _units_set(obj); +} + + +/* + * Get the value the progressbar has + * + * @param obj The progressbar object + * @return The value of the progressbar + * + * @ingroup Progressbar + */ +EAPI double +elm_progressbar_value_get(const Evas_Object *obj) +{ + Widget_Data *wd = elm_widget_data_get(obj); + return wd->val; +} + +/** + * Set the label of the progressbar + * + * @param obj The progressbar object + * @param label The text label string in UTF-8 + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_label_set(Evas_Object *obj, const char *label) +{ + Widget_Data *wd = elm_widget_data_get(obj); + + if (wd->label) eina_stringshare_del(wd->label); + if (label) + { + wd->label = eina_stringshare_add(label); + edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + else + { + wd->label = NULL; + edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + edje_object_part_text_set(wd->progressbar, "elm.text", label); + _sizing_eval(obj); +} + +/* + * Set the icon object of the progressbar object + * + * Once the icon object is set, it will become a child of the progressbar object and + * be deleted when the progressbar object is deleted. If another icon object is set + * then the previous one becomes orophaned and will no longer be deleted along + * with the progressbar. + * + * @param obj The progressbar object + * @param icon The icon object + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((wd->icon != icon) && (wd->icon)) + elm_widget_sub_object_del(obj, wd->icon); + wd->icon = icon; + if (icon) + { + elm_widget_sub_object_add(obj, icon); + edje_object_part_swallow(wd->progressbar, "elm.swallow.content", icon); + edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm"); + evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _changed_size_hints, obj); + _sizing_eval(obj); + } +} + +/* + * Set the length of the dragable region of the progressbar + * + * This sets the minimum width or height (depending on orientation) of the + * area of the progressbar that allows the progressbar to be dragged around. This in + * turn affects the objects minimum size (along with icon label and unit + * text). Note that this will also get multiplied by the scale factor. + * + * @param obj The progressbar object + * @param size The length of the progressbar area + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->size == size) return; + wd->size = size; + if (wd->horizontal) + evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1); + else + evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale); + edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer); + _sizing_eval(obj); +} + +/* + * Set the format string of the unit area + * + * If NULL, this disabls the unit area display. If not it sets the format + * string for the unit text. The unit text is provided a floating point + * value, so the unit text can display up to 1 floating point falue. Note that + * this is optional. Use a format string such as "%1.2f meters" for example. + * + * @param obj The progressbar object + * @param units The format string for the units display + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_unit_format_set(Evas_Object *obj, const char *units) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if (wd->units) eina_stringshare_del(wd->units); + if (units) + { + wd->units = eina_stringshare_add(units); + edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + else + { + wd->units = NULL; + edje_object_signal_emit(wd->progressbar, "elm,state,units,hidden", "elm"); + edje_object_message_signal_process(wd->progressbar); + } + _units_set(obj); + _sizing_eval(obj); +} + +/* + * Set orientation of the progressbar + * + * @param obj The progressbar object + * @param horizontal If set, the progressbar will be horizontal + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal) +{ + Widget_Data *wd = elm_widget_data_get(obj); + horizontal = !!horizontal; + if (wd->horizontal == horizontal) return; + wd->horizontal = horizontal; + _theme_hook(obj); +} + +/* + * Set the minimum and maximum values for the Progressbar + * + * Maximum mut be greater than minimum. + * + * @param obj The Progressbar object + * @param min The minimum value + * @param max The maximum value + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_min_max_set(Evas_Object *obj, double min, double max) +{ + Widget_Data *wd = elm_widget_data_get(obj); + if ((wd->val_min == min) && (wd->val_max == max)) return; + wd->val_min = min; + wd->val_max = max; + if (wd->val < wd->val_min) wd->val = wd->val_min; + if (wd->val > wd->val_max) wd->val = wd->val_max; + _val_set(obj); + _units_set(obj); +} + +/* + * Invert the progressbar display + * + * Normally the progressbar will display and interpret values from low to high + * and when horizontal that is left to right. When vertical that is top + * to bottom. This inverts this (so from right to left or bottom to top) if + * inverted is set to 1. + * + * @param obj The progressbar object + * @param inverted The inverted flag. 1 == inverted, 0 == normal + * + * @ingroup Progressbar + */ +EAPI void +elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted) +{ + Widget_Data *wd = elm_widget_data_get(obj); + inverted = !!inverted; + if (wd->inverted == inverted) return; + wd->inverted = inverted; + if (wd->inverted) + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,on", "elm"); + else + edje_object_signal_emit(wd->progressbar, "elm,state,inverted,off", "elm"); + edje_object_message_signal_process(wd->progressbar); + _val_set(obj); + _units_set(obj); +} Index: src/lib/Makefile.am =================================================================== --- src/lib/Makefile.am (révision 41208) +++ src/lib/Makefile.am (copie de travail) @@ -54,6 +54,7 @@ elm_check.c \ elm_radio.c \ elm_pager.c \ +elm_progressbar.c \ \ elc_notepad.c \ elc_anchorview.c \ Index: src/bin/test.c =================================================================== --- src/bin/test.c (révision 41208) +++ src/bin/test.c (copie de travail) @@ -3477,7 +3477,138 @@ evas_object_show(win); } + +typedef struct Progressbar { + Evas_Object *pb1; + Evas_Object *pb2; + Evas_Object *pb3; + Eina_Bool run; + Ecore_Timer *timer; +} Progressbar; + +static Progressbar _test_progressbar; + +static int +_my_bt_39_progressbar_value_set (void *data) { + double progress; + + //first progressbar + progress = elm_progressbar_value_get (_test_progressbar.pb1); + if (progress < 100.0) + progress += 1.0; + else + progress = 0.0; + elm_progressbar_value_set(_test_progressbar.pb1, progress); + elm_progressbar_value_set(_test_progressbar.pb3, progress / 100.0); + if (progress == 100.0) { + _test_progressbar.run = 0; + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + static void +my_bt_39_test_start(void *data, Evas_Object *obj, void *event_info) { + elm_progressbar_pulse_set(_test_progressbar.pb2, EINA_TRUE); + if (!_test_progressbar.run) { + _test_progressbar.timer = ecore_timer_add(0.05, _my_bt_39_progressbar_value_set, NULL); + _test_progressbar.run = EINA_TRUE; + } +} + +static void +my_bt_39_test_stop(void *data, Evas_Object *obj, void *event_info) { + elm_progressbar_pulse_set(_test_progressbar.pb2, EINA_FALSE); + if (_test_progressbar.run) { + ecore_timer_del(_test_progressbar.timer); + _test_progressbar.run = EINA_FALSE; + } +} + +static void +my_bt_39_destroy(void *data, Evas_Object *obj, void *event_info) { + my_bt_39_test_stop(NULL, NULL, NULL); + evas_object_del(obj); +} + +static void +my_bt_39(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *win, *bg, *pb, *bx, *bt, *bt_bx, *ic; + Progressbar *test; + char buf[PATH_MAX]; + + win = elm_win_add(NULL, "progressbar", ELM_WIN_BASIC); + elm_win_title_set(win, "Progressbar"); + evas_object_smart_callback_add(win, "delete-request", my_bt_39_destroy, test); + + bg = elm_bg_add(win); + elm_win_resize_object_add(win, bg); + evas_object_size_hint_weight_set(bg, 1.0, 1.0); + evas_object_show(bg); + + bx = elm_box_add(win); + evas_object_size_hint_weight_set(bx, 1.0, 1.0); + elm_win_resize_object_add(win, bx); + evas_object_show(bx); + + pb = elm_progressbar_add(win); + evas_object_size_hint_align_set(pb, -1.0, 0.5); + evas_object_size_hint_weight_set(pb, 1.0, 1.0); + elm_box_pack_end(bx, pb); + elm_progressbar_min_max_set(pb, 0.0, 100.0); + elm_progressbar_unit_format_set(pb, "%3.0f / 100"); + elm_progressbar_label_set(pb, "Progression %"); + evas_object_show(pb); + _test_progressbar.pb1 = pb; + + pb = elm_progressbar_add(win); + evas_object_size_hint_align_set(pb, -1.0, 0.5); + evas_object_size_hint_weight_set(pb, 1.0, 1.0); + elm_progressbar_label_set(pb, "Infinite bounce"); + elm_box_pack_end(bx, pb); + evas_object_show(pb); + _test_progressbar.pb2 = pb; + + ic = elm_icon_add(win); + snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR); + elm_icon_file_set(ic, buf, NULL); + evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1); + pb = elm_progressbar_add(win); + elm_progressbar_label_set(pb, "Label"); + elm_progressbar_icon_set(pb, ic); + elm_progressbar_unit_format_set(pb, "%1.1f units"); + elm_progressbar_span_size_set(pb, 200); + evas_object_size_hint_align_set(pb, -1.0, 0.5); + evas_object_size_hint_weight_set(pb, 1.0, 1.0); + elm_box_pack_end(bx, pb); + evas_object_show(ic); + evas_object_show(pb); + _test_progressbar.pb3 = pb; + + bt_bx = elm_box_add(win); + elm_box_horizontal_set(bt_bx, 1); + evas_object_size_hint_weight_set(bt_bx, 1.0, 1.0); + elm_box_pack_end(bx, bt_bx); + evas_object_show(bt_bx); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Start"); + evas_object_smart_callback_add(bt, "clicked", my_bt_39_test_start, NULL); + elm_box_pack_end(bt_bx, bt); + evas_object_show(bt); + + bt = elm_button_add(win); + elm_button_label_set(bt, "Stop"); + evas_object_smart_callback_add(bt, "clicked", my_bt_39_test_stop, NULL); + elm_box_pack_end(bt_bx, bt); + evas_object_show(bt); + + evas_object_show(win); + +} + +static void my_win_main(void) { Evas_Object *win, *bg, *bx0, *lb, *li, *fr; @@ -3591,6 +3722,7 @@ elm_list_item_append(li, "Genlist Tree", NULL, NULL, my_bt_36, NULL); elm_list_item_append(li, "Genlist 5", NULL, NULL, my_bt_37, NULL); elm_list_item_append(li, "Window States", NULL, NULL, my_bt_38, NULL); + elm_list_item_append(li, "Progressbar", NULL, NULL, my_bt_39, NULL); elm_list_go(li); Index: data/themes/default.edc =================================================================== --- data/themes/default.edc (révision 41208) +++ data/themes/default.edc (copie de travail) @@ -10072,4 +10072,337 @@ } } } + +/////////////////////////////////////////////////////////////////////////////// + group { name: "elm/progressbar/horizontal/default"; + images { + image: "bt_basew.png" COMP; + image: "bt_bases.png" COMP; + image: "bt_base1.png" COMP; + } + parts { + part { name: "elm.background.progressbar"; + mouse_events: 0; + description { + min: 80 30; + max: 99999 30; + state: "default" 0.0; + rel1 { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + relative: 1.0 1.0; + } + } + } + part { name: "elm.swallow.bar"; + mouse_events: 0; + type: SWALLOW; +// clip_to: "elm.background.progressbar"; + description { + min: 80 30; + max: 99999 30; + state: "default" 0.0; + rel1 { + to: "elm.text"; + to_y: "elm.background.progressbar"; + relative: 1.0 0.0; + } + rel2 { + to: "elm.background.progressbar"; + relative: 1.0 1.0; + } + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + description { state: "default" 0.0; + visible: 0; + align: 0.0 0.5; + rel1 { + offset: 4 0; + to_y: "elm.background.progressbar"; + } + rel2 { + offset: 3 -1; + relative: 0.0 1.0; + to_y: "elm.background.progressbar"; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + aspect: 1.0 1.0; + aspect_preference: VERTICAL; + rel2.offset: 4 -1; + } + } + part { name: "elm.text"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + visible: 0; + fixed: 1 1; + align: 0.0 0.5; + rel1.to_x: "elm.swallow.content"; + rel1.relative: 1.0 0.0; + rel1.offset: -1 4; + rel2.to_x: "elm.swallow.content"; + rel2.relative: 1.0 1.0; + rel2.offset: -1 -5; + color: 0 0 0 255; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 0 0; + align: 0.0 0.5; + } + } + description { state: "visible" 0.0; + min: 50 20; + inherit: "default" 0.0; + visible: 1; + text.min: 1 1; + rel1.offset: 0 4; + rel2.offset: 0 -5; + } + } + + part { name: "background"; + mouse_events: 0; + clip_to: "elm.background.progressbar"; + description { + state: "default" 0.0; + align: 0.5 0.0; + rel1 { + to: "elm.swallow.bar"; + relative: 0.0 0.0; + } + rel2 { + to: "elm.swallow.bar"; + relative: 1.0 1.0; + offset: -1 -1; + } + image { + normal: "bt_basew.png"; + border: 8 8 8 8; + } + } + } + + part { name: "elm.progress.progressbar"; + mouse_events: 0; + clip_to: "elm.background.progressbar"; + description { + state: "default" 0.0; + rel1 { + to: "elm.swallow.bar"; + relative: 0.0 0.0; + } + rel2 { + to_y: "elm.swallow.bar"; + to_x: "elm.cur.progressbar"; + offset: -1 -1; + } + image { + normal: "bt_base1.png"; + border: 8 8 8 8; + } + } + description { + state: "state_begin" 0.0; + inherit: "default" 0.0; + min: 5 25; + rel1 { + to: "elm.swallow.bar"; + relative: 0.0 0.0; + } + rel2 { + to: "elm.swallow.bar"; + relative: 0.1 1.0; + offset: -1 -1; + } + } + description { + state: "state_end" 0.0; + inherit: "default" 0.0; + rel1 { + to: "elm.swallow.bar"; + relative: 0.9 0.0; + } + rel2 { + to: "elm.swallow.bar"; + relative: 1.0 1.0; + offset: -1 -1; + } + } + } + + part { name: "elm.cur.progressbar"; + mouse_events: 0; + dragable { + confine: "background"; + x: 1 1 1; + y: 0 0 0; + } + description { state: "default" 0.0; + visible: 0; + rel1 { + to: "background"; + relative: 0 0; + } + rel2.to: "background"; + } + } + + part { name: "elm.text.box"; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + rel1 { + to: "elm.swallow.bar"; + relative: 0.5 0.5; + offset: -30 -10; + } + rel2 { + to: "elm.swallow.bar"; + relative: 0.5 0.5; + offset: 30 10; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { name: "elm.box.out"; + mouse_events: 0; + clip_to: "elm.text.box"; + description { + visible: 0; + state: "default" 0.0; + rel1 { + to: "elm.text.box"; + relative: 0.0 0.0; + } + rel2 { + to: "elm.text.box"; + relative: 1.0 1.0; + offset: -1 -1; + } + image { + normal: "bt_basew.png"; + border: 3 3 3 3; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + + part { name: "elm.text.content"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + visible: 0; + align: 1.0 0.0; + rel1 { + to: "elm.text.box"; + relative: 0.0 0.0; + offset: 3.0 1.0; + } + rel2 { + to: "elm.text.box"; + relative: 1.0 1.0; + offset: -3.0 -1.0; + } + color: 0 0 0 255; + text { + font: "Sans,Edje-Vera"; + size: 10; + min: 0 0; + align: 0.5 0.5; + } + } + description { state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + } + programs { + program { name: "label_show"; + signal: "elm,state,text,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.text"; + } + program { name: "label_hide"; + signal: "elm,state,text,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text"; + } + program { name: "icon_show"; + signal: "elm,state,icon,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.swallow.content"; + } + program { name: "icon_hide"; + signal: "elm,state,icon,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.swallow.content"; + } + program { name: "units_show"; + signal: "elm,state,units,visible"; + source: "elm"; + action: STATE_SET "visible" 0.0; + target: "elm.text.content"; + target: "elm.box.out"; + target: "elm.text.box"; + } + program { name: "units_hide"; + signal: "elm,state,units,hidden"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "elm.text.content"; + target: "elm.box.out"; + target: "elm.text.box"; + } + program { name: "slide_to_end"; + action: STATE_SET "state_end" 0.0; + transition: LINEAR 0.5; + target: "elm.progress.progressbar"; + after: "slide_to_begin"; + } + program { name: "slide_to_begin"; + action: STATE_SET "state_begin" 0.0; + target: "elm.progress.progressbar"; + transition: LINEAR 0.5; + after: "slide_to_end"; + } + program { name: "start_pulse"; + signal: "elm,state,pulse,start"; + source: "elm"; + action: STATE_SET "state_begin" 0.0; + target: "elm.progress.progressbar"; + after: "slide_to_end"; + } + program { name: "stop_pulse"; + signal: "elm,state,pulse,stop"; + source: "elm"; + action: ACTION_STOP; + target: "slide_to_begin"; + target: "slide_to_end"; + target: "start_pulse"; + action: STATE_SET "default" 0.0; + target: "elm.progress.progressbar"; + } + } + } }
------------------------------------------------------------------------------
_______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel