8b938cf9eceb57f840501ad8233fcbbd9e9759a5
[platform/upstream/expedite.git] / src / bin / textblock_text_fill_format.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME textblock_text_fill_format
7 #define NAME "Textblock text_fill_format"
8 #define ICON "text.png"
9
10 #ifndef PROTO
11 # ifndef UI
12 #  include "main.h"
13
14 /* standard var */
15 static int done = 0;
16
17 /* private data */
18 static Evas_Object *o_text;
19 static int sizes[] = {500, 600};
20 Evas_Coord ll, rr, tt, bb;
21
22 /* setup */
23 static void _setup(void)
24 {
25    Evas_Object *o;
26    Evas_Textblock_Style *st;
27
28    o = evas_object_textblock_add(evas);
29    o_text = o;
30    st = evas_textblock_style_new();
31    evas_textblock_style_set (st, "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word align=left outline_color=#000 shadow_color=#fff8 shadow_color=#0002 glow2_color=#fe87 glow_color=#f214 underline_color=#00f linesize=40'");
32    evas_object_textblock_style_set(o, st);
33    evas_object_textblock_clear(o);
34    evas_object_textblock_text_markup_set(o, "This test resize text block and keep style (style parsed only once)");
35
36    efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0)); \
37    efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, win_h)); \
38    efl_gfx_entity_visible_set(o, EINA_TRUE);
39
40    evas_textblock_style_free(st);
41
42    done = 0;
43 }
44
45 /* cleanup */
46 static void _cleanup(void)
47 {
48    efl_del(o_text);
49    o_text = NULL;
50 }
51
52 /* loop - do things */
53 static void _loop(double t, int f)
54 {
55    Evas_Coord x, y, w, h, w0, h0;
56    int i = 0;
57
58    w0 = 160;
59    h0 = 120;
60    w = 150 + ((1.0 + cos((double)(f + (i * 10)) / (37.4 * SLOW) )) * w0 * 2);
61    h = 50 + ((1.0 + sin((double)(f + (i * 19)) / (52.6 * SLOW) )) * h0 * 2);
62    x = (win_w / 2) - (w / 2);
63    x += sin((double)(f + (i * 13)) / (86.7 * SLOW)) * (w0 / 2);
64    y = (win_h / 2) - (h / 2);
65    y += cos((double)(f + (i * 28)) / (93.8 * SLOW)) * (h0 / 2);
66    efl_gfx_entity_position_set(o_text, EINA_POSITION2D(x, y));
67
68    for (i = 0; i < 10000; i++)
69      {
70         evas_object_resize(o_text, sizes[i%2], sizes[i%2]);
71         evas_object_textblock_style_insets_get((Efl_Canvas_Object*) o_text, &ll, &rr, &tt, &bb);
72      }
73    FPS_STD(NAME);
74 }
75
76 /* prepend special key handlers if interactive (before STD) */
77 static void _key(const char *key)
78 {
79    KEY_STD;
80 }
81
82
83
84
85
86
87
88
89
90
91
92
93 /* template stuff - ignore */
94 # endif
95 #endif
96
97 #ifdef UI
98 _ui_menu_item_add(ICON, NAME, FNAME);
99 #endif
100
101 #ifdef PROTO
102 void FNAME(void);
103 #endif
104
105 #ifndef PROTO
106 # ifndef UI
107 void FNAME(void)
108 {
109    ui_func_set(_key, _loop, _setup);
110 }
111 # endif
112 #endif
113 #undef FNAME
114 #undef NAME
115 #undef ICON