summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-10 00:13:03 +0100
committerdavemds <dave@gurumeditation.it>2014-02-10 00:13:03 +0100
commitcc07e231e9c2b2c59e36f4c0d13f36d4e59bd5f3 (patch)
tree478a0f29248207689ce81e624b5379472909b8e4
parent3ce61868e88fa95d507e01587bf4cbbec9b0d1a1 (diff)
Label: add 2 new api for setting the slide animation speed.
Added API: void elm_label_slide_speed_set(Evas_Object *obj, double speed); double elm_label_slide_speed_get(const Evas_Object *obj); This work is based on the previous reverted commit by nirajkr, thanks! I hope this will fullfill his requirement, please let me know of any problems.
-rw-r--r--src/bin/test_label.c100
-rw-r--r--src/lib/elm_label.c92
-rw-r--r--src/lib/elm_label_eo.h34
-rw-r--r--src/lib/elm_label_legacy.h27
-rw-r--r--src/lib/elm_widget_label.h2
5 files changed, 208 insertions, 47 deletions
diff --git a/src/bin/test_label.c b/src/bin/test_label.c
index 7e6a73d68..abaf83700 100644
--- a/src/bin/test_label.c
+++ b/src/bin/test_label.c
@@ -100,19 +100,35 @@ _cb_size_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
100} 100}
101 101
102static void 102static void
103_change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 103_duration_change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
104{ 104{
105 Evas_Object *lb = (Evas_Object *)data; 105 Evas_Object *lb = (Evas_Object *)data;
106 double val = elm_slider_value_get(obj); 106 double val = elm_slider_value_get(obj);
107
107 elm_label_slide_duration_set(lb, val); 108 elm_label_slide_duration_set(lb, val);
108 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS);
109 elm_label_slide_go(lb); 109 elm_label_slide_go(lb);
110
111 Evas_Object *sl = evas_object_data_get(lb, "speed_slider");
112 elm_slider_value_set(sl, elm_label_slide_speed_get(lb));
113}
114
115static void
116_speed_change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
117{
118 Evas_Object *lb = (Evas_Object *)data;
119 double val = elm_slider_value_get(obj);
120
121 elm_label_slide_speed_set(lb, val);
122 elm_label_slide_go(lb);
123
124 Evas_Object *sl = evas_object_data_get(lb, "duration_slider");
125 elm_slider_value_set(sl, elm_label_slide_duration_get(lb));
110} 126}
111 127
112void 128void
113test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 129test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
114{ 130{
115 Evas_Object *win, *gd, *rect, *lb, *rd, *rdg, *sl; 131 Evas_Object *win, *gd, *rect, *lb, *lb1, *lb2, *rd, *rdg, *sl;
116 132
117 win = elm_win_util_standard_add("label2", "Label 2"); 133 win = elm_win_util_standard_add("label2", "Label 2");
118 elm_win_autodel_set(win, EINA_TRUE); 134 elm_win_autodel_set(win, EINA_TRUE);
@@ -126,13 +142,11 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
126 /* Test Label Ellipsis */ 142 /* Test Label Ellipsis */
127 lb = elm_label_add(win); 143 lb = elm_label_add(win);
128 elm_object_text_set(lb, "Test Label Ellipsis:"); 144 elm_object_text_set(lb, "Test Label Ellipsis:");
129 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS); 145 elm_grid_pack(gd, lb, 5, 0, 90, 10);
130 elm_label_slide_go(lb);
131 elm_grid_pack(gd, lb, 5, 5, 90, 10);
132 evas_object_show(lb); 146 evas_object_show(lb);
133 147
134 rect = evas_object_rectangle_add(evas_object_evas_get(win)); 148 rect = evas_object_rectangle_add(evas_object_evas_get(win));
135 elm_grid_pack(gd, rect, 5, 15, 90, 10); 149 elm_grid_pack(gd, rect, 5, 10, 90, 10);
136 evas_object_color_set(rect, 255, 125, 125, 255); 150 evas_object_color_set(rect, 255, 125, 125, 255);
137 evas_object_show(rect); 151 evas_object_show(rect);
138 152
@@ -144,19 +158,17 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
144 "at the end of the widget." 158 "at the end of the widget."
145 ); 159 );
146 elm_label_ellipsis_set(lb, EINA_TRUE); 160 elm_label_ellipsis_set(lb, EINA_TRUE);
147 elm_grid_pack(gd, lb, 5, 15, 90, 10); 161 elm_grid_pack(gd, lb, 5, 10, 90, 10);
148 evas_object_show(lb); 162 evas_object_show(lb);
149 163
150 /* Test Label Slide */ 164 /* Test Label Slide */
151 lb = elm_label_add(win); 165 lb = elm_label_add(win);
152 elm_object_text_set(lb, "Test Label Slide:"); 166 elm_object_text_set(lb, "Test Label Slide:");
153 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS); 167 elm_grid_pack(gd, lb, 5, 20, 90, 10);
154 elm_label_slide_go(lb);
155 elm_grid_pack(gd, lb, 5, 30, 90, 10);
156 evas_object_show(lb); 168 evas_object_show(lb);
157 169
158 rect = evas_object_rectangle_add(evas_object_evas_get(win)); 170 rect = evas_object_rectangle_add(evas_object_evas_get(win));
159 elm_grid_pack(gd, rect, 5, 40, 90, 10); 171 elm_grid_pack(gd, rect, 5, 30, 90, 10);
160 evas_object_color_set(rect, 255, 125, 125, 255); 172 evas_object_color_set(rect, 255, 125, 125, 255);
161 evas_object_show(rect); 173 evas_object_show(rect);
162 174
@@ -169,9 +181,10 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
169 "This only works with the themes \"slide_short\", " 181 "This only works with the themes \"slide_short\", "
170 "\"slide_long\" and \"slide_bounce\"." 182 "\"slide_long\" and \"slide_bounce\"."
171 ); 183 );
172 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_ALWAYS); 184 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_AUTO);
185 elm_label_slide_speed_set(lb, 40.0);
173 elm_label_slide_go(lb); 186 elm_label_slide_go(lb);
174 elm_grid_pack(gd, lb, 5, 40, 90, 10); 187 elm_grid_pack(gd, lb, 5, 30, 90, 10);
175 evas_object_show(lb); 188 evas_object_show(lb);
176 189
177 rd = elm_radio_add(win); 190 rd = elm_radio_add(win);
@@ -179,7 +192,7 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
179 elm_object_text_set(rd, "slide_short"); 192 elm_object_text_set(rd, "slide_short");
180 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 193 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
181 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); 194 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb);
182 elm_grid_pack(gd, rd, 5, 50, 30, 10); 195 elm_grid_pack(gd, rd, 5, 40, 30, 10);
183 evas_object_show(rd); 196 evas_object_show(rd);
184 rdg = rd; 197 rdg = rd;
185 198
@@ -189,7 +202,7 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
189 elm_object_text_set(rd, "slide_long"); 202 elm_object_text_set(rd, "slide_long");
190 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 203 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
191 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); 204 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb);
192 elm_grid_pack(gd, rd, 35, 50, 30, 10); 205 elm_grid_pack(gd, rd, 35, 40, 30, 10);
193 evas_object_show(rd); 206 evas_object_show(rd);
194 207
195 rd = elm_radio_add(win); 208 rd = elm_radio_add(win);
@@ -198,20 +211,65 @@ test_label2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
198 elm_object_text_set(rd, "slide_bounce"); 211 elm_object_text_set(rd, "slide_bounce");
199 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 212 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
200 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); 213 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb);
201 elm_grid_pack(gd, rd, 65, 50, 30, 10); 214 elm_grid_pack(gd, rd, 65, 40, 30, 10);
202 evas_object_show(rd); 215 evas_object_show(rd);
203 216
204 sl = elm_slider_add(win); 217 sl = elm_slider_add(win);
205 elm_object_text_set(sl, "Slide Duration"); 218 elm_object_text_set(sl, "Slide Duration");
206 elm_slider_unit_format_set(sl, "%1.1f units"); 219 elm_slider_unit_format_set(sl, "%1.1f sec");
207 elm_slider_min_max_set(sl, 1, 20); 220 elm_slider_min_max_set(sl, 3, 30);
208 elm_slider_value_set(sl, 10); 221 elm_slider_value_set(sl, elm_label_slide_duration_get(lb));
209 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 222 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
210 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 223 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
211 evas_object_smart_callback_add(sl, "changed", _change_cb, lb); 224 evas_object_smart_callback_add(sl, "changed", _duration_change_cb, lb);
225 evas_object_data_set(lb, "duration_slider", sl);
226 elm_grid_pack(gd, sl, 5, 50, 90, 10);
227 evas_object_show(sl);
228
229 sl = elm_slider_add(win);
230 elm_object_text_set(sl, "Slide Speed");
231 elm_slider_unit_format_set(sl, "%1.1f px/sec");
232 elm_slider_min_max_set(sl, 40, 300);
233 elm_slider_value_set(sl, elm_label_slide_speed_get(lb));
234 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
235 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
236 evas_object_smart_callback_add(sl, "changed", _speed_change_cb, lb);
237 evas_object_data_set(lb, "speed_slider", sl);
212 elm_grid_pack(gd, sl, 5, 60, 90, 10); 238 elm_grid_pack(gd, sl, 5, 60, 90, 10);
213 evas_object_show(sl); 239 evas_object_show(sl);
214 240
241 /* Test 2 label at the same speed */
242 lb = elm_label_add(win);
243 elm_object_text_set(lb, "Test 2 label with the same speed:");
244 elm_grid_pack(gd, lb, 5, 70, 90, 10);
245 evas_object_show(lb);
246
247 rect = evas_object_rectangle_add(evas_object_evas_get(win));
248 elm_grid_pack(gd, rect, 5, 80, 90, 20);
249 evas_object_color_set(rect, 255, 125, 125, 255);
250 evas_object_show(rect);
251
252 lb1 = elm_label_add(win);
253 elm_object_style_set(lb1, "slide_long");
254 elm_object_text_set(lb1, "This is a label set to slide with a fixed speed,"
255 " should match the speed with the below label."
256 " This label has few extra char for testing.");
257 elm_label_slide_mode_set(lb1, ELM_LABEL_SLIDE_MODE_ALWAYS);
258 elm_label_slide_speed_set(lb1, 40.0);
259 elm_label_slide_go(lb1);
260 elm_grid_pack(gd, lb1, 5, 80, 90, 10);
261 evas_object_show(lb1);
262
263 lb2 = elm_label_add(win);
264 elm_object_style_set(lb2, "slide_long");
265 elm_object_text_set(lb2, "This is a label set to slide and will"
266 " match the speed of the upper label.");
267 elm_label_slide_mode_set(lb2, ELM_LABEL_SLIDE_MODE_ALWAYS);
268 elm_label_slide_speed_set(lb2, 40.0);
269 elm_label_slide_go(lb2);
270 elm_grid_pack(gd, lb2, 5, 90, 90, 10);
271 evas_object_show(lb2);
272
215 evas_object_resize(win, 320, 320); 273 evas_object_resize(win, 320, 320);
216 evas_object_show(win); 274 evas_object_show(win);
217} 275}
diff --git a/src/lib/elm_label.c b/src/lib/elm_label.c
index 976b18610..10d4c6aa5 100644
--- a/src/lib/elm_label.c
+++ b/src/lib/elm_label.c
@@ -77,7 +77,7 @@ _label_format_set(Evas_Object *obj,
77static void 77static void
78_label_slide_change(Evas_Object *obj) 78_label_slide_change(Evas_Object *obj)
79{ 79{
80 Evas_Object *tb; 80 const Evas_Object *tb;
81 char *plaintxt; 81 char *plaintxt;
82 int plainlen = 0; 82 int plainlen = 0;
83 83
@@ -106,6 +106,12 @@ _label_slide_change(Evas_Object *obj)
106 //has slide effect. 106 //has slide effect.
107 if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE) 107 if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE)
108 { 108 {
109 Evas_Coord w, tb_w;
110
111 tb = edje_object_part_object_get(wd->resize_obj, "elm.text");
112 evas_object_textblock_size_native_get(tb, &tb_w, NULL);
113 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, NULL);
114
109 if (sd->ellipsis) 115 if (sd->ellipsis)
110 { 116 {
111 sd->slide_ellipsis = EINA_TRUE; 117 sd->slide_ellipsis = EINA_TRUE;
@@ -115,26 +121,29 @@ _label_slide_change(Evas_Object *obj)
115 //slide only if the slide area is smaller than text width size. 121 //slide only if the slide area is smaller than text width size.
116 if (sd->slide_mode == ELM_LABEL_SLIDE_MODE_AUTO) 122 if (sd->slide_mode == ELM_LABEL_SLIDE_MODE_AUTO)
117 { 123 {
118 tb = (Evas_Object *) edje_object_part_object_get(wd->resize_obj, 124 if ((tb_w > 0) && (tb_w < w))
119 "elm.text"); 125 {
120 if (tb) 126 if (sd->slide_ellipsis)
121 { 127 {
122 Evas_Coord w, tb_w; 128 sd->slide_ellipsis = EINA_FALSE;
123 129 elm_label_ellipsis_set(obj, EINA_TRUE);
124 evas_object_textblock_size_formatted_get(tb, &tb_w, NULL); 130 }
125 evas_object_geometry_get(wd->resize_obj, 131 return;
126 NULL, NULL, &w, NULL); 132 }
127 if ((tb_w > 0) && (tb_w < w)) 133 }
128 { 134
129 if (sd->slide_ellipsis) 135 // calculate speed or duration
130 { 136 if (sd->use_slide_speed)
131 sd->slide_ellipsis = EINA_FALSE; 137 {
132 elm_label_ellipsis_set(obj, EINA_TRUE); 138 if (sd->slide_speed <= 0) sd->slide_speed = 1;
133 } 139 sd->slide_duration = (tb_w + w) / sd->slide_speed;
134 return; 140 }
135 } 141 else
136 } 142 {
143 if (sd->slide_duration <= 0) sd->slide_duration = 1;
144 sd->slide_speed = (tb_w + w) / sd->slide_duration;
137 } 145 }
146
138 Edje_Message_Float_Set *msg = 147 Edje_Message_Float_Set *msg =
139 alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double))); 148 alloca(sizeof(Edje_Message_Float_Set) + (sizeof(double)));
140 149
@@ -216,6 +225,7 @@ _on_label_resize(void *data,
216{ 225{
217 ELM_LABEL_DATA_GET(data, sd); 226 ELM_LABEL_DATA_GET(data, sd);
218 227
228 if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE) _label_slide_change(data);
219 if (sd->linewrap) elm_layout_sizing_eval(data); 229 if (sd->linewrap) elm_layout_sizing_eval(data);
220} 230}
221 231
@@ -662,6 +672,7 @@ _slide_duration_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
662 double duration = va_arg(*list, double); 672 double duration = va_arg(*list, double);
663 Elm_Label_Smart_Data *sd = _pd; 673 Elm_Label_Smart_Data *sd = _pd;
664 sd->slide_duration = duration; 674 sd->slide_duration = duration;
675 sd->use_slide_speed = EINA_FALSE;
665} 676}
666 677
667EAPI double 678EAPI double
@@ -674,6 +685,39 @@ elm_label_slide_duration_get(const Evas_Object *obj)
674} 685}
675 686
676EAPI void 687EAPI void
688elm_label_slide_speed_set(Evas_Object *obj, double speed)
689{
690 ELM_LABEL_CHECK(obj);
691 eo_do(obj, elm_obj_label_slide_speed_set(speed));
692}
693
694static void
695_slide_speed_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
696{
697 double speed = va_arg(*list, double);
698 Elm_Label_Smart_Data *sd = _pd;
699 sd->slide_speed = speed;
700 sd->use_slide_speed = EINA_TRUE;
701}
702
703EAPI double
704elm_label_slide_speed_get(const Evas_Object *obj)
705{
706 ELM_LABEL_CHECK(obj) 0.0;
707 double ret = 0.0;
708 eo_do((Eo *) obj, elm_obj_label_slide_speed_get(&ret));
709 return ret;
710}
711
712static void
713_slide_speed_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
714{
715 double *ret = va_arg(*list, double *);
716 Elm_Label_Smart_Data *sd = _pd;
717 *ret = sd->slide_speed;
718}
719
720EAPI void
677elm_label_slide_go(Evas_Object *obj) 721elm_label_slide_go(Evas_Object *obj)
678{ 722{
679 ELM_LABEL_CHECK(obj); 723 ELM_LABEL_CHECK(obj);
@@ -743,6 +787,8 @@ _class_constructor(Eo_Class *klass)
743 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET), _slide_duration_set), 787 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET), _slide_duration_set),
744 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), _slide_duration_get), 788 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), _slide_duration_get),
745 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO), _slide_go), 789 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO), _slide_go),
790 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_SET), _slide_speed_set),
791 EO_OP_FUNC(ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_GET), _slide_speed_get),
746 EO_OP_FUNC_SENTINEL 792 EO_OP_FUNC_SENTINEL
747 }; 793 };
748 eo_class_funcs_set(klass, func_desc); 794 eo_class_funcs_set(klass, func_desc);
@@ -758,9 +804,11 @@ static const Eo_Op_Description op_desc[] = {
758 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET, "Get the ellipsis behavior of the label."), 804 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_ELLIPSIS_GET, "Get the ellipsis behavior of the label."),
759 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET, "Set slide effect mode of label widget."), 805 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_SET, "Set slide effect mode of label widget."),
760 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET, "Get current slide effect mode."), 806 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_MODE_GET, "Get current slide effect mode."),
761 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, "Set the slide duration (speed) of the label."), 807 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, "Set the slide duration of the label."),
762 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, "Get the slide duration(speed) of the label."), 808 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, "Get the slide duration of the label."),
763 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO, "Start slide effect."), 809 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_GO, "Start slide effect."),
810 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_SET, "Set the slide speed of the label."),
811 EO_OP_DESCRIPTION(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_GET, "Get the slide speed of the label."),
764 EO_OP_DESCRIPTION_SENTINEL 812 EO_OP_DESCRIPTION_SENTINEL
765}; 813};
766static const Eo_Class_Description class_desc = { 814static const Eo_Class_Description class_desc = {
diff --git a/src/lib/elm_label_eo.h b/src/lib/elm_label_eo.h
index f79cb95f5..fa87c1074 100644
--- a/src/lib/elm_label_eo.h
+++ b/src/lib/elm_label_eo.h
@@ -22,6 +22,8 @@ enum
22 ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET, 22 ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_SET,
23 ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET, 23 ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET,
24 ELM_OBJ_LABEL_SUB_ID_SLIDE_GO, 24 ELM_OBJ_LABEL_SUB_ID_SLIDE_GO,
25 ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_SET,
26 ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_GET,
25 ELM_OBJ_LABEL_SUB_ID_LAST 27 ELM_OBJ_LABEL_SUB_ID_LAST
26}; 28};
27 29
@@ -144,7 +146,7 @@ enum
144 * @def elm_obj_label_slide_duration_set 146 * @def elm_obj_label_slide_duration_set
145 * @since 1.8 147 * @since 1.8
146 * 148 *
147 * @brief Set the slide duration (speed) of the label 149 * @brief Set the slide duration of the label
148 * 150 *
149 * @param[in] duration 151 * @param[in] duration
150 * 152 *
@@ -158,7 +160,7 @@ enum
158 * @def elm_obj_label_slide_duration_get 160 * @def elm_obj_label_slide_duration_get
159 * @since 1.8 161 * @since 1.8
160 * 162 *
161 * @brief Get the slide duration(speed) of the label 163 * @brief Get the slide duration of the label
162 * 164 *
163 * @param[out] ret 165 * @param[out] ret
164 * 166 *
@@ -169,6 +171,34 @@ enum
169#define elm_obj_label_slide_duration_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), EO_TYPECHECK(double *, ret) 171#define elm_obj_label_slide_duration_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_DURATION_GET), EO_TYPECHECK(double *, ret)
170 172
171/** 173/**
174 * @def elm_obj_label_slide_speed_set
175 * @since 1.9
176 *
177 * @brief Set the slide speed of the label
178 *
179 * @param[in] speed
180 *
181 * @see elm_label_slide_speed_set
182 *
183 * @ingroup Label
184 */
185#define elm_obj_label_slide_speed_set(speed) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_SET), EO_TYPECHECK(double, speed)
186
187/**
188 * @def elm_obj_label_slide_speed_get
189 * @since 1.9
190 *
191 * @brief Get the slide speed of the label
192 *
193 * @param[out] ret
194 *
195 * @see elm_label_slide_speed_get
196 *
197 * @ingroup Label
198 */
199#define elm_obj_label_slide_speed_get(ret) ELM_OBJ_LABEL_ID(ELM_OBJ_LABEL_SUB_ID_SLIDE_SPEED_GET), EO_TYPECHECK(double *, ret)
200
201/**
172 * @def elm_obj_label_slide_go 202 * @def elm_obj_label_slide_go
173 * @since 1.8 203 * @since 1.8
174 * 204 *
diff --git a/src/lib/elm_label_legacy.h b/src/lib/elm_label_legacy.h
index b3222b800..f4e7ba24d 100644
--- a/src/lib/elm_label_legacy.h
+++ b/src/lib/elm_label_legacy.h
@@ -128,8 +128,9 @@ EAPI void elm_label_slide_mode_set(Evas_Object *obj, Elm_
128 * @ingroup Label 128 * @ingroup Label
129 */ 129 */
130EAPI Elm_Label_Slide_Mode elm_label_slide_mode_get(const Evas_Object *obj); 130EAPI Elm_Label_Slide_Mode elm_label_slide_mode_get(const Evas_Object *obj);
131
131/** 132/**
132 * @brief Set the slide duration (speed) of the label 133 * @brief Set the slide duration of the label
133 * 134 *
134 * @param obj The label object 135 * @param obj The label object
135 * @param duration The duration in seconds in moving text from slide begin position 136 * @param duration The duration in seconds in moving text from slide begin position
@@ -140,7 +141,7 @@ EAPI Elm_Label_Slide_Mode elm_label_slide_mode_get(const Evas_Object *obj
140EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration); 141EAPI void elm_label_slide_duration_set(Evas_Object *obj, double duration);
141 142
142/** 143/**
143 * @brief Get the slide duration(speed) of the label 144 * @brief Get the slide duration of the label
144 * 145 *
145 * @param obj The label object 146 * @param obj The label object
146 * @return The duration time in moving text from slide begin position to slide end position 147 * @return The duration time in moving text from slide begin position to slide end position
@@ -152,6 +153,28 @@ EAPI void elm_label_slide_duration_set(Evas_Object *obj,
152EAPI double elm_label_slide_duration_get(const Evas_Object *obj); 153EAPI double elm_label_slide_duration_get(const Evas_Object *obj);
153 154
154/** 155/**
156 * @brief Set the slide speed of the label
157 *
158 * @param obj The label object
159 * @param speed The speed of the slide animation in px per seconds
160 *
161 * @ingroup Label
162 */
163EAPI void elm_label_slide_speed_set(Evas_Object *obj, double speed);
164
165/**
166 * @brief Get the slide speed of the label
167 *
168 * @param obj The label object
169 * @return The slide animation speed in px per seconds
170 *
171 * @see elm_label_slide_speed_set()
172 *
173 * @ingroup Label
174 */
175EAPI double elm_label_slide_speed_get(const Evas_Object *obj);
176
177/**
155 * @brief Start slide effect. 178 * @brief Start slide effect.
156 * 179 *
157 * @param obj The label object 180 * @param obj The label object
diff --git a/src/lib/elm_widget_label.h b/src/lib/elm_widget_label.h
index 4e2ac7254..399e7747d 100644
--- a/src/lib/elm_widget_label.h
+++ b/src/lib/elm_widget_label.h
@@ -13,6 +13,7 @@ struct _Elm_Label_Smart_Data
13{ 13{
14 const char *format; 14 const char *format;
15 double slide_duration; 15 double slide_duration;
16 double slide_speed;
16 Evas_Coord lastw; 17 Evas_Coord lastw;
17 Evas_Coord wrap_w; 18 Evas_Coord wrap_w;
18 Elm_Wrap_Type linewrap; 19 Elm_Wrap_Type linewrap;
@@ -20,6 +21,7 @@ struct _Elm_Label_Smart_Data
20 21
21 Eina_Bool ellipsis : 1; 22 Eina_Bool ellipsis : 1;
22 Eina_Bool slide_ellipsis : 1; 23 Eina_Bool slide_ellipsis : 1;
24 Eina_Bool use_slide_speed : 1;
23}; 25};
24 26
25#define ELM_LABEL_DATA_GET(o, sd) \ 27#define ELM_LABEL_DATA_GET(o, sd) \