1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4
5 #define EFL_ACCESS_OBJECT_PROTECTED
6 #define ELM_LAYOUT_PROTECTED
7 #define EFL_PART_PROTECTED
8 #define EFL_ACCESS_WIDGET_ACTION_PROTECTED
9
10 #include <Elementary.h>
11
12 #include "elm_priv.h"
13 #include "elm_widget_layout.h"
14 #include "elm_widget_label.h"
15 #include "elm_label_part.eo.h"
16 #include "elm_part_helper.h"
17
18 #define MY_CLASS ELM_LABEL_CLASS
19
20 #define MY_CLASS_NAME "Elm_Label"
21 #define MY_CLASS_NAME_LEGACY "elm_label"
22
23 static const char SIG_SLIDE_END[] = "slide,end";
24
25 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
26 {SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
27 {SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
28 {SIG_SLIDE_END, ""},
29 {NULL, NULL}
30 };
31
32 static Eina_Bool
_action_activate(Evas_Object * obj,const char * params EINA_UNUSED)33 _action_activate(Evas_Object *obj, const char *params EINA_UNUSED)
34 {
35 efl_event_callback_legacy_call(obj, EFL_INPUT_EVENT_CLICKED, NULL);
36 return EINA_TRUE;
37 }
38
39 static void
_recalc(void * data)40 _recalc(void *data)
41 {
42 ELM_LABEL_DATA_GET(data, sd);
43 ELM_WIDGET_DATA_GET_OR_RETURN(data, wd);
44
45 Evas_Coord minw = -1, minh = -1;
46 Evas_Coord resw, w;
47
48 evas_event_freeze(evas_object_evas_get(data));
49 edje_object_size_min_calc(wd->resize_obj, &minw, NULL);
50 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, NULL);
51
52 if (sd->wrap_w > minw)
53 resw = sd->wrap_w;
54 else if ((sd->wrap_w > 0) && (minw > sd->wrap_w))
55 resw = minw;
56 else
57 resw = w;
58 edje_object_size_min_restricted_calc(wd->resize_obj, &minw, &minh, resw, 0);
59
60 /* If wrap_w is not set, label's width has to be controlled
61 by outside of label. So, we don't need to set minimum width. */
62 if (sd->wrap_w == -1)
63 evas_object_size_hint_min_set(data, 0, minh);
64 else
65 evas_object_size_hint_min_set(data, minw, minh);
66
67 evas_event_thaw(evas_object_evas_get(data));
68 evas_event_thaw_eval(evas_object_evas_get(data));
69 }
70
71 static void
_label_format_set(Evas_Object * obj,const char * format)72 _label_format_set(Evas_Object *obj, const char *format)
73 {
74 if (format)
75 edje_object_part_text_style_user_push(obj, "elm.text", format);
76 else
77 edje_object_part_text_style_user_pop(obj, "elm.text");
78 }
79
80 static void
_label_slide_change(Evas_Object * obj)81 _label_slide_change(Evas_Object *obj)
82 {
83 const Evas_Object *tb;
84 char *plaintxt;
85 int plainlen = 0;
86
87 ELM_LABEL_DATA_GET(obj, sd);
88 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
89
90 if (!sd->slide_state) return;
91
92 edje_object_signal_emit(wd->resize_obj, "elm,state,slide,stop", "elm");
93
94 //doesn't support multiline slide effect
95 if (sd->linewrap)
96 {
97 WRN("Doesn't support slide effect for multiline! : label=%p", obj);
98 return;
99 }
100
101 //stop if the text is none.
102 plaintxt = _elm_util_mkup_to_text
103 (edje_object_part_text_get(wd->resize_obj, "elm.text"));
104 if (plaintxt)
105 {
106 plainlen = strlen(plaintxt);
107 free(plaintxt);
108 }
109 if (plainlen < 1) return;
110
111 //has slide effect.
112 if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE)
113 {
114 Evas_Coord w, tb_w;
115
116 tb = edje_object_part_object_get(wd->resize_obj, "elm.text");
117 evas_object_textblock_size_native_get(tb, &tb_w, NULL);
118 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &w, NULL);
119 if (w <= 0) return;
120
121 if (sd->ellipsis)
122 {
123 sd->slide_ellipsis = EINA_TRUE;
124 elm_label_ellipsis_set(obj, EINA_FALSE);
125 }
126
127 //slide only if the slide area is smaller than text width size.
128 if (sd->slide_mode == ELM_LABEL_SLIDE_MODE_AUTO)
129 {
130 if ((tb_w > 0) && (tb_w < w))
131 {
132 if (sd->slide_ellipsis)
133 {
134 sd->slide_ellipsis = EINA_FALSE;
135 elm_label_ellipsis_set(obj, EINA_TRUE);
136 }
137 return;
138 }
139 }
140
141 // calculate speed or duration
142 if (!strcmp(elm_object_style_get(obj), "slide_long"))
143 w = tb_w + w;
144 else if (!strcmp(elm_object_style_get(obj), "slide_short") ||
145 !strcmp(elm_object_style_get(obj), "slide_bounce")) // slide_short or slide_bounce
146 w = tb_w - w;
147 else
148 w = tb_w;
149
150 if (sd->use_slide_speed)
151 {
152 if (sd->slide_speed <= 0) sd->slide_speed = 1;
153 sd->slide_duration = w / sd->slide_speed;
154 }
155 else
156 {
157 if (sd->slide_duration <= 0) sd->slide_duration = 1;
158 sd->slide_speed = w / sd->slide_duration;
159 }
160
161 Edje_Message_Float_Set *msg =
162 alloca(sizeof(Edje_Message_Float_Set));
163
164 msg->count = 1;
165 msg->val[0] = sd->slide_duration;
166
167 edje_object_message_send(wd->resize_obj, EDJE_MESSAGE_FLOAT_SET, 0, msg);
168 edje_object_signal_emit(wd->resize_obj, "elm,state,slide,start", "elm");
169 }
170 //no slide effect.
171 else
172 {
173 if (sd->slide_ellipsis)
174 {
175 sd->slide_ellipsis = EINA_FALSE;
176 elm_label_ellipsis_set(obj, EINA_TRUE);
177 }
178 }
179 }
180
181 static void
_elm_label_horizontal_size_policy_update(Eo * obj,Elm_Label_Data * sd)182 _elm_label_horizontal_size_policy_update(Eo *obj, Elm_Label_Data *sd)
183 {
184 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
185
186 if (!sd->ellipsis && (sd->linewrap == ELM_WRAP_NONE))
187 edje_object_signal_emit(wd->resize_obj, "elm,state,horizontal,expandable", "elm");
188 else
189 edje_object_signal_emit(wd->resize_obj, "elm,state,horizontal,fixed", "elm");
190 edje_object_message_signal_process(wd->resize_obj);
191 }
192
193 EOLIAN static Eina_Error
_elm_label_efl_ui_widget_theme_apply(Eo * obj,Elm_Label_Data * sd)194 _elm_label_efl_ui_widget_theme_apply(Eo *obj, Elm_Label_Data *sd)
195 {
196 Eina_Error int_ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
197
198 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EFL_UI_THEME_APPLY_ERROR_GENERIC);
199
200 evas_event_freeze(evas_object_evas_get(obj));
201
202 int_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
203 if (int_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return int_ret;
204
205 _elm_label_horizontal_size_policy_update(obj, sd);
206
207 _label_format_set(wd->resize_obj, sd->format);
208 _label_slide_change(obj);
209
210 evas_event_thaw(evas_object_evas_get(obj));
211 evas_event_thaw_eval(evas_object_evas_get(obj));
212
213 elm_layout_sizing_eval(obj);
214
215 return int_ret;
216 }
217
218 EOLIAN static void
_elm_label_efl_canvas_group_group_calculate(Eo * obj,Elm_Label_Data * _pd EINA_UNUSED)219 _elm_label_efl_canvas_group_group_calculate(Eo *obj, Elm_Label_Data *_pd EINA_UNUSED)
220 {
221 Evas_Coord minw = -1, minh = -1;
222 Evas_Coord resw, resh;
223
224 ELM_LABEL_DATA_GET(obj, sd);
225 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
226
227 if (sd->linewrap)
228 {
229 evas_object_geometry_get(wd->resize_obj, NULL, NULL, &resw, &resh);
230 if (resw == sd->lastw) return;
231 sd->lastw = resw;
232 _recalc(obj);
233 }
234 else
235 {
236 evas_event_freeze(evas_object_evas_get(obj));
237 edje_object_size_min_calc(wd->resize_obj, &minw, &minh);
238 if (sd->wrap_w > 0 && minw > sd->wrap_w) minw = sd->wrap_w;
239 evas_object_size_hint_min_set(obj, minw, minh);
240 evas_event_thaw(evas_object_evas_get(obj));
241 evas_event_thaw_eval(evas_object_evas_get(obj));
242 }
243 }
244
245 static void
_on_label_resize(void * data,Evas * e EINA_UNUSED,Evas_Object * obj EINA_UNUSED,void * event_info EINA_UNUSED)246 _on_label_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
247 {
248 ELM_LABEL_DATA_GET(data, sd);
249
250 if (sd->slide_mode != ELM_LABEL_SLIDE_MODE_NONE) _label_slide_change(data);
251 if (sd->linewrap) elm_layout_sizing_eval(data);
252 }
253
254 static int
_get_value_in_key_string(const char * oldstring,const char * key,char ** value)255 _get_value_in_key_string(const char *oldstring, const char *key, char **value)
256 {
257 char *curlocater, *endtag;
258 int firstindex = 0, foundflag = -1;
259
260 curlocater = strstr(oldstring, key);
261 if (curlocater)
262 {
263 int key_len = strlen(key);
264 endtag = curlocater + key_len;
265 if ((!endtag) || (*endtag != '='))
266 return -1;
267
268 firstindex = abs((int)(oldstring - curlocater));
269 firstindex += key_len + 1; // strlen("key") + strlen("=")
270 *value = (char *)oldstring + firstindex;
271
272 foundflag = 1;
273 }
274 else
275 {
276 foundflag = 0;
277 }
278
279 if (foundflag == 1) return 0;
280
281 return -1;
282 }
283
284 static int
_strbuf_key_value_replace(Eina_Strbuf * srcbuf,const char * key,const char * value,int deleteflag)285 _strbuf_key_value_replace(Eina_Strbuf *srcbuf, const char *key, const char *value, int deleteflag)
286 {
287 char *kvalue;
288 const char *srcstring = NULL;
289
290 srcstring = eina_strbuf_string_get(srcbuf);
291
292 if (_get_value_in_key_string(srcstring, key, &kvalue) == 0)
293 {
294 const char *val_end;
295 int val_end_idx = 0;
296 int key_start_idx = 0;
297 val_end = strchr(kvalue, ' ');
298
299 if (val_end)
300 val_end_idx = val_end - srcstring;
301 else
302 val_end_idx = kvalue - srcstring + strlen(kvalue) - 1;
303
304 /* -1 is because of the '=' */
305 key_start_idx = kvalue - srcstring - 1 - strlen(key);
306 eina_strbuf_remove(srcbuf, key_start_idx, val_end_idx);
307 if (!deleteflag)
308 {
309 eina_strbuf_insert_printf(srcbuf, "%s=%s", key_start_idx, key,
310 value);
311 }
312 }
313 else if (!deleteflag)
314 {
315 if (*srcstring)
316 {
317 /* -1 because we want it before the ' */
318 eina_strbuf_insert_printf (srcbuf, " %s=%s",
319 eina_strbuf_length_get(srcbuf) - 1, key, value);
320 }
321 else
322 {
323 eina_strbuf_append_printf(srcbuf, "DEFAULT='%s=%s'", key, value);
324 }
325 }
326
327 return 0;
328 }
329
330 static int
_stringshare_key_value_replace(const char ** srcstring,const char * key,const char * value,int deleteflag)331 _stringshare_key_value_replace(const char **srcstring, const char *key, const char *value, int deleteflag)
332 {
333 Eina_Strbuf *sharebuf = NULL;
334
335 sharebuf = eina_strbuf_new();
336 eina_strbuf_append(sharebuf, *srcstring);
337 _strbuf_key_value_replace(sharebuf, key, value, deleteflag);
338 eina_stringshare_del(*srcstring);
339 *srcstring = eina_stringshare_add(eina_strbuf_string_get(sharebuf));
340 eina_strbuf_free(sharebuf);
341
342 return 0;
343 }
344
345 static Eina_Bool
_elm_label_text_set(Eo * obj,Elm_Label_Data * sd,const char * part,const char * label)346 _elm_label_text_set(Eo *obj, Elm_Label_Data *sd, const char *part, const char *label)
347 {
348 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
349
350 if (!label) label = "";
351 _label_format_set(wd->resize_obj, sd->format);
352
353 efl_text_markup_set(efl_part(efl_super(obj, MY_CLASS), part), label);
354
355 sd->lastw = -1;
356 elm_layout_sizing_eval(obj);
357 _label_slide_change(obj);
358
359 return EINA_TRUE;
360 }
361
362 static char *
_access_info_cb(void * data EINA_UNUSED,Evas_Object * obj)363 _access_info_cb(void *data EINA_UNUSED, Evas_Object *obj)
364 {
365 const char *txt = elm_widget_access_info_get(obj);
366
367 if (!txt)
368 return _elm_util_mkup_to_text(elm_layout_text_get(obj, NULL));
369 else return strdup(txt);
370 }
371
372 static void
_on_slide_end(void * data,Evas_Object * obj EINA_UNUSED,const char * emission EINA_UNUSED,const char * source EINA_UNUSED)373 _on_slide_end(void *data, Evas_Object *obj EINA_UNUSED,
374 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
375 {
376 ELM_LABEL_DATA_GET(data, sd);
377
378 if (sd->slide_ellipsis)
379 elm_obj_label_ellipsis_set(data, EINA_TRUE);
380
381 efl_event_callback_legacy_call(data, ELM_LABEL_EVENT_SLIDE_END, NULL);
382 }
383
384 EOLIAN static void
_elm_label_efl_canvas_group_group_add(Eo * obj,Elm_Label_Data * priv)385 _elm_label_efl_canvas_group_group_add(Eo *obj, Elm_Label_Data *priv)
386 {
387 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
388
389 efl_canvas_group_add(efl_super(obj, MY_CLASS));
390
391 priv->linewrap = ELM_WRAP_NONE;
392 priv->wrap_w = -1;
393 priv->slide_duration = 10;
394
395 priv->format = eina_stringshare_add("");
396 _label_format_set(wd->resize_obj, priv->format);
397
398 evas_object_event_callback_add(wd->resize_obj, EVAS_CALLBACK_RESIZE,
399 _on_label_resize, obj);
400
401 edje_object_signal_callback_add(wd->resize_obj, "elm,state,slide,end", "elm",
402 _on_slide_end, obj);
403
404 /* access */
405 elm_widget_can_focus_set(obj, _elm_config->access_mode);
406
407 _elm_access_object_register(obj, wd->resize_obj);
408 _elm_access_text_set(_elm_access_info_get(obj), ELM_ACCESS_TYPE,
409 E_("Label"));
410 _elm_access_callback_set(_elm_access_info_get(obj), ELM_ACCESS_INFO,
411 _access_info_cb, NULL);
412
413 if (!elm_layout_theme_set(obj, "label", "base", elm_widget_style_get(obj)))
414 CRI("Failed to set layout!");
415
416 elm_layout_text_set(obj, NULL, "<br>");
417 elm_layout_sizing_eval(obj);
418 }
419
420 EAPI Evas_Object *
elm_label_add(Evas_Object * parent)421 elm_label_add(Evas_Object *parent)
422 {
423 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
424 return elm_legacy_add(MY_CLASS, parent);
425 }
426
427 EOLIAN const Efl_Access_Action_Data *
_elm_label_efl_access_widget_action_elm_actions_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * pd EINA_UNUSED)428 _elm_label_efl_access_widget_action_elm_actions_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *pd EINA_UNUSED)
429 {
430 static Efl_Access_Action_Data access_actions[] = {
431 { "activate", "activate", NULL, _action_activate },
432 { NULL, NULL, NULL, NULL },
433 };
434 return &access_actions[0];
435 }
436
437 EOLIAN static Eo *
_elm_label_efl_object_constructor(Eo * obj,Elm_Label_Data * _pd EINA_UNUSED)438 _elm_label_efl_object_constructor(Eo *obj, Elm_Label_Data *_pd EINA_UNUSED)
439 {
440 obj = efl_constructor(efl_super(obj, MY_CLASS));
441 efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
442 evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
443 efl_access_object_role_set(obj, EFL_ACCESS_ROLE_LABEL);
444
445 return obj;
446 }
447
448 EOLIAN static void
_elm_label_line_wrap_set(Eo * obj,Elm_Label_Data * sd,Elm_Wrap_Type wrap)449 _elm_label_line_wrap_set(Eo *obj, Elm_Label_Data *sd, Elm_Wrap_Type wrap)
450 {
451 const char *wrap_str, *text;
452 int len;
453
454 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
455
456 if (sd->linewrap == wrap) return;
457
458 sd->linewrap = wrap;
459 sd->lastw = -1;
460
461 _elm_label_horizontal_size_policy_update(obj, sd);
462
463 text = elm_layout_text_get(obj, NULL);
464 if (!text) return;
465
466 len = strlen(text);
467 if (len <= 0) return;
468
469 switch (wrap)
470 {
471 case ELM_WRAP_CHAR:
472 wrap_str = "char";
473 break;
474
475 case ELM_WRAP_WORD:
476 wrap_str = "word";
477 break;
478
479 case ELM_WRAP_MIXED:
480 wrap_str = "mixed";
481 break;
482
483 default:
484 wrap_str = "none";
485 break;
486 }
487
488 if (_stringshare_key_value_replace(&sd->format, "wrap", wrap_str, 0) == 0)
489 {
490 sd->lastw = -1;
491 _label_format_set(wd->resize_obj, sd->format);
492 elm_layout_sizing_eval(obj);
493 }
494 }
495
496 EOLIAN static Elm_Wrap_Type
_elm_label_line_wrap_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * sd)497 _elm_label_line_wrap_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
498 {
499 return sd->linewrap;
500 }
501
502 EOLIAN static void
_elm_label_wrap_width_set(Eo * obj,Elm_Label_Data * sd,Evas_Coord w)503 _elm_label_wrap_width_set(Eo *obj, Elm_Label_Data *sd, Evas_Coord w)
504 {
505 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
506
507 if (w < 0) w = 0;
508
509 if (sd->wrap_w == w) return;
510
511 if (sd->ellipsis)
512 _label_format_set(wd->resize_obj, sd->format);
513 sd->wrap_w = w;
514 sd->lastw = -1;
515
516 elm_layout_sizing_eval(obj);
517 }
518
519 EOLIAN static Evas_Coord
_elm_label_wrap_width_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * sd)520 _elm_label_wrap_width_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
521 {
522 return sd->wrap_w;
523 }
524
525 EOLIAN static void
_elm_label_ellipsis_set(Eo * obj,Elm_Label_Data * sd,Eina_Bool ellipsis)526 _elm_label_ellipsis_set(Eo *obj, Elm_Label_Data *sd, Eina_Bool ellipsis)
527 {
528 Eina_Strbuf *fontbuf = NULL;
529 int len, removeflag = 0;
530 const char *text;
531
532 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
533
534 if (sd->ellipsis == ellipsis) return;
535 sd->ellipsis = ellipsis;
536 sd->lastw = -1;
537
538 _elm_label_horizontal_size_policy_update(obj, sd);
539
540 text = elm_layout_text_get(obj, NULL);
541 if (!text) return;
542
543 len = strlen(text);
544 if (len <= 0) return;
545
546 if (ellipsis == EINA_FALSE) removeflag = 1; // remove fontsize tag
547
548 fontbuf = eina_strbuf_new();
549 eina_strbuf_append_printf(fontbuf, "%f", 1.0);
550
551 if (_stringshare_key_value_replace
552 (&sd->format, "ellipsis", eina_strbuf_string_get
553 (fontbuf), removeflag) == 0)
554 {
555 _label_format_set(wd->resize_obj, sd->format);
556 elm_layout_sizing_eval(obj);
557 }
558 eina_strbuf_free(fontbuf);
559 }
560
561 EOLIAN static Eina_Bool
_elm_label_ellipsis_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * sd)562 _elm_label_ellipsis_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
563 {
564 return sd->ellipsis;
565 }
566
567 EOLIAN static void
_elm_label_slide_mode_set(Eo * obj EINA_UNUSED,Elm_Label_Data * sd,Elm_Label_Slide_Mode mode)568 _elm_label_slide_mode_set(Eo *obj EINA_UNUSED, Elm_Label_Data *sd, Elm_Label_Slide_Mode mode)
569 {
570 sd->slide_mode = mode;
571 }
572
573 EOLIAN static Elm_Label_Slide_Mode
_elm_label_slide_mode_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * sd)574 _elm_label_slide_mode_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
575 {
576 return sd->slide_mode;
577 }
578
579 EINA_DEPRECATED EAPI void
elm_label_slide_set(Evas_Object * obj,Eina_Bool slide)580 elm_label_slide_set(Evas_Object *obj, Eina_Bool slide)
581 {
582 if (slide)
583 elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_ALWAYS);
584 else
585 elm_label_slide_mode_set(obj, ELM_LABEL_SLIDE_MODE_NONE);
586 }
587
588 EINA_DEPRECATED EAPI Eina_Bool
elm_label_slide_get(const Evas_Object * obj)589 elm_label_slide_get(const Evas_Object *obj)
590 {
591 Eina_Bool ret = EINA_FALSE;
592 if (elm_label_slide_mode_get(obj) == ELM_LABEL_SLIDE_MODE_ALWAYS)
593 ret = EINA_TRUE;
594 return ret;
595 }
596
597 EOLIAN static void
_elm_label_slide_duration_set(Eo * obj EINA_UNUSED,Elm_Label_Data * sd,double duration)598 _elm_label_slide_duration_set(Eo *obj EINA_UNUSED, Elm_Label_Data *sd, double duration)
599 {
600 sd->slide_duration = duration;
601 sd->use_slide_speed = EINA_FALSE;
602 }
603
604 EOLIAN static void
_elm_label_slide_speed_set(Eo * obj EINA_UNUSED,Elm_Label_Data * sd,double speed)605 _elm_label_slide_speed_set(Eo *obj EINA_UNUSED, Elm_Label_Data *sd, double speed)
606 {
607 sd->slide_speed = speed;
608 sd->use_slide_speed = EINA_TRUE;
609 }
610
611 EOLIAN static double
_elm_label_slide_speed_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * sd)612 _elm_label_slide_speed_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
613 {
614 return sd->slide_speed;
615 }
616
617 EOLIAN static void
_elm_label_slide_go(Eo * obj,Elm_Label_Data * sd)618 _elm_label_slide_go(Eo *obj, Elm_Label_Data *sd)
619 {
620 if (!sd->slide_state) sd->slide_state = EINA_TRUE;
621
622 _label_slide_change(obj);
623 elm_layout_sizing_eval(obj);
624 }
625
626 EOLIAN static double
_elm_label_slide_duration_get(const Eo * obj EINA_UNUSED,Elm_Label_Data * sd)627 _elm_label_slide_duration_get(const Eo *obj EINA_UNUSED, Elm_Label_Data *sd)
628 {
629 return sd->slide_duration;
630 }
631
632 EOLIAN static void
_elm_label_class_constructor(Efl_Class * klass)633 _elm_label_class_constructor(Efl_Class *klass)
634 {
635 evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
636 }
637
638 /* Efl.Part begin */
639 ELM_PART_OVERRIDE(elm_label, ELM_LABEL, Elm_Label_Data)
640 ELM_PART_OVERRIDE_TEXT_SET(elm_label, ELM_LABEL, Elm_Label_Data)
641
642 #include "elm_label_part.eo.c"
643 /* Efl.Part end */
644
645 /* Internal EO APIs and hidden overrides */
646
647 #define ELM_LABEL_EXTRA_OPS \
648 EFL_CANVAS_GROUP_CALC_OPS(elm_label), \
649 EFL_CANVAS_GROUP_ADD_OPS(elm_label)
650
651 #include "elm_label_eo.c"
652