ff5b58258c48bb2cd3505d960904861c59e28a70
[platform/upstream/elementary.git] / src / lib / efl_ui_textpath.c
1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4
5 #define ELM_LAYOUT_PROTECTED
6
7 #include <Elementary.h>
8 #include "elm_priv.h"
9
10 #include "elm_widget_layout.h"
11 //#include "efl_ui_textpath_internal_part.eo.h"
12 //#include "elm_part_helper.h"
13
14
15 #define MY_CLASS EFL_UI_TEXTPATH_CLASS
16
17 #define MY_CLASS_NAME "Efl.Ui.Textpath"
18 #define MY_CLASS_NAME_LEGACY "elm_textpath"
19
20 #define SLICE_DEFAULT_NO 99
21
22 typedef struct _Efl_Ui_Textpath_Point Efl_Ui_Textpath_Point;
23 typedef struct _Efl_Ui_Textpath_Line Efl_Ui_Textpath_Line;
24 typedef struct _Efl_Ui_Textpath_Segment Efl_Ui_Textpath_Segment;
25 typedef struct _Efl_Ui_Textpath_Data Efl_Ui_Textpath_Data;
26
27 struct _Efl_Ui_Textpath_Point
28 {
29    double x;
30    double y;
31 };
32
33 struct _Efl_Ui_Textpath_Line
34 {
35    Efl_Ui_Textpath_Point start;
36    Efl_Ui_Textpath_Point end;
37 };
38
39 struct _Efl_Ui_Textpath_Segment
40 {
41    EINA_INLIST;
42    int length;
43    Efl_Gfx_Path_Command type;
44    union
45      {
46         Eina_Bezier bezier;
47         Efl_Ui_Textpath_Line line;
48      };
49 };
50
51 struct _Efl_Ui_Textpath_Data
52 {
53    Evas_Object *text_obj;
54    char *text;
55    Efl_Gfx_Shape *path;
56    struct {
57         double x, y;
58         double radius;
59         double start_angle;
60    } circle;
61    Efl_Ui_Textpath_Direction direction;
62    int slice_no;
63    Eina_Bool autofit;
64    Eina_Bool ellipsis;
65
66    Eina_Inlist *segments;
67    int total_length;
68 };
69
70 #define EFL_UI_TEXTPATH_DATA_GET(o, sd) \
71    Efl_Ui_Textpath_Data *sd = eo_data_scope_get(o, EFL_UI_TEXTPATH_CLASS)
72
73 static inline double
74 _deg_to_rad(double angle)
75 {
76    return angle / 180 * M_PI;
77 }
78
79 static void
80 _segment_draw(Efl_Ui_Textpath_Data *pd, int slice_no, int w1, int w2, int cmp, Evas_Map *map, Eina_Bezier bezier)
81 {
82    int x = 0, y = 0, w = 0, h = 0;
83    int i, len, seg_len;
84    double u0, u1, v0, v1;
85    double dist, t, dt;
86    double px, py, px2, py2;
87    double rad;
88    Eina_Vector2 vec, nvec, vec0, vec1, vec2, vec3;
89    Eina_Matrix2 mat;
90
91    len = w2 - w1;
92    evas_object_geometry_get(pd->text_obj, NULL, NULL, &w, &h);
93    seg_len = eina_bezier_length_get(&bezier);
94    if (pd->autofit)
95      dt = len / (seg_len * (double) slice_no);
96    else
97      dt = 1.0 / (double) slice_no;
98    dist = len / (double)slice_no;
99    rad = _deg_to_rad(90);
100    eina_matrix2_values_set(&mat, cos(rad), -sin(rad), sin(rad), cos(rad));
101
102    eina_bezier_values_get(&bezier, NULL, NULL, NULL, NULL, NULL, NULL, &px2, &py2);
103    t = 0;
104    eina_bezier_point_at(&bezier, t, &px, &py);
105    eina_bezier_point_at(&bezier, t + dt, &px2, &py2);
106
107    vec.x = (px2 - px);
108    vec.y = (py2 - py);
109    eina_vector2_normalize(&nvec, &vec);
110
111    eina_vector2_transform(&vec, &mat, &nvec);
112    eina_vector2_normalize(&nvec, &vec);
113    eina_vector2_scale(&vec, &nvec, ((double) h) * 0.5);
114
115    vec1.x = (vec.x + px);
116    vec1.y = (vec.y + py);
117    vec2.x = (-vec.x + px);
118    vec2.y = (-vec.y + py);
119
120    //add points to map
121    for (i = 0; i < slice_no; i++)
122      {
123         //v0, v3
124         vec0.x = vec1.x;
125         vec0.y = vec1.y;
126         vec3.x = vec2.x;
127         vec3.y = vec2.y;
128
129         //v1, v2
130         t = ((double) (i + 1) * dt);
131         eina_bezier_point_at(&bezier, t, &px, &py);
132         eina_bezier_point_at(&bezier, t + dt, &px2, &py2);
133
134         vec.x = (px2 - px);
135         vec.y = (py2 - py);
136         eina_vector2_normalize(&nvec, &vec);
137         eina_vector2_transform(&vec, &mat, &nvec);
138         eina_vector2_normalize(&nvec, &vec);
139         eina_vector2_scale(&vec, &nvec, ((double) h) * 0.5);
140
141         vec1.x = (vec.x + px);
142         vec1.y = (vec.y + py);
143         vec2.x = (-vec.x + px);
144         vec2.y = (-vec.y + py);
145
146         evas_map_point_coord_set(map, cmp + i * 4, (int) vec0.x + x, (int) vec0.y + y, 0);
147         evas_map_point_coord_set(map, cmp + i * 4 + 1, (int) vec1.x + x, (int) vec1.y + y, 0);
148         evas_map_point_coord_set(map, cmp + i * 4 + 2, (int) vec2.x + x, (int) vec2.y + y, 0);
149         evas_map_point_coord_set(map, cmp + i * 4 + 3, (int) vec3.x + x, (int) vec3.y + y, 0);
150
151         //UV
152         u0 = w1 + i * dist;
153         u1 = u0 + dist;
154         v0 = (double) 0;
155         v1 = (double) h;
156
157         evas_map_point_image_uv_set(map, cmp + i * 4, u0, v0);
158         evas_map_point_image_uv_set(map, cmp + i * 4 + 1, u1, v0);
159         evas_map_point_image_uv_set(map, cmp + i * 4 + 2, u1, v1);
160         evas_map_point_image_uv_set(map, cmp + i * 4 + 3, u0, v1);
161      }
162 }
163
164 static void
165 _text_on_line_draw(Efl_Ui_Textpath_Data *pd, int w1, int w2, int cmp, Evas_Map *map, Efl_Ui_Textpath_Line line)
166 {
167    double x1, x2, y1, y2;
168    Evas_Coord x, y, w, h;
169    double line_len, len, sina, cosa;
170
171    x1 = line.start.x;
172    y1 = line.start.y;
173    x2 = line.end.x;
174    y2 = line.end.y;
175
176    line_len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
177    len = w2 - w1;
178    if (line_len > len)
179      {
180         x2 = x1 + len * (x2 - x1) / line_len;
181         y2 = y1 + len * (y2 - y1) / line_len;
182      }
183
184    evas_object_geometry_get(pd->text_obj, &x, &y, &w, &h);
185
186    len = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
187    sina = (y2 - y1) / len;
188    cosa = (x2 - x1) / len;
189
190    h = h / 2;
191    evas_map_point_coord_set(map, cmp + 3, x1 - h * sina, y1 + h * cosa, 0);
192    evas_map_point_coord_set(map, cmp + 2, x2 - h * sina, y2 + h * cosa, 0);
193    evas_map_point_coord_set(map, cmp + 1, x2 + h * sina, y2 - h * cosa, 0);
194    evas_map_point_coord_set(map, cmp + 0, x1 + h * sina, y1 - h * cosa, 0);
195
196    h *= 2;
197    evas_map_point_image_uv_set(map, cmp + 0, w1, 0);
198    evas_map_point_image_uv_set(map, cmp + 1, w2, 0);
199    evas_map_point_image_uv_set(map, cmp + 2, w2, h);
200    evas_map_point_image_uv_set(map, cmp + 3, w1, h);
201 }
202
203 static int
204 _map_point_calc(Efl_Ui_Textpath_Data *pd)
205 {
206    int map_no = 0;
207    Efl_Ui_Textpath_Segment *seg;
208
209    EINA_INLIST_FOREACH(pd->segments, seg)
210      {
211         if (seg->type == EFL_GFX_PATH_COMMAND_TYPE_LINE_TO)
212           {
213              map_no++;
214           }
215         else if (seg->type == EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO)
216           {
217              int no = pd->slice_no * seg->length / (double)pd->total_length;
218              map_no += no;
219           }
220      }
221    map_no *= 4;
222
223    return map_no;
224 }
225
226 static void
227 _text_draw(Efl_Ui_Textpath_Data *pd)
228 {
229    Efl_Ui_Textpath_Segment *seg;
230    Evas_Map *map;
231    double slice_unit, slice_len;
232    int w, h, w1, w2;
233    int remained_w;
234    int total_slice, drawn_slice = 0;
235    int cur_map_point = 0, map_point_no;
236
237    evas_object_geometry_get(pd->text_obj, NULL, NULL, &w, &h);
238    if (pd->autofit)
239      remained_w = w;
240    else
241      remained_w = pd->total_length;
242    slice_unit = (double)pd->slice_no / pd->total_length;
243
244    slice_len = 1.0 / slice_unit;
245    total_slice = w / slice_len + 1;
246
247    map_point_no = _map_point_calc(pd);
248    if (map_point_no == 0)
249      {
250         ERR("no map point");
251         evas_object_map_enable_set(pd->text_obj, EINA_FALSE);
252         return;
253      }
254    map = evas_map_new(map_point_no);
255
256    w1 = w2 = 0;
257    EINA_INLIST_FOREACH(pd->segments, seg)
258      {
259         int len = seg->length;
260         if (!pd->autofit)
261           len = (double)seg->length * w / (double)pd->total_length;
262         if (remained_w <= 0)
263           break;
264         w2 = w1 + len;
265         if (w2 > w)
266           w2 = w;
267         if (seg->type == EFL_GFX_PATH_COMMAND_TYPE_LINE_TO)
268           {
269              drawn_slice += 1;
270              _text_on_line_draw(pd, w1, w2, cur_map_point, map, seg->line);
271              cur_map_point += 4;
272           }
273         else
274           {
275              int slice_no;
276              slice_no = pd->slice_no * seg->length / (double)pd->total_length;
277              if (slice_no == 0)
278                slice_no = len * slice_unit + 1;
279              if (remained_w == 0)
280                slice_no = total_slice - drawn_slice;
281              drawn_slice += slice_no;
282              _segment_draw(pd, slice_no, w1, w2, cur_map_point, map, seg->bezier);
283              cur_map_point += slice_no * 4;
284           }
285         w1 = w2;
286         remained_w -= len;
287      }
288    evas_object_map_enable_set(pd->text_obj, EINA_TRUE);
289    evas_object_map_set(pd->text_obj, map);
290    evas_map_free(map);
291 }
292
293 static void
294 _path_data_get(Eo *obj, Efl_Ui_Textpath_Data *pd, Eina_Bool set_min)
295 {
296    const Efl_Gfx_Path_Command *cmd;
297    const double *points;
298    Efl_Ui_Textpath_Segment *seg;
299
300    EINA_INLIST_FREE(pd->segments, seg)
301      {
302         pd->segments = eina_inlist_remove(pd->segments, EINA_INLIST_GET(seg));
303         free(seg);
304      }
305
306    Evas_Coord x, y;
307    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
308
309    pd->total_length = 0;
310    eo_do(obj, efl_gfx_shape_path_get(&cmd, &points));
311    if (cmd)
312      {
313         int pos = -1;
314         Eina_Rectangle *rect = eina_rectangle_new(0, 0, 0, 0);
315         double px0 = 0.0, py0 = 0.0, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, px1, py1;
316
317         while (*cmd != EFL_GFX_PATH_COMMAND_TYPE_END)
318           {
319
320              if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO)
321                {
322                   pos++;
323                   px0 = points[pos] + x;
324                   pos++;
325                   py0 = points[pos] + y;
326                }
327              else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO)
328                {
329                   Eina_Bezier bz;
330                   double bx, by, bw, bh;
331                   Eina_Rectangle *brect;
332
333                   pos++;
334                   ctrl_x0 = points[pos] + x;
335                   pos++;
336                   ctrl_y0 = points[pos] + y;
337                   pos++;
338                   ctrl_x1 = points[pos] + x;
339                   pos++;
340                   ctrl_y1 = points[pos] + y;
341                   pos++;
342                   px1 = points[pos] + x;
343                   pos++;
344                   py1 = points[pos] + y;
345
346                   eina_bezier_values_set(&bz, px0, py0, ctrl_x0, ctrl_y0, ctrl_x1, ctrl_y1, px1, py1);
347                   seg = malloc(sizeof(Efl_Ui_Textpath_Segment));
348                   if (!seg)
349                     {
350                        ERR("Failed to allocate segment");
351                        px0 = px1;
352                        py0 = py1;
353                        continue;
354                     }
355                   seg->length = eina_bezier_length_get(&bz);
356                   seg->bezier = bz;
357                   seg->type = EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO;
358                   pd->segments = eina_inlist_append(pd->segments, EINA_INLIST_GET(seg));
359                   pd->total_length += seg->length;
360
361                   //move points
362                   px0 = px1;
363                   py0 = py1;
364
365                   eina_bezier_bounds_get(&bz, &bx, &by, &bw, &bh);
366                   brect = eina_rectangle_new(bx, by, bw, bh);
367                   eina_rectangle_union(rect, brect);
368                   eina_rectangle_free(brect);
369                }
370              else if (*cmd == EFL_GFX_PATH_COMMAND_TYPE_LINE_TO)
371                {
372                   Eina_Rectangle *lrect;
373
374                   pos++;
375                   px1 = points[pos] + x;
376                   pos++;
377                   py1 = points[pos] + y;
378
379                   seg = malloc(sizeof(Efl_Ui_Textpath_Segment));
380                   if (!seg)
381                     {
382                        ERR("Failed to allocate segment");
383                        px0 = px1;
384                        py0 = py1;
385                     }
386                   seg->type = EFL_GFX_PATH_COMMAND_TYPE_LINE_TO;
387                   seg->line.start.x = px0;
388                   seg->line.start.y = py0;
389                   seg->line.end.x = px1;
390                   seg->line.end.y = py1;
391                   seg->length = sqrt((px1 - px0)*(px1 - px0) + (py1 - py0)*(py1 - py0));
392                   pd->segments = eina_inlist_append(pd->segments, EINA_INLIST_GET(seg));
393                   pd->total_length += seg->length;
394
395                   lrect = eina_rectangle_new(px0, py0, px1 - px0, py1 - py0);
396                   eina_rectangle_union(rect, lrect);
397                   eina_rectangle_free(lrect);
398                }
399              cmd++;
400           }
401         if (set_min)
402           {
403              evas_object_size_hint_min_set(obj, rect->w, rect->h);
404           }
405         eina_rectangle_free(rect);
406      }
407 }
408
409 static void
410 _sizing_eval(Efl_Ui_Textpath_Data *pd)
411 {
412    _text_draw(pd);
413 }
414
415 static void
416 _textpath_ellipsis_set(Efl_Ui_Textpath_Data *pd, Eina_Bool enabled)
417 {
418    const char *format;
419
420    edje_object_part_text_style_user_pop(pd->text_obj, "elm.text");
421    if (enabled)
422      {
423         Eina_Strbuf *buf = eina_strbuf_new();
424
425         eina_strbuf_append_printf(buf, "DEFAULT='ellipsis=1.0'");
426         format = eina_stringshare_add(eina_strbuf_string_get(buf));
427         eina_strbuf_free(buf);
428         edje_object_part_text_style_user_push(pd->text_obj, "elm.text", format);
429      }
430 }
431
432 static void
433 _ellipsis_set(Efl_Ui_Textpath_Data *pd)
434 {
435    if (!pd->text_obj) return;
436
437    Evas_Coord w = 0, h = 0;
438    Eina_Bool is_ellipsis = EINA_FALSE;
439    const Evas_Object *tb;
440
441    tb = edje_object_part_object_get(pd->text_obj, "elm.text");
442    evas_object_textblock_size_native_get(tb, &w, &h);
443    evas_object_size_hint_min_set(pd->text_obj, w, h);
444    if (pd->ellipsis)
445      {
446         if (w > pd->total_length)
447           {
448              is_ellipsis = EINA_TRUE;
449              w = pd->total_length;
450           }
451      }
452    evas_object_resize(pd->text_obj, w, h);
453    _textpath_ellipsis_set(pd, is_ellipsis);
454 }
455
456 static Eina_Bool
457 //_path_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
458 _path_changed_cb(void *data,
459                     Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED,
460                     void *event_info EINA_UNUSED)
461 {
462    EFL_UI_TEXTPATH_DATA_GET(data, sd);
463
464    _path_data_get(data, sd, EINA_TRUE);
465    _sizing_eval(sd);
466
467    return EINA_TRUE;
468 }
469
470 static Eina_Bool
471 _textpath_text_set_internal(Eo *obj, Efl_Ui_Textpath_Data *pd, const char *part EINA_UNUSED, const char *text)
472 {
473    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, EINA_FALSE);
474    Eina_Bool ret = EINA_TRUE;
475
476    if (!text) text = "";
477    //ret = edje_object_part_text_set(pd->text_obj, part, text);
478    ret = edje_object_part_text_set(pd->text_obj, "elm.text", text);
479    _ellipsis_set(pd);
480
481    return ret;
482 }
483
484 /*EOLIAN static void
485 _efl_ui_textpath_efl_canvas_group_group_calculate(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
486 {
487    _sizing_eval(pd);
488 }*/
489
490
491 EOLIAN static void
492 _efl_ui_textpath_elm_layout_sizing_eval(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
493 {
494    _sizing_eval(pd);
495 }
496
497 EOLIAN static void
498 _efl_ui_textpath_evas_object_smart_calculate(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
499 {
500     _sizing_eval(pd);
501 }
502
503 EOLIAN static void
504 //_efl_ui_textpath_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Textpath_Data *priv)
505 _efl_ui_textpath_evas_object_smart_add(Eo *obj, Efl_Ui_Textpath_Data *priv)
506 {
507    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
508
509    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
510    elm_widget_sub_object_parent_add(obj);
511
512    priv->text_obj = edje_object_add(evas_object_evas_get(obj));
513    elm_widget_theme_object_set(obj, priv->text_obj, "textpath", "base",
514                                elm_widget_style_get(obj));
515    evas_object_size_hint_weight_set(priv->text_obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
516    evas_object_size_hint_align_set(priv->text_obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
517    evas_object_show(priv->text_obj);
518
519    evas_object_smart_member_add(priv->text_obj, obj);
520    elm_widget_sub_object_add(obj, priv->text_obj);
521
522    //efl_event_callback_add(obj, EFL_GFX_PATH_EVENT_CHANGED, _path_changed_cb, obj);
523    eo_do(obj, eo_event_callback_add
524          (EFL_GFX_PATH_CHANGED, _path_changed_cb, obj));
525 }
526
527 EOLIAN static void
528 _efl_ui_textpath_class_constructor(Eo_Class *klass)
529 {
530    evas_smart_legacy_type_register(MY_CLASS_NAME_LEGACY, klass);
531 }
532
533 //EOLIAN static Efl_Object *
534 //_efl_ui_textpath_efl_object_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
535 EOLIAN static Eo*
536 _efl_ui_textpath_eo_base_constructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
537 {
538    //obj = efl_constructor(efl_super(obj, MY_CLASS));
539    obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
540    pd->autofit = EINA_TRUE;
541    pd->slice_no = SLICE_DEFAULT_NO;
542    pd->direction = EFL_UI_TEXTPATH_DIRECTION_CW;
543
544    return obj;
545 }
546
547 EOLIAN static void
548 //_efl_ui_textpath_efl_object_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
549 _efl_ui_textpath_eo_base_destructor(Eo *obj, Efl_Ui_Textpath_Data *pd)
550 {
551    Efl_Ui_Textpath_Segment *seg;
552
553    if (pd->text) free(pd->text);
554    if (pd->text_obj) evas_object_del(pd->text_obj);
555    EINA_INLIST_FREE(pd->segments, seg)
556      {
557         pd->segments = eina_inlist_remove(pd->segments, EINA_INLIST_GET(seg));
558         free(seg);
559      }
560
561    //efl_destructor(efl_super(obj, MY_CLASS));
562    eo_do_super(obj, MY_CLASS, eo_destructor());
563 }
564
565 EOLIAN static Eina_Bool
566 _efl_ui_textpath_elm_layout_text_set(Eo *obj, Efl_Ui_Textpath_Data *pd, const char *part, const char *text)
567 {
568    return _textpath_text_set_internal(obj, pd, part, text);
569 }
570
571 EOLIAN static const char *
572 _efl_ui_textpath_elm_layout_text_get(const Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd, const char *part)
573 {
574    return edje_object_part_text_get(pd->text_obj, part);
575 }
576
577 /*
578 EOLIAN static Eina_Bool
579 _efl_ui_textpath_text_set(Eo *obj, Efl_Ui_Textpath_Data *pd, const char *part, const char *text)
580 {
581    return _textpath_text_set_internal(obj, pd, part, text);
582 }
583
584 EOLIAN static const char *
585 _efl_ui_textpath_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd, const char *part)
586 {
587    return edje_object_part_text_get(pd->text_obj, part);
588 }
589
590 EOLIAN static void
591 _efl_ui_textpath_efl_text_text_set(Eo *obj, Efl_Ui_Textpath_Data *pd, const char *text)
592 {
593    _textpath_text_set_internal(obj, pd, "elm.text", text);
594 }
595
596 EOLIAN static const char *
597 _efl_ui_textpath_efl_text_text_get(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
598 {
599    return edje_object_part_text_get(pd->text_obj, "elm.text");
600 }*/
601
602 //EOLIAN static Efl_Ui_Theme_Apply
603 EOLIAN static Elm_Theme_Apply
604 _efl_ui_textpath_elm_widget_theme_apply(Eo *obj, Efl_Ui_Textpath_Data *pd)
605 {
606    Elm_Theme_Apply ret = ELM_THEME_APPLY_FAILED;
607
608    eo_do_super(obj, MY_CLASS, ret = elm_obj_widget_theme_apply());
609    if (!ret) return ELM_THEME_APPLY_FAILED;
610
611    elm_widget_theme_object_set(obj, pd->text_obj, "textpath", "base",
612                                elm_widget_style_get(obj));
613    _ellipsis_set(pd);
614
615    return ret;
616 }
617
618
619 EOLIAN static void
620 //_efl_ui_textpath_evas_object_position_set(Eo *obj, Efl_Ui_Textpath_Data *pd, Evas_Coord x, Evas_Coord y)
621 _efl_ui_textpath_evas_object_smart_move(Eo *obj, Efl_Ui_Textpath_Data *pd, Evas_Coord x, Evas_Coord y)
622 {
623    eo_do_super(obj, MY_CLASS, evas_obj_smart_move(x, y));
624    _path_data_get(obj, pd, EINA_FALSE);
625    _text_draw(pd);
626 }
627
628 /*
629 EOLIAN static void
630 _efl_ui_textpath_evas_object_resize(Eo *obj, Efl_Ui_Textpath_Data *pd EINA_UNUSED, Evas_Coord w, Evas_Coord h)
631 {
632    eo_do_super(obj, MY_CLASS, evas_object_resize(w, h));
633 }*/
634
635 EOLIAN static void
636 _efl_ui_textpath_circle_set(Eo *obj, Efl_Ui_Textpath_Data *pd, double x, double y, double radius, double start_angle, Efl_Ui_Textpath_Direction direction)
637 {
638    if (pd->circle.x == x && pd->circle.y == y &&
639        pd->circle.radius == radius &&
640        pd->circle.start_angle == start_angle &&
641        pd->direction == direction &&
642        _map_point_calc(pd) > 0)
643      {
644         ERR("Same circle");
645         return;
646      }
647    pd->circle.x = x;
648    pd->circle.y = y;
649    pd->circle.radius = radius;
650    pd->circle.start_angle = start_angle;
651    pd->direction = direction;
652
653    eo_do(obj, efl_gfx_shape_reset());
654    if (direction == EFL_UI_TEXTPATH_DIRECTION_CW)
655      {
656         eo_do(obj, efl_gfx_shape_append_arc(x - radius, y - radius, radius * 2,
657                                 radius * 2,  start_angle, -360));
658      }
659    else
660      {
661         eo_do(obj, efl_gfx_shape_append_arc(x - radius, y - radius, radius * 2,
662                                 radius * 2,  start_angle, 360));
663      }
664
665    _sizing_eval(pd);
666 }
667
668 EOLIAN static Eina_Bool
669 _efl_ui_textpath_autofit_get(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
670 {
671    return pd->autofit;
672 }
673
674 EOLIAN static void
675 _efl_ui_textpath_autofit_set(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd, Eina_Bool autofit)
676 {
677    if (pd->autofit == autofit) return;
678    pd->autofit = autofit;
679    _sizing_eval(pd);
680 }
681
682 EOLIAN static int
683 _efl_ui_textpath_slice_number_get(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
684 {
685    return pd->slice_no;
686 }
687
688 EOLIAN static void
689 _efl_ui_textpath_slice_number_set(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd, int slice_no)
690 {
691    if (pd->slice_no == slice_no) return;
692    pd->slice_no = slice_no;
693    _sizing_eval(pd);
694 }
695
696 EOLIAN static void
697 _efl_ui_textpath_ellipsis_set(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd, Eina_Bool ellipsis)
698 {
699    if (pd->ellipsis == ellipsis) return;
700    pd->ellipsis = ellipsis;
701
702    _ellipsis_set(pd);
703    _sizing_eval(pd);
704 }
705
706 EOLIAN static Eina_Bool
707 _efl_ui_textpath_ellipsis_get(Eo *obj EINA_UNUSED, Efl_Ui_Textpath_Data *pd)
708 {
709    return pd->ellipsis;
710 }
711
712 /* Efl.Part begin */
713 //ELM_PART_OVERRIDE(efl_ui_textpath, EFL_UI_TEXTPATH, EFL_UI_LAYOUT, Efl_Ui_Textpath_Data, Elm_Part_Data)
714 //ELM_PART_OVERRIDE_TEXT_SET(efl_ui_textpath, EFL_UI_TEXTPATH, EFL_UI_LAYOUT, Efl_Ui_Textpath_Data, Elm_Part_Data)
715 //ELM_PART_OVERRIDE_TEXT_GET(efl_ui_textpath, EFL_UI_TEXTPATH, EFL_UI_LAYOUT, Efl_Ui_Textpath_Data, Elm_Part_Data)
716 //#include "efl_ui_textpath_internal_part.eo.c"
717 /* Efl.Part end */
718
719 EAPI Evas_Object *
720 elm_textpath_add(Evas_Object *parent)
721 {
722    EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
723    Evas_Object *obj = eo_add(MY_CLASS, parent);
724
725    return obj;
726 }
727
728 #define EFL_UI_TEXTPATH_EXTRA_OPS \
729       EFL_CANVAS_GROUP_ADD_OPS(efl_ui_textpath)
730
731 #include "efl_ui_textpath.eo.c"