containing ui setup steps in the profiling again.
[platform/upstream/expedite.git] / src / bin / textblock_auto_align.c
1 #undef FNAME
2 #undef NAME
3 #undef ICON
4
5 /* metadata */
6 #define FNAME textblock_auto_align_start
7 #define NAME "Textblock auto align"
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
20 /* setup */
21 static void _setup(void)
22 {
23    Evas_Object *o;
24    Evas_Textblock_Style *st;
25
26    o = evas_object_textblock_add(evas);
27    o_text = o;
28    st = evas_textblock_style_new();
29    evas_textblock_style_set
30      (st,
31       "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word'"
32       );
33    evas_object_textblock_style_set(o, st); \
34    evas_object_textblock_clear(o); \
35    evas_object_textblock_text_markup_set(o, "This is a test of auto alignment in Evas<ps/>"
36       "<br/>"
37       "This text should be left aligned<ps/>"
38       "\xE2\x80\x8FThis text should be right aligned<ps/>"
39       "\xE2\x80\x8FThis text should be right aligned<br/>"
40       "Same as this text.<ps/>"
41       "This text should be left aligned<br/>"
42       "\xE2\x80\x8FSame as this text."
43       "<br/><br/><ps/>"
44       "The word 'זה' should be the rightmost, 'טקסט' after, and 'בעברית' last<br/>"
45       "in the following text:<ps/>"
46       "זה טקסט בעברית<ps/>"
47       "<br/>"
48       "In the next text, the paragraph should be right aligned and the<br/>"
49       "words should appear in the following order: 'דוגמה' first, 'of' second, <br/>"
50       "‎'טקסט' third, 'english' fourth and 'in' fifth, counting from right to left<ps/>"
51       "דוגמה of טקסט in english."); \
52    efl_gfx_entity_visible_set(o, EINA_TRUE);
53    evas_textblock_style_free(st);
54
55    done = 0;
56 }
57
58 /* cleanup */
59 static void _cleanup(void)
60 {
61    efl_del(o_text);
62 }
63
64 /* loop - do things */
65 static void _loop(double t, int f)
66 {
67    Evas_Coord x, y, w, h, w0, h0;
68    int i = 0;
69
70    evas_object_textblock_size_native_get(o_text, &w0, &h0);
71    w = w0;
72    h = h0;
73    w += fabs(sin((double)(f + (i * 13)) / (31.1 * SLOW))) * (w0);
74    x = (win_w / 2) - (w / 2);
75    y = (win_h / 2) - (h0 / 2);
76    efl_gfx_entity_position_set(o_text, EINA_POSITION2D(x, y));
77    efl_gfx_entity_size_set(o_text, EINA_SIZE2D(w, h));
78
79    FPS_STD(NAME);
80 }
81
82 /* prepend special key handlers if interactive (before STD) */
83 static void _key(const char *key)
84 {
85    KEY_STD;
86 }
87
88
89
90
91
92
93
94
95
96
97
98
99 /* template stuff - ignore */
100 # endif
101 #endif
102
103 #ifdef UI
104 _ui_menu_item_add(ICON, NAME, FNAME);
105 #endif
106
107 #ifdef PROTO
108 void FNAME(void);
109 #endif
110
111 #ifndef PROTO
112 # ifndef UI
113 void FNAME(void)
114 {
115    ui_func_set(_key, _loop, _setup);
116 }
117 # endif
118 #endif
119 #undef FNAME
120 #undef NAME
121 #undef ICON