2010-08-11 07:17:47 -07:00
|
|
|
|
#undef FNAME
|
|
|
|
|
#undef NAME
|
|
|
|
|
#undef ICON
|
|
|
|
|
|
|
|
|
|
/* metadata */
|
|
|
|
|
#define FNAME textblock_auto_align_start
|
|
|
|
|
#define NAME "Textblock auto align"
|
|
|
|
|
#define ICON "text.png"
|
|
|
|
|
|
|
|
|
|
#ifndef PROTO
|
|
|
|
|
# ifndef UI
|
|
|
|
|
# include "main.h"
|
|
|
|
|
|
|
|
|
|
/* standard var */
|
|
|
|
|
static int done = 0;
|
|
|
|
|
|
|
|
|
|
/* private data */
|
|
|
|
|
static Evas_Object *o_text;
|
|
|
|
|
|
|
|
|
|
/* setup */
|
|
|
|
|
static void _setup(void)
|
|
|
|
|
{
|
|
|
|
|
Evas_Object *o;
|
|
|
|
|
Evas_Textblock_Style *st;
|
|
|
|
|
|
2014-06-03 06:21:17 -07:00
|
|
|
|
o = eo_add(EVAS_TEXTBLOCK_CLASS, evas);
|
2010-08-11 07:17:47 -07:00
|
|
|
|
o_text = o;
|
|
|
|
|
st = evas_textblock_style_new();
|
|
|
|
|
evas_textblock_style_set
|
|
|
|
|
(st,
|
|
|
|
|
"DEFAULT='font=Sans font_size=10 color=#000000 wrap=word'"
|
|
|
|
|
);
|
2014-08-21 15:48:19 -07:00
|
|
|
|
eo_do(o,
|
|
|
|
|
evas_obj_textblock_style_set(st),
|
|
|
|
|
evas_obj_textblock_clear(),
|
|
|
|
|
evas_obj_textblock_text_markup_set(
|
2011-12-08 04:40:03 -08:00
|
|
|
|
"This is a test of auto alignment in Evas<ps/>"
|
|
|
|
|
"<br/>"
|
|
|
|
|
"This text should be left aligned<ps/>"
|
|
|
|
|
"\xE2\x80\x8FThis text should be right aligned<ps/>"
|
|
|
|
|
"\xE2\x80\x8FThis text should be right aligned<br/>"
|
|
|
|
|
"Same as this text.<ps/>"
|
|
|
|
|
"This text should be left aligned<br/>"
|
2010-08-11 07:17:47 -07:00
|
|
|
|
"\xE2\x80\x8FSame as this text."
|
2011-12-08 04:40:03 -08:00
|
|
|
|
"<br/><br/><ps/>"
|
|
|
|
|
"The word 'זה' should be the rightmost, 'טקסט' after, and 'בעברית' last<br/>"
|
|
|
|
|
"in the following text:<ps/>"
|
|
|
|
|
"זה טקסט בעברית<ps/>"
|
|
|
|
|
"<br/>"
|
|
|
|
|
"In the next text, the paragraph should be right aligned and the<br/>"
|
|
|
|
|
"words should appear in the following order: 'דוגמה' first, 'of' second,<br/>"
|
|
|
|
|
"'טקסט' third, 'english' fourth and 'in' fifth, counting from right to left<ps/>"
|
2010-08-11 07:17:47 -07:00
|
|
|
|
"דוגמה of טקסט in english."
|
2014-08-21 15:48:19 -07:00
|
|
|
|
),
|
2015-04-09 04:31:59 -07:00
|
|
|
|
efl_gfx_visible_set(EINA_TRUE));
|
2014-08-21 15:48:19 -07:00
|
|
|
|
evas_textblock_style_free(st);
|
2010-08-11 07:17:47 -07:00
|
|
|
|
|
|
|
|
|
done = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* cleanup */
|
|
|
|
|
static void _cleanup(void)
|
|
|
|
|
{
|
2013-01-23 07:05:09 -08:00
|
|
|
|
eo_del(o_text);
|
2010-08-11 07:17:47 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* loop - do things */
|
|
|
|
|
static void _loop(double t, int f)
|
|
|
|
|
{
|
|
|
|
|
Evas_Coord x, y, w, h, w0, h0;
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
2014-08-21 15:48:19 -07:00
|
|
|
|
eo_do(o_text, evas_obj_textblock_size_native_get(&w0, &h0));
|
2010-08-11 07:17:47 -07:00
|
|
|
|
w = w0;
|
|
|
|
|
h = h0;
|
|
|
|
|
w += fabs(sin((double)(f + (i * 13)) / (31.1 * SLOW))) * (w0);
|
|
|
|
|
x = (win_w / 2) - (w / 2);
|
|
|
|
|
y = (win_h / 2) - (h0 / 2);
|
2014-08-21 15:48:19 -07:00
|
|
|
|
eo_do(o_text,
|
2015-04-09 04:31:59 -07:00
|
|
|
|
efl_gfx_position_set(x, y),
|
|
|
|
|
efl_gfx_size_set(w, h));
|
2010-08-11 07:17:47 -07:00
|
|
|
|
|
|
|
|
|
FPS_STD(NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* prepend special key handlers if interactive (before STD) */
|
|
|
|
|
static void _key(char *key)
|
|
|
|
|
{
|
|
|
|
|
KEY_STD;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* template stuff - ignore */
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef UI
|
|
|
|
|
_ui_menu_item_add(ICON, NAME, FNAME);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef PROTO
|
|
|
|
|
void FNAME(void);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef PROTO
|
|
|
|
|
# ifndef UI
|
|
|
|
|
void FNAME(void)
|
|
|
|
|
{
|
|
|
|
|
ui_func_set(_key, _loop);
|
|
|
|
|
_setup();
|
|
|
|
|
}
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
#undef FNAME
|
|
|
|
|
#undef NAME
|
|
|
|
|
#undef ICON
|