summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2018-11-06 16:52:53 +0200
committerDaniel Hirt <hirt.danny@gmail.com>2018-11-06 18:33:56 +0200
commitface90632e7796c146b18e31a93c164cbda43122 (patch)
tree9f562a695f47b8ffd639a9a71e4baed1bd757bc0 /src/lib/edje
parent6285cfe366e7f60b862f19981062bdd2afe08c7c (diff)
Canvas layout: support more Efl.Text.* with efl_part
This adds many Efl.Text.* that are useful for manipulating the underlying TEXTBLOCK object's propeties using efl_part. This has been implemented as part of the "user-defined" properties of the layout part, so that the changes on the part persist across load of different groups. Note that text styles have precedence over the TEXTBLOCK (Canvas.Text) object's properties. if an edc provides a style, the properties it manipulates as part of the "base:" string would not be affected by this API. In general, this helps reducing the amount of styles for objects (or modes of the same objects) that share the same setup, but are different in some properties (e.g. ellipsis, wrap etc). @feature Canvas layout: add text part "expand" property This adds "expansion modes", which are essentially the same as min/max hints in the edje part's 'description.text' fields. The user can then customize his widget to different modes without being forced to create a new edje group in the theme. Note that there is an added check in case one of the min/max text flags are provided from the theme. In such case, all flags from this new API will be ignored. This fortifies misuse where the flags are set both in theme and the API. @feature
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_load.c24
-rw-r--r--src/lib/edje/edje_part_text.c528
-rw-r--r--src/lib/edje/edje_private.h70
-rw-r--r--src/lib/edje/edje_textblock.c83
-rw-r--r--src/lib/edje/edje_util.c75
-rw-r--r--src/lib/edje/efl_canvas_layout_part_text.eo50
6 files changed, 803 insertions, 27 deletions
diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c
index c974342fc7..6d865d4408 100644
--- a/src/lib/edje/edje_load.c
+++ b/src/lib/edje/edje_load.c
@@ -1645,6 +1645,25 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch
1645 } 1645 }
1646 eina_stringshare_del(eud->u.string.text); 1646 eina_stringshare_del(eud->u.string.text);
1647 break; 1647 break;
1648
1649 case EDJE_USER_TEXT_STYLE:
1650 {
1651 Edje_Part_Text_Prop *prop;
1652 EINA_LIST_FREE(eud->u.text_style.props, prop)
1653 {
1654 _canvas_layout_user_text_apply(eud, obj,
1655 prop);
1656 free(prop);
1657 }
1658 }
1659 break;
1660 case EDJE_USER_TEXT_EXPAND:
1661 {
1662 efl_canvas_layout_part_text_expand_set(
1663 efl_part(obj, eud->part),
1664 eud->u.text_expand.expand);
1665 }
1666 break;
1648 } 1667 }
1649 if (eud) _edje_user_definition_remove(eud, child); 1668 if (eud) _edje_user_definition_remove(eud, child);
1650 } 1669 }
@@ -1840,10 +1859,15 @@ _edje_object_collect(Edje *ed)
1840 edje_object_part_unswallow(NULL, eud->u.swallow.child); 1859 edje_object_part_unswallow(NULL, eud->u.swallow.child);
1841 break; 1860 break;
1842 1861
1862 case EDJE_USER_TEXT_STYLE:
1863 _canvas_layout_user_text_collect(ed, eud);
1864 break;
1865
1843 case EDJE_USER_DRAG_STEP: 1866 case EDJE_USER_DRAG_STEP:
1844 case EDJE_USER_DRAG_PAGE: 1867 case EDJE_USER_DRAG_PAGE:
1845 case EDJE_USER_DRAG_VALUE: 1868 case EDJE_USER_DRAG_VALUE:
1846 case EDJE_USER_DRAG_SIZE: 1869 case EDJE_USER_DRAG_SIZE:
1870 case EDJE_USER_TEXT_EXPAND:
1847 break; 1871 break;
1848 } 1872 }
1849 } 1873 }
diff --git a/src/lib/edje/edje_part_text.c b/src/lib/edje/edje_part_text.c
index 6e8e231ae2..31678a3697 100644
--- a/src/lib/edje/edje_part_text.c
+++ b/src/lib/edje/edje_part_text.c
@@ -197,5 +197,533 @@ _efl_canvas_layout_part_text_efl_text_markup_cursor_markup_insert(Eo *obj,
197 // FIXME: entry should report the length of inserted text (after filtering) 197 // FIXME: entry should report the length of inserted text (after filtering)
198} 198}
199 199
200/* More Efl.Text.* API (@since 1.22) */
201
202EOLIAN static void
203_efl_canvas_layout_part_text_efl_text_style_backing_type_set(Eo *obj,
204 void *_pd EINA_UNUSED,
205 Efl_Text_Style_Backing_Type type)
206{
207 Edje_User_Defined *eud;
208
209 PROXY_DATA_GET(obj, pd);
210 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
211
212 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
213
214 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_NONE;
215 efl_text_backing_type_set(pd->rp->object, type);
216}
217
218EOLIAN static Efl_Text_Style_Backing_Type
219_efl_canvas_layout_part_text_efl_text_style_backing_type_get(const Eo *obj,
220 void *_pd EINA_UNUSED)
221{
222
223 PROXY_DATA_GET(obj, pd);
224 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT)
225 return EFL_TEXT_STYLE_BACKING_TYPE_DISABLED;
226
227 return efl_text_backing_type_get(pd->rp->object);
228}
229
230#define TEXT_COLOR_IMPL(x, X) \
231EOLIAN static void \
232_efl_canvas_layout_part_text_efl_text_style_ ##x ##_color_set(Eo *obj, \
233 void *_pd EINA_UNUSED, \
234 unsigned char r, unsigned char g, unsigned char b, unsigned char a) \
235{ \
236 Edje_User_Defined *eud; \
237 \
238 PROXY_DATA_GET(obj, pd); \
239 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return; \
240 \
241 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part); \
242 \
243 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_COLOR_ ##X; \
244 efl_text_ ##x ##_color_set(pd->rp->object, r, g, b, a); \
245} \
246\
247EOLIAN static void \
248_efl_canvas_layout_part_text_efl_text_style_ ##x ##_color_get(const Eo *obj, \
249 void *_pd EINA_UNUSED, \
250 unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a) \
251{ \
252 PROXY_DATA_GET(obj, pd); \
253 *r = *g = *b = *a = 0; \
254 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return; \
255 efl_text_ ##x ##_color_get(pd->rp->object, r, g, b, a); \
256}
257
258TEXT_COLOR_IMPL(backing, BACKING)
259TEXT_COLOR_IMPL(glow, GLOW)
260TEXT_COLOR_IMPL(glow2, GLOW2)
261TEXT_COLOR_IMPL(normal, NORMAL)
262TEXT_COLOR_IMPL(outline, OUTLINE)
263TEXT_COLOR_IMPL(shadow, SHADOW)
264TEXT_COLOR_IMPL(strikethrough, STRIKETHROUGH)
265TEXT_COLOR_IMPL(underline, UNDERLINE)
266TEXT_COLOR_IMPL(underline2, UNDERLINE2)
267TEXT_COLOR_IMPL(underline_dashed, UNDERLINE_DASHED)
268
269EOLIAN static void
270_efl_canvas_layout_part_text_efl_text_style_effect_type_set(Eo *obj,
271 void *_pd EINA_UNUSED,
272 Efl_Text_Style_Effect_Type type)
273{
274 Edje_User_Defined *eud;
275
276 PROXY_DATA_GET(obj, pd);
277 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
278
279 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
280
281 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_EFFECT_TYPE;
282 efl_text_effect_type_set(pd->rp->object, type);
283}
284
285EOLIAN static void
286_efl_canvas_layout_part_text_efl_text_format_ellipsis_set(Eo *obj,
287 void *_pd EINA_UNUSED, double value)
288{
289 Edje_User_Defined *eud;
290
291 PROXY_DATA_GET(obj, pd);
292 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
293
294 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
295
296 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_ELLIPSIS;
297 efl_text_ellipsis_set(pd->rp->object, value);
298}
299
300EOLIAN static double
301_efl_canvas_layout_part_text_efl_text_format_ellipsis_get(const Eo *obj,
302 void *_pd EINA_UNUSED)
303{
304 PROXY_DATA_GET(obj, pd);
305 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return 0.0;
306
307 return efl_text_ellipsis_get(pd->rp->object);
308}
309
310EOLIAN static void
311_efl_canvas_layout_part_text_efl_text_font_font_set(Eo *obj,
312 void *_pd EINA_UNUSED, const char *font, Efl_Font_Size size)
313{
314 Edje_User_Defined *eud;
315
316 PROXY_DATA_GET(obj, pd);
317 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
318
319
320 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
321
322 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_FONT;
323 efl_text_font_set(pd->rp->object, font, size);
324}
325
326EOLIAN static void
327_efl_canvas_layout_part_text_efl_text_font_font_get(const Eo *obj,
328 void *_pd EINA_UNUSED, const char **font, Efl_Font_Size *size)
329{
330 PROXY_DATA_GET(obj, pd);
331 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
332
333 efl_text_font_get(pd->rp->object, font, size);
334}
335
336EOLIAN static void
337_efl_canvas_layout_part_text_efl_text_style_shadow_direction_set(Eo *obj,
338 void *_pd EINA_UNUSED,
339 Efl_Text_Style_Shadow_Direction type)
340{
341 Edje_User_Defined *eud;
342
343 PROXY_DATA_GET(obj, pd);
344 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
345
346 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
347
348 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_SHADOW_DIRECTION;
349 efl_text_shadow_direction_set(pd->rp->object, type);
350}
351
352EOLIAN static void
353_efl_canvas_layout_part_text_efl_text_style_strikethrough_type_set(Eo *obj,
354 void *_pd EINA_UNUSED,
355 Efl_Text_Style_Strikethrough_Type type)
356{
357 Edje_User_Defined *eud;
358
359 PROXY_DATA_GET(obj, pd);
360 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
361
362 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
363
364 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_STRIKETHROUGH_TYPE;
365 efl_text_strikethrough_type_set(pd->rp->object, type);
366}
367
368EOLIAN static void
369_efl_canvas_layout_part_text_efl_text_style_underline_type_set(Eo *obj,
370 void *_pd EINA_UNUSED,
371 Efl_Text_Style_Underline_Type type)
372{
373 Edje_User_Defined *eud;
374
375 PROXY_DATA_GET(obj, pd);
376 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
377
378
379 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
380
381 eud->u.text_style.types = EDJE_PART_TEXT_PROP_UNDERLINE_TYPE;
382 efl_text_underline_type_set(pd->rp->object, type);
383}
384
385EOLIAN static void
386_efl_canvas_layout_part_text_efl_text_style_underline_height_set(Eo *obj,
387 void *_pd EINA_UNUSED,
388 double value)
389{
390 Edje_User_Defined *eud;
391
392 PROXY_DATA_GET(obj, pd);
393 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
394
395 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
396
397 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_UNDERLINE_HEIGHT;
398 efl_text_underline_height_set(pd->rp->object, value);
399}
400
401EOLIAN static void
402_efl_canvas_layout_part_text_efl_text_style_underline_dashed_width_set(Eo *obj,
403 void *_pd EINA_UNUSED,
404 int value)
405{
406 Edje_User_Defined *eud;
407
408 PROXY_DATA_GET(obj, pd);
409 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
410
411 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
412
413 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_WIDTH;
414 efl_text_underline_dashed_width_set(pd->rp->object, value);
415}
416
417EOLIAN static void
418_efl_canvas_layout_part_text_efl_text_style_underline_dashed_gap_set(Eo *obj,
419 void *_pd EINA_UNUSED,
420 int value)
421{
422 Edje_User_Defined *eud;
423
424 PROXY_DATA_GET(obj, pd);
425 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
426
427 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
428
429 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_GAP;
430 efl_text_underline_dashed_gap_set(pd->rp->object, value);
431}
432
433EOLIAN static void
434_efl_canvas_layout_part_text_efl_text_format_wrap_set(Eo *obj,
435 void *_pd EINA_UNUSED, Efl_Text_Format_Wrap wrap)
436{
437 Edje_User_Defined *eud;
438
439 PROXY_DATA_GET(obj, pd);
440 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
441
442 eud = _edje_user_text_style_definition_fetch(pd->ed, pd->part);
443
444 eud->u.text_style.types |= EDJE_PART_TEXT_PROP_WRAP;
445 efl_text_wrap_set(pd->rp->object, wrap);
446}
447
448EOLIAN static Efl_Text_Format_Wrap
449_efl_canvas_layout_part_text_efl_text_format_wrap_get(const Eo *obj,
450 void *_pd EINA_UNUSED)
451{
452 PROXY_DATA_GET(obj, pd);
453
454 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT)
455 return EFL_TEXT_FORMAT_WRAP_NONE;
456
457 return efl_text_wrap_get(pd->rp->object);
458}
459
460static Edje_Part_Text_Prop *
461_prop_new(Eina_List **props, Edje_Part_Text_Prop_Type type)
462{
463 Edje_Part_Text_Prop *prop;
464
465 prop = malloc(sizeof(*prop));
466 prop->type = type;
467
468 *props = eina_list_append(*props, prop);
469
470 return prop;
471}
472
473void
474_canvas_layout_user_text_collect(Edje *ed, Edje_User_Defined *eud)
475{
476 Edje_Real_Part *rp;
477 Eina_List **props = &eud->u.text_style.props;
478
479 rp = _edje_real_part_recursive_get(&ed, eud->part);
480 if (eud->u.text_style.types == EDJE_PART_TEXT_PROP_NONE) return;
481
482 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_BACKING_TYPE)
483 {
484 Edje_Part_Text_Prop *prop;
485
486 prop = _prop_new(props, EDJE_PART_TEXT_PROP_BACKING_TYPE);
487 prop->val.backing = efl_text_backing_type_get(rp->object);
488 }
489#define STYLE_COLOR_COLLECT(x, X) \
490 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_COLOR_ ##X) \
491 { \
492 Edje_Part_Text_Prop *prop; \
493 prop = _prop_new(props, EDJE_PART_TEXT_PROP_COLOR_ ##X); \
494 efl_text_ ##x ##_color_get(rp->object, \
495 &prop->val.color.r, &prop->val.color.g, \
496 &prop->val.color.b, &prop->val.color.a); \
497 } \
498
499 STYLE_COLOR_COLLECT(backing, BACKING)
500 STYLE_COLOR_COLLECT(glow, GLOW)
501 STYLE_COLOR_COLLECT(glow2, GLOW2)
502 STYLE_COLOR_COLLECT(normal, NORMAL)
503 STYLE_COLOR_COLLECT(outline, OUTLINE)
504 STYLE_COLOR_COLLECT(shadow, SHADOW)
505 STYLE_COLOR_COLLECT(strikethrough, STRIKETHROUGH)
506 STYLE_COLOR_COLLECT(underline, UNDERLINE)
507 STYLE_COLOR_COLLECT(underline2, UNDERLINE2)
508 STYLE_COLOR_COLLECT(underline_dashed, UNDERLINE_DASHED)
509#undef STYLE_COLOR_COLLECT
510
511 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_EFFECT_TYPE)
512 {
513 Edje_Part_Text_Prop *prop;
514
515 prop = _prop_new(props, EDJE_PART_TEXT_PROP_EFFECT_TYPE);
516 prop->val.effect = efl_text_effect_type_get(rp->object);
517 }
518
519 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_ELLIPSIS)
520 {
521 Edje_Part_Text_Prop *prop;
522
523 prop = _prop_new(props, EDJE_PART_TEXT_PROP_ELLIPSIS);
524 prop->val.nd = efl_text_ellipsis_get(rp->object);
525 }
526
527 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_FONT)
528 {
529 Edje_Part_Text_Prop *prop;
530
531 prop = _prop_new(props, EDJE_PART_TEXT_PROP_FONT);
532 efl_text_font_get(rp->object, &prop->val.font.font,
533 &prop->val.font.size);
534 }
535
536 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_SHADOW_DIRECTION)
537 {
538 Edje_Part_Text_Prop *prop;
539
540 prop = _prop_new(props, EDJE_PART_TEXT_PROP_SHADOW_DIRECTION);
541 prop->val.shadow = efl_text_shadow_direction_get(rp->object);
542 }
543
544 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_STRIKETHROUGH_TYPE)
545 {
546 Edje_Part_Text_Prop *prop;
547
548 prop = _prop_new(props, EDJE_PART_TEXT_PROP_STRIKETHROUGH_TYPE);
549 prop->val.strikethrough_type = efl_text_strikethrough_type_get(rp->object);
550 }
551
552 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_GAP)
553 {
554 Edje_Part_Text_Prop *prop;
555
556 prop = _prop_new(props, EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_GAP);
557 prop->val.ni = efl_text_underline_dashed_gap_get(rp->object);
558 }
559
560 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_WIDTH)
561 {
562 Edje_Part_Text_Prop *prop;
563
564 prop = _prop_new(props, EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_WIDTH);
565 prop->val.ni = efl_text_underline_dashed_width_get(rp->object);
566 }
567
568 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_UNDERLINE_TYPE)
569 {
570 Edje_Part_Text_Prop *prop;
571
572 prop = _prop_new(props, EDJE_PART_TEXT_PROP_UNDERLINE_TYPE);
573 prop->val.ni = efl_text_underline_type_get(rp->object);
574 }
575
576 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_UNDERLINE_HEIGHT)
577 {
578 Edje_Part_Text_Prop *prop;
579
580 prop = _prop_new(props, EDJE_PART_TEXT_PROP_UNDERLINE_HEIGHT);
581 prop->val.ni = efl_text_underline_height_get(rp->object);
582 }
583
584 if (eud->u.text_style.types & EDJE_PART_TEXT_PROP_WRAP)
585 {
586 Edje_Part_Text_Prop *prop;
587
588 prop = _prop_new(props, EDJE_PART_TEXT_PROP_WRAP);
589 prop->val.wrap = efl_text_wrap_get(rp->object);
590
591 }
592}
593
594void
595_canvas_layout_user_text_apply(Edje_User_Defined *eud, Eo *obj,
596 Edje_Part_Text_Prop *prop)
597{
598 switch (prop->type)
599 {
600
601 case EDJE_PART_TEXT_PROP_BACKING_TYPE:
602 efl_text_backing_type_set(
603 efl_part(obj,
604 eud->part),
605 prop->val.backing);
606 break;
607
608#define STYLE_COLOR_CASE(x, X) \
609 case EDJE_PART_TEXT_PROP_COLOR_##X : \
610 efl_text_##x ##_color_set(efl_part(obj, \
611 eud->part), \
612 prop->val.color.r, \
613 prop->val.color.g, \
614 prop->val.color.b, \
615 prop->val.color.a); \
616 break;
617
618 STYLE_COLOR_CASE(backing, BACKING)
619 STYLE_COLOR_CASE(glow, GLOW)
620 STYLE_COLOR_CASE(glow2, GLOW2)
621 STYLE_COLOR_CASE(normal, NORMAL)
622 STYLE_COLOR_CASE(outline, OUTLINE)
623 STYLE_COLOR_CASE(shadow, SHADOW)
624 STYLE_COLOR_CASE(strikethrough, STRIKETHROUGH)
625 STYLE_COLOR_CASE(underline, UNDERLINE)
626 STYLE_COLOR_CASE(underline2, UNDERLINE2)
627 STYLE_COLOR_CASE(underline_dashed, UNDERLINE_DASHED)
628#undef STYLE_COLOR_CASE
629
630 case EDJE_PART_TEXT_PROP_EFFECT_TYPE:
631 efl_text_effect_type_set(
632 efl_part(obj,
633 eud->part),
634 prop->val.effect);
635 break;
636
637 case EDJE_PART_TEXT_PROP_ELLIPSIS:
638 efl_text_ellipsis_set(efl_part(obj,
639 eud->part),
640 prop->val.nd);
641 break;
642
643 case EDJE_PART_TEXT_PROP_FONT:
644 efl_text_font_set(efl_part(obj,
645 eud->part),
646 prop->val.font.font,
647 prop->val.font.size);
648 break;
649
650 case EDJE_PART_TEXT_PROP_SHADOW_DIRECTION:
651 efl_text_shadow_direction_set(
652 efl_part(obj,
653 eud->part),
654 prop->val.shadow);
655 break;
656
657 case EDJE_PART_TEXT_PROP_STRIKETHROUGH_TYPE:
658 efl_text_strikethrough_type_set(
659 efl_part(obj,
660 eud->part),
661 prop->val.strikethrough_type);
662 break;
663
664 case EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_WIDTH:
665 efl_text_underline_dashed_width_set(
666 efl_part(obj,
667 eud->part),
668 prop->val.ni);
669 break;
670
671 case EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_GAP:
672 efl_text_underline_dashed_gap_set(
673 efl_part(obj,
674 eud->part),
675 prop->val.ni);
676 break;
677
678 case EDJE_PART_TEXT_PROP_UNDERLINE_TYPE:
679 efl_text_underline_type_set(
680 efl_part(obj,
681 eud->part),
682 prop->val.underline_type);
683 break;
684
685 case EDJE_PART_TEXT_PROP_UNDERLINE_HEIGHT:
686 efl_text_underline_height_set(
687 efl_part(obj,
688 eud->part),
689 prop->val.nd);
690 break;
691
692 case EDJE_PART_TEXT_PROP_WRAP:
693 efl_text_wrap_set(efl_part(obj,
694 eud->part),
695 prop->val.wrap);
696 break;
697
698 default:
699 break;
700 }
701}
702
703
704EOLIAN static void
705_efl_canvas_layout_part_text_text_expand_set(Eo *obj,
706 void *_pd EINA_UNUSED,
707 Efl_Canvas_Layout_Part_Text_Expand type)
708{
709 Edje_User_Defined *eud;
710
711 PROXY_DATA_GET(obj, pd);
712 if (pd->rp->part->type == EDJE_PART_TYPE_TEXT) return;
713
714 eud = _edje_user_text_expand_definition_fetch(pd->ed, pd->part);
715 eud->u.text_expand.expand = type;
716 pd->rp->typedata.text->expand = type;
717
718}
719
720EOLIAN static Efl_Canvas_Layout_Part_Text_Expand
721_efl_canvas_layout_part_text_text_expand_get(const Eo *obj,
722 void *_pd EINA_UNUSED)
723{
724 PROXY_DATA_GET(obj, pd);
725 return pd->rp->typedata.text->expand;
726}
727
200#include "efl_canvas_layout_part_text.eo.c" 728#include "efl_canvas_layout_part_text.eo.c"
201 729
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 8429175a97..6b95b8dc1b 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1974,6 +1974,7 @@ struct _Edje_Real_Part_Text
1974 const char *style; // 4 1974 const char *style; // 4
1975 Edje_Position offset; // 8 1975 Edje_Position offset; // 8
1976 short size; // 2 1976 short size; // 2
1977 Efl_Canvas_Layout_Part_Text_Expand expand;
1977 struct { 1978 struct {
1978 unsigned char fit_x, fit_y; // 2 1979 unsigned char fit_x, fit_y; // 2
1979 short in_size; // 2 1980 short in_size; // 2
@@ -2252,6 +2253,58 @@ struct _Edje_Patterns
2252 unsigned int finals[]; 2253 unsigned int finals[];
2253}; 2254};
2254 2255
2256typedef enum
2257{
2258 EDJE_PART_TEXT_PROP_NONE = 0, // never used
2259 EDJE_PART_TEXT_PROP_BACKING_TYPE = 1,
2260 EDJE_PART_TEXT_PROP_COLOR_BACKING = 1 << 2,
2261 EDJE_PART_TEXT_PROP_COLOR_GLOW = 1 << 3,
2262 EDJE_PART_TEXT_PROP_COLOR_GLOW2 = 1 << 4,
2263 EDJE_PART_TEXT_PROP_COLOR_NORMAL = 1 << 5,
2264 EDJE_PART_TEXT_PROP_COLOR_OUTLINE = 1 << 6,
2265 EDJE_PART_TEXT_PROP_COLOR_SHADOW = 1 << 7,
2266 EDJE_PART_TEXT_PROP_COLOR_STRIKETHROUGH = 1 << 8,
2267 EDJE_PART_TEXT_PROP_COLOR_UNDERLINE = 1 << 9,
2268 EDJE_PART_TEXT_PROP_COLOR_UNDERLINE2 = 1 << 10,
2269 EDJE_PART_TEXT_PROP_COLOR_UNDERLINE_DASHED = 1 << 11,
2270 EDJE_PART_TEXT_PROP_EFFECT_TYPE = 1 << 12,
2271 EDJE_PART_TEXT_PROP_ELLIPSIS = 1 << 13,
2272 EDJE_PART_TEXT_PROP_FONT = 1 << 14,
2273 EDJE_PART_TEXT_PROP_SHADOW_DIRECTION = 1 << 15,
2274 EDJE_PART_TEXT_PROP_STRIKETHROUGH_TYPE = 1 << 16,
2275 EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_GAP = 1 << 17,
2276 EDJE_PART_TEXT_PROP_UNDERLINE_DASHED_WIDTH = 1 << 18,
2277 EDJE_PART_TEXT_PROP_UNDERLINE_TYPE = 1 << 19,
2278 EDJE_PART_TEXT_PROP_UNDERLINE_HEIGHT = 1 << 20,
2279 EDJE_PART_TEXT_PROP_WRAP = 1 << 21
2280} Edje_Part_Text_Prop_Type;
2281
2282typedef struct
2283{
2284 Edje_Part_Text_Prop_Type type;
2285 union
2286 {
2287 int ni; // number integer
2288 int nd; // number double
2289 Efl_Text_Format_Wrap wrap;
2290 Efl_Text_Style_Backing_Type backing;
2291 Efl_Text_Style_Underline_Type underline;
2292 struct
2293 {
2294 unsigned char r, g, b, a;
2295 } color;
2296 struct
2297 {
2298 const char *font;
2299 Efl_Font_Size size;
2300 } font;
2301 Efl_Text_Style_Effect_Type effect;
2302 Efl_Text_Style_Shadow_Direction shadow;
2303 Efl_Text_Style_Strikethrough_Type strikethrough_type;
2304 Efl_Text_Style_Underline_Type underline_type;
2305 } val;
2306} Edje_Part_Text_Prop;
2307
2255typedef enum _Edje_User_Defined_Type 2308typedef enum _Edje_User_Defined_Type
2256{ 2309{
2257 EDJE_USER_SWALLOW, 2310 EDJE_USER_SWALLOW,
@@ -2261,7 +2314,9 @@ typedef enum _Edje_User_Defined_Type
2261 EDJE_USER_DRAG_STEP, 2314 EDJE_USER_DRAG_STEP,
2262 EDJE_USER_DRAG_PAGE, 2315 EDJE_USER_DRAG_PAGE,
2263 EDJE_USER_DRAG_VALUE, 2316 EDJE_USER_DRAG_VALUE,
2264 EDJE_USER_DRAG_SIZE 2317 EDJE_USER_DRAG_SIZE,
2318 EDJE_USER_TEXT_STYLE,
2319 EDJE_USER_TEXT_EXPAND,
2265} Edje_User_Defined_Type; 2320} Edje_User_Defined_Type;
2266 2321
2267typedef struct _Edje_User_Defined Edje_User_Defined; 2322typedef struct _Edje_User_Defined Edje_User_Defined;
@@ -2296,6 +2351,13 @@ struct _Edje_User_Defined
2296 struct { 2351 struct {
2297 double w, h; 2352 double w, h;
2298 } drag_size; 2353 } drag_size;
2354 struct {
2355 Eina_List *props;
2356 Edje_Part_Text_Prop_Type types;
2357 } text_style;
2358 struct {
2359 Efl_Canvas_Layout_Part_Text_Expand expand;
2360 } text_expand;
2299 } u; 2361 } u;
2300}; 2362};
2301 2363
@@ -2968,9 +3030,15 @@ Eina_Bool _edje_multisense_internal_vibration_sample_play(Edje *ed, const char *
2968 3030
2969void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state); 3031void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *state);
2970 3032
3033Edje_User_Defined * _edje_user_definition_fetch(Edje *ed, const char *part, Edje_User_Defined_Type type);
3034Edje_User_Defined * _edje_user_text_style_definition_fetch(Edje *ed, const char *part);
3035Edje_User_Defined * _edje_user_text_expand_definition_fetch(Edje *ed, const char *part);
2971void _edje_user_definition_remove(Edje_User_Defined *eud, Evas_Object *child); 3036void _edje_user_definition_remove(Edje_User_Defined *eud, Evas_Object *child);
2972void _edje_user_definition_free(Edje_User_Defined *eud); 3037void _edje_user_definition_free(Edje_User_Defined *eud);
2973 3038
3039void _canvas_layout_user_text_apply(Edje_User_Defined *eud, Eo *obj, Edje_Part_Text_Prop *prop);
3040void _canvas_layout_user_text_collect(Edje *ed, Edje_User_Defined *eud);
3041
2974extern Efl_Observable *_edje_color_class_member; 3042extern Efl_Observable *_edje_color_class_member;
2975extern Efl_Observable *_edje_text_class_member; 3043extern Efl_Observable *_edje_text_class_member;
2976extern Efl_Observable *_edje_size_class_member; 3044extern Efl_Observable *_edje_size_class_member;
diff --git a/src/lib/edje/edje_textblock.c b/src/lib/edje/edje_textblock.c
index 6786b0d91a..add799f954 100644
--- a/src/lib/edje/edje_textblock.c
+++ b/src/lib/edje/edje_textblock.c
@@ -35,14 +35,30 @@ _edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
35 int *maxw, int *maxh) 35 int *maxw, int *maxh)
36{ 36{
37 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b; 37 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
38 unsigned char minx2 = 0, miny2 = 0, maxx2 = 0, maxy2 = 0;
39
40 minx2 = chosen_desc->text.min_x;
41 miny2 = chosen_desc->text.min_y;
42 maxx2 = chosen_desc->text.max_x;
43 maxy2 = chosen_desc->text.max_y;
44
45 // Do not use size from new api if min/max are non-zero in the theme
46 if (!chosen_desc->text.min_x && !chosen_desc->text.min_y &&
47 !chosen_desc->text.max_x && !chosen_desc->text.max_y)
48 {
49 minx2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_X;
50 miny2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_Y;
51 maxx2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_X;
52 maxy2 = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_Y;
53 }
38 54
39 /* Legacy code for Textblock min/max calculation */ 55 /* Legacy code for Textblock min/max calculation */
40 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y)) 56 if (minx2 || miny2)
41 { 57 {
42 int mw = 0, mh = 0; 58 int mw = 0, mh = 0;
43 59
44 tw = th = 0; 60 tw = th = 0;
45 if (!chosen_desc->text.min_x) 61 if (!minx2)
46 { 62 {
47 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h))); 63 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h)));
48 efl_canvas_text_size_formatted_get(ep->object, &tw, &th); 64 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
@@ -53,22 +69,22 @@ _edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
53 &ins_r, &ins_t, &ins_b); 69 &ins_r, &ins_t, &ins_b);
54 mw = ins_l + tw + ins_r; 70 mw = ins_l + tw + ins_r;
55 mh = ins_t + th + ins_b; 71 mh = ins_t + th + ins_b;
56 if (minw && chosen_desc->text.min_x) 72 if (minw && minx2)
57 { 73 {
58 if (mw > *minw) *minw = mw; 74 if (mw > *minw) *minw = mw;
59 } 75 }
60 if (minh && chosen_desc->text.min_y) 76 if (minh && miny2)
61 { 77 {
62 if (mh > *minh) *minh = mh; 78 if (mh > *minh) *minh = mh;
63 } 79 }
64 } 80 }
65 81
66 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y)) 82 if ((maxx2) || (maxy2))
67 { 83 {
68 int mw = 0, mh = 0; 84 int mw = 0, mh = 0;
69 85
70 tw = th = 0; 86 tw = th = 0;
71 if (!chosen_desc->text.max_x) 87 if (!maxx2)
72 { 88 {
73 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h))); 89 efl_gfx_entity_size_set(ep->object, EINA_SIZE2D(TO_INT(params->eval.w), TO_INT(params->eval.h)));
74 efl_canvas_text_size_formatted_get(ep->object, &tw, &th); 90 efl_canvas_text_size_formatted_get(ep->object, &tw, &th);
@@ -79,12 +95,12 @@ _edje_part_recalc_single_textblock_min_max_calc_legacy(Edje_Real_Part *ep,
79 &ins_t, &ins_b); 95 &ins_t, &ins_b);
80 mw = ins_l + tw + ins_r; 96 mw = ins_l + tw + ins_r;
81 mh = ins_t + th + ins_b; 97 mh = ins_t + th + ins_b;
82 if (maxw && chosen_desc->text.max_x) 98 if (maxw && maxx2)
83 { 99 {
84 if (mw > *maxw) *maxw = mw; 100 if (mw > *maxw) *maxw = mw;
85 if (minw && (*maxw < *minw)) *maxw = *minw; 101 if (minw && (*maxw < *minw)) *maxw = *minw;
86 } 102 }
87 if (maxh && chosen_desc->text.max_y) 103 if (maxh && maxy2)
88 { 104 {
89 if (mh > *maxh) *maxh = mh; 105 if (mh > *maxh) *maxh = mh;
90 if (minh && (*maxh < *minh)) *maxh = *minh; 106 if (minh && (*maxh < *minh)) *maxh = *minh;
@@ -102,18 +118,35 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
102 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b; 118 Evas_Coord tw, th, ins_l, ins_r, ins_t, ins_b;
103 Evas_Coord min_calc_w = 0, min_calc_h = 0; 119 Evas_Coord min_calc_w = 0, min_calc_h = 0;
104 120
121 unsigned char dminx, dminy, dmaxx, dmaxy;
122
123 dminx = chosen_desc->text.min_x;
124 dminy = chosen_desc->text.min_y;
125 dmaxx = chosen_desc->text.max_x;
126 dmaxy = chosen_desc->text.max_y;
127
128 // Do not use size from new api if min/max are non-zero in the theme
129 if (!chosen_desc->text.min_x && !chosen_desc->text.min_y &&
130 !chosen_desc->text.max_x && !chosen_desc->text.max_y)
131 {
132 dminx = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_X;
133 dminy = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MIN_Y;
134 dmaxx = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_X;
135 dmaxy = ep->typedata.text->expand & EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_MAX_Y;
136 }
137
105 /* min_calc_* values need to save calculated minumum size 138 /* min_calc_* values need to save calculated minumum size
106 * for maximum size calculation */ 139 * for maximum size calculation */
107 if (minw) min_calc_w = *minw; 140 if (minw) min_calc_w = *minw;
108 if (minh) min_calc_h = *minh; 141 if (minh) min_calc_h = *minh;
109 142
110 if ((chosen_desc->text.min_x) || (chosen_desc->text.min_y)) 143 if (dminx || dminy)
111 { 144 {
112 evas_object_textblock_style_insets_get(ep->object, &ins_l, 145 evas_object_textblock_style_insets_get(ep->object, &ins_l,
113 &ins_r, &ins_t, &ins_b); 146 &ins_r, &ins_t, &ins_b);
114 147
115 tw = th = 0; 148 tw = th = 0;
116 if (!chosen_desc->text.min_x) 149 if (!dminx)
117 { 150 {
118 /* text.min: 0 1 151 /* text.min: 0 1
119 * text.max: X X */ 152 * text.max: X X */
@@ -122,11 +155,11 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
122 155
123 if (min_calc_w > temp_w) 156 if (min_calc_w > temp_w)
124 temp_w = min_calc_w; 157 temp_w = min_calc_w;
125 if ((!chosen_desc->text.max_x) && 158 if ((!dmaxx) &&
126 maxw && (*maxw > -1) && (*maxw < temp_w)) 159 maxw && (*maxw > -1) && (*maxw < temp_w))
127 temp_w = *maxw; 160 temp_w = *maxw;
128 161
129 if (chosen_desc->text.max_y) 162 if (dmaxy)
130 { 163 {
131 /* text.min: 0 1 164 /* text.min: 0 1
132 * text.max: X 1 */ 165 * text.max: X 1 */
@@ -161,7 +194,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
161 { 194 {
162 /* text.min: 1 X 195 /* text.min: 1 X
163 * text.max: X X */ 196 * text.max: X X */
164 if (chosen_desc->text.min_y && (!chosen_desc->text.max_x) && 197 if (dminy && (!dmaxx) &&
165 maxw && (*maxw > -1)) 198 maxw && (*maxw > -1))
166 { 199 {
167 /* text.min: 1 1 200 /* text.min: 1 1
@@ -174,7 +207,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
174 if (min_calc_w > temp_w) 207 if (min_calc_w > temp_w)
175 temp_w = min_calc_w; 208 temp_w = min_calc_w;
176 209
177 if ((!chosen_desc->text.max_y) && maxh && (*maxh > -1)) 210 if ((!dmaxy) && maxh && (*maxh > -1))
178 { 211 {
179 /* text.min: 1 1 212 /* text.min: 1 1
180 * text.max: 0 0 213 * text.max: 0 0
@@ -210,7 +243,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
210 tw += ins_l + ins_r; 243 tw += ins_l + ins_r;
211 th += ins_t + ins_b; 244 th += ins_t + ins_b;
212 245
213 if (!chosen_desc->text.max_x && 246 if (!dmaxx &&
214 (maxw && (*maxw > -1) && (*maxw < tw))) 247 (maxw && (*maxw > -1) && (*maxw < tw)))
215 { 248 {
216 /* text.min: 1 0 249 /* text.min: 1 0
@@ -222,23 +255,23 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
222 255
223 if (tw > min_calc_w) min_calc_w = tw; 256 if (tw > min_calc_w) min_calc_w = tw;
224 if (th > min_calc_h) min_calc_h = th; 257 if (th > min_calc_h) min_calc_h = th;
225 if (chosen_desc->text.min_x && minw) *minw = min_calc_w; 258 if (dminx && minw) *minw = min_calc_w;
226 if (chosen_desc->text.min_y && minh) *minh = min_calc_h; 259 if (dminy && minh) *minh = min_calc_h;
227 } 260 }
228 261
229 if ((chosen_desc->text.max_x) || (chosen_desc->text.max_y)) 262 if ((dmaxx) || (dmaxy))
230 { 263 {
231 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r, 264 evas_object_textblock_style_insets_get(ep->object, &ins_l, &ins_r,
232 &ins_t, &ins_b); 265 &ins_t, &ins_b);
233 266
234 tw = th = 0; 267 tw = th = 0;
235 if (!chosen_desc->text.max_x) 268 if (!dmaxx)
236 { 269 {
237 /* text.min: X X 270 /* text.min: X X
238 * text.max: 0 1 */ 271 * text.max: 0 1 */
239 int temp_w, temp_h; 272 int temp_w, temp_h;
240 273
241 if (chosen_desc->text.min_y) 274 if (dminy)
242 { 275 {
243 /* text.min: X 1 276 /* text.min: X 1
244 * text.max: 0 1 277 * text.max: 0 1
@@ -284,7 +317,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
284 else 317 else
285 { 318 {
286 /* text.max: 1 X */ 319 /* text.max: 1 X */
287 if (chosen_desc->text.min_x) 320 if (dminx)
288 { 321 {
289 /* text.min: 1 X 322 /* text.min: 1 X
290 * text.max: 1 X 323 * text.max: 1 X
@@ -298,7 +331,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
298 { 331 {
299 /* text.min: 0 X 332 /* text.min: 0 X
300 * text.max: 1 X */ 333 * text.max: 1 X */
301 if (chosen_desc->text.max_y) 334 if (dmaxy)
302 { 335 {
303 /* text.min: 0 X 336 /* text.min: 0 X
304 * text.max: 1 1 */ 337 * text.max: 1 1 */
@@ -312,7 +345,7 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
312 if (min_calc_h > temp_h) 345 if (min_calc_h > temp_h)
313 temp_h = min_calc_h; 346 temp_h = min_calc_h;
314 347
315 if (chosen_desc->text.min_y) 348 if (dminy)
316 { 349 {
317 /* text.min: 0 1 350 /* text.min: 0 1
318 * text.max: 1 1 351 * text.max: 1 1
@@ -370,12 +403,12 @@ _edje_part_recalc_single_textblock_min_max_calc(Edje_Real_Part *ep,
370 } 403 }
371 } 404 }
372 405
373 if (maxw && chosen_desc->text.max_x) 406 if (maxw && dmaxx)
374 { 407 {
375 if (tw > *maxw) *maxw = tw; 408 if (tw > *maxw) *maxw = tw;
376 if (minw && (*maxw < *minw)) *maxw = *minw; 409 if (minw && (*maxw < *minw)) *maxw = *minw;
377 } 410 }
378 if (maxh && chosen_desc->text.max_y) 411 if (maxh && dmaxy)
379 { 412 {
380 if (th > *maxh) *maxh = th; 413 if (th > *maxh) *maxh = th;
381 if (minh && (*maxh < *minh)) *maxh = *minh; 414 if (minh && (*maxh < *minh)) *maxh = *minh;
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 35de55b3f7..c85f485a1c 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -136,6 +136,16 @@ _edje_user_definition_free(Edje_User_Defined *eud)
136 if (rp) _edje_child_remove(eud->ed, rp, child); 136 if (rp) _edje_child_remove(eud->ed, rp, child);
137 break; 137 break;
138 138
139 case EDJE_USER_TEXT_STYLE:
140 {
141 Edje_Part_Text_Prop *prop;
142 EINA_LIST_FREE(eud->u.text_style.props, prop)
143 {
144 free(prop);
145 }
146 break;
147 }
148
139 case EDJE_USER_STRING: 149 case EDJE_USER_STRING:
140 case EDJE_USER_DRAG_STEP: 150 case EDJE_USER_DRAG_STEP:
141 case EDJE_USER_DRAG_PAGE: 151 case EDJE_USER_DRAG_PAGE:
@@ -1993,6 +2003,71 @@ _edje_object_part_text_raw_set(Edje *ed, Evas_Object *obj, Edje_Real_Part *rp, c
1993 EINA_FALSE, EINA_TRUE); 2003 EINA_FALSE, EINA_TRUE);
1994} 2004}
1995 2005
2006Edje_User_Defined *
2007_edje_user_definition_fetch(Edje *ed,
2008 const char *part, Edje_User_Defined_Type type)
2009{
2010 Edje_User_Defined *eud;
2011 Eina_List *l;
2012
2013 EINA_LIST_FOREACH(ed->user_defined, l, eud)
2014 {
2015 if (eud->type == type && !strcmp(eud->part, part))
2016 {
2017 return eud;
2018 }
2019 }
2020 eud = _edje_user_definition_new(type, part, ed);
2021 return eud;
2022}
2023
2024Edje_User_Defined *
2025_edje_user_text_style_definition_fetch(Edje *ed, const char *part)
2026{
2027 Edje_User_Defined *eud;
2028 Eina_List *l;
2029
2030 EINA_LIST_FOREACH(ed->user_defined, l, eud)
2031 {
2032 if (eud->type == EDJE_USER_TEXT_STYLE && !strcmp(eud->part, part))
2033 {
2034 break;
2035 }
2036 }
2037
2038 if (!eud)
2039 {
2040 eud = _edje_user_definition_new(EDJE_USER_TEXT_STYLE, part, ed);
2041 eud->u.text_style.types = EDJE_PART_TEXT_PROP_NONE;
2042 eud->u.text_style.props = NULL;
2043 }
2044
2045 return eud;
2046}
2047
2048Edje_User_Defined *
2049_edje_user_text_expand_definition_fetch(Edje *ed, const char *part)
2050{
2051 Edje_User_Defined *eud;
2052 Eina_List *l;
2053
2054 EINA_LIST_FOREACH(ed->user_defined, l, eud)
2055 {
2056 if (eud->type == EDJE_USER_TEXT_EXPAND && !strcmp(eud->part, part))
2057 {
2058 break;
2059 }
2060 }
2061
2062 if (!eud)
2063 {
2064 eud = _edje_user_definition_new(EDJE_USER_TEXT_EXPAND, part, ed);
2065 eud->u.text_expand.expand = EFL_CANVAS_LAYOUT_PART_TEXT_EXPAND_NONE;
2066 }
2067
2068 return eud;
2069}
2070
1996void 2071void
1997_edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_Text_Type type) 2072_edje_user_define_string(Edje *ed, const char *part, const char *raw_text, Edje_Text_Type type)
1998{ 2073{
diff --git a/src/lib/edje/efl_canvas_layout_part_text.eo b/src/lib/edje/efl_canvas_layout_part_text.eo
index b59f470a5b..4ea5d32349 100644
--- a/src/lib/edje/efl_canvas_layout_part_text.eo
+++ b/src/lib/edje/efl_canvas_layout_part_text.eo
@@ -1,11 +1,38 @@
1enum Efl.Canvas.Layout_Part_Text_Expand
2{
3 [[Text layout policy to enforce. If none is set, min/max descriptions
4 are taken in considerations solely.
5 ]]
6 none = 0, [[No policy. Use default description parameters.]]
7 min_x = 1,
8 min_y = 1 << 1,
9 max_x = 1 << 2,
10 max_y = 1 << 3,
11}
12
1class Efl.Canvas.Layout_Part_Text (Efl.Canvas.Layout_Part, Efl.Text, 13class Efl.Canvas.Layout_Part_Text (Efl.Canvas.Layout_Part, Efl.Text,
2Efl.Text_Markup, Efl.Text_Cursor) 14Efl.Text_Markup, Efl.Text_Cursor, Efl.Text_Format, Efl.Text_Font,
15Efl.Text_Style)
3{ 16{
4 [[Represents a TEXT part of a layout 17 [[Represents a TEXT part of a layout
5 18
6 Its lifetime is limited to one function call only, unless an extra 19 Its lifetime is limited to one function call only, unless an extra
7 reference is explicitly held. 20 reference is explicitly held.
8 ]] 21 ]]
22 methods {
23 @property text_expand {
24 [[Sizing policy for text parts.
25
26 This will determine whether to consider height or width
27 constraints, if text-specific behaviors occur (such as ellipsis,
28 line-wrapping etc.
29 ]]
30 values {
31 type: Efl.Canvas.Layout_Part_Text_Expand;
32 }
33 }
34
35 }
9 data: null; 36 data: null;
10 implements { 37 implements {
11 Efl.Text.text { set; get; } 38 Efl.Text.text { set; get; }
@@ -24,5 +51,26 @@ Efl.Text_Markup, Efl.Text_Cursor)
24 Efl.Text_Cursor.cursor_content { get; } 51 Efl.Text_Cursor.cursor_content { get; }
25 Efl.Text_Cursor.cursor_geometry { get; } 52 Efl.Text_Cursor.cursor_geometry { get; }
26 Efl.Text_Markup.cursor_markup_insert; 53 Efl.Text_Markup.cursor_markup_insert;
54 Efl.Text_Format.ellipsis { set; get; }
55 Efl.Text_Format.wrap { set; get; }
56 Efl.Text_Font.font { set; get; }
57 Efl.Text_Style.normal_color { set; get; }
58 Efl.Text_Style.backing_type { set; get; }
59 Efl.Text_Style.backing_color { set; get;}
60 Efl.Text_Style.underline_type { set; }
61 Efl.Text_Style.underline_color { set; get; }
62 Efl.Text_Style.underline2_color { set; get; }
63 Efl.Text_Style.underline_dashed_color { set; get; }
64 Efl.Text_Style.underline_height { set; }
65 Efl.Text_Style.underline_dashed_width { set; }
66 Efl.Text_Style.underline_dashed_gap { set; }
67 Efl.Text_Style.strikethrough_type { set; }
68 Efl.Text_Style.strikethrough_color { set; get; }
69 Efl.Text_Style.effect_type { set; }
70 Efl.Text_Style.shadow_direction { set; }
71 Efl.Text_Style.outline_color { set; get; }
72 Efl.Text_Style.shadow_color { set; get; }
73 Efl.Text_Style.glow_color { set; get; }
74 Efl.Text_Style.glow2_color { set; get; }
27 } 75 }
28} 76}