summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-10 22:07:28 +0100
committerdavemds <dave@gurumeditation.it>2014-02-10 22:08:00 +0100
commit82ae642408bbf1ac43a8825f8c51a36c27d9b597 (patch)
treeddb90cbd7d1e7ea15219ebf388c65a7772c0054d
parent39cc70ac457aeb0e55f5d5e392449367231840f5 (diff)
Test Label2: keep the slider updated when the label change size
-rw-r--r--src/bin/test_label.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bin/test_label.c b/src/bin/test_label.c
index abaf83700..0a7c1e2e5 100644
--- a/src/bin/test_label.c
+++ b/src/bin/test_label.c
@@ -125,6 +125,16 @@ _speed_change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
125 elm_slider_value_set(sl, elm_label_slide_duration_get(lb)); 125 elm_slider_value_set(sl, elm_label_slide_duration_get(lb));
126} 126}
127 127
128static void
129_label_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
130{
131 Evas_Object *speed_slider = evas_object_data_get(obj, "speed_slider");
132 Evas_Object *duration_slider = evas_object_data_get(obj, "duration_slider");
133
134 elm_slider_value_set(duration_slider, elm_label_slide_duration_get(obj));
135 elm_slider_value_set(speed_slider, elm_label_slide_speed_get(obj));
136}
137
128void 138void
129test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 139test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
130{ 140{
@@ -187,6 +197,10 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
187 elm_grid_pack(gd, lb, 5, 30, 90, 10); 197 elm_grid_pack(gd, lb, 5, 30, 90, 10);
188 evas_object_show(lb); 198 evas_object_show(lb);
189 199
200 /* The speed or the duration of the slide animation will change when the
201 * label change size, so we need to update the sliders on resize. */
202 evas_object_event_callback_add(lb, EVAS_CALLBACK_RESIZE, _label_resize_cb, NULL);
203
190 rd = elm_radio_add(win); 204 rd = elm_radio_add(win);
191 elm_radio_state_value_set(rd, SLIDE_SHORT); 205 elm_radio_state_value_set(rd, SLIDE_SHORT);
192 elm_object_text_set(rd, "slide_short"); 206 elm_object_text_set(rd, "slide_short");
@@ -217,7 +231,7 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
217 sl = elm_slider_add(win); 231 sl = elm_slider_add(win);
218 elm_object_text_set(sl, "Slide Duration"); 232 elm_object_text_set(sl, "Slide Duration");
219 elm_slider_unit_format_set(sl, "%1.1f sec"); 233 elm_slider_unit_format_set(sl, "%1.1f sec");
220 elm_slider_min_max_set(sl, 3, 30); 234 elm_slider_min_max_set(sl, 3, 40);
221 elm_slider_value_set(sl, elm_label_slide_duration_get(lb)); 235 elm_slider_value_set(sl, elm_label_slide_duration_get(lb));
222 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 236 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
223 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 237 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);