diff options
author | Daniel Hirt <hirt.danny@gmail.com> | 2017-09-07 13:47:35 +0300 |
---|---|---|
committer | Daniel Hirt <hirt.danny@gmail.com> | 2017-09-11 17:26:55 +0300 |
commit | e45c0e003237168f658618b27a3139f22c8f2719 (patch) | |
tree | 4e887aa5cc1b2ebe989ff1fd49e05b75ef5bcdf9 /src/bin/elementary/test_efl_ui_text.c | |
parent | ec1670c5f3d02cc9852453829e3743ecdca9502a (diff) | |
download | efl-devs/herdsman/text_async2.tar.gz |
Ui text: use async layoutdevs/herdsman/text_async2
Adds "Efl.Ui.Text_Async" object.
This new widget uses the "async_layout" functionality of the underlying
Efl.Canvas.Text_Async object.
Currently, if "editable" mode is enabled, there is no asynchronous
layout, as interactive operations (e.g. typing) should get processed
immediately. Thus, only "non-editable" instructs the text object to do
asynchronous layout.
elementary_test "efl ui text" is modified to use this new widget.
@feature
Diffstat (limited to 'src/bin/elementary/test_efl_ui_text.c')
-rw-r--r-- | src/bin/elementary/test_efl_ui_text.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/bin/elementary/test_efl_ui_text.c b/src/bin/elementary/test_efl_ui_text.c index 862c832e16..37b7b5865e 100644 --- a/src/bin/elementary/test_efl_ui_text.c +++ b/src/bin/elementary/test_efl_ui_text.c @@ -98,6 +98,14 @@ typedef struct } Test_Data; static void +my_efl_ui_text_bt_1(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) +{ + Eina_Bool enabled = !efl_ui_text_interactive_editable_get(data); + printf("Setting Editable: %d\n", enabled); + efl_ui_text_interactive_editable_set(data, !efl_ui_text_interactive_editable_get(data)); +} + +static void my_efl_ui_text_bt_3(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) { Efl_Text_Cursor_Cursor *sel_start, *sel_end; @@ -168,8 +176,10 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve elm_win_resize_object_add(win, bx); evas_object_show(bx); - en = efl_add(EFL_UI_TEXT_CLASS, win, - efl_text_multiline_set(efl_added, EINA_TRUE)); + en = efl_add(EFL_UI_TEXT_ASYNC_CLASS, win, + efl_text_font_set(efl_added, "Sans", 14)); + + efl_text_multiline_set(en, EINA_TRUE); printf("Added Efl.Ui.Text object\n"); efl_key_data_set(en, "wrap_idx", 0); @@ -177,7 +187,6 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve " new UI Text widget.\xE2\x80\xA9This is the next paragraph.\nThis" " is the next line.\nThis is Yet another line! Line and paragraph" " separators are actually different!"); - efl_text_font_set(en, "Sans", 14); efl_text_font_weight_set(en, EFL_TEXT_FONT_WEIGHT_BOLD); efl_text_font_slant_set(en, EFL_TEXT_FONT_SLANT_ITALIC); efl_text_font_width_set(en, EFL_TEXT_FONT_WIDTH_ULTRACONDENSED); @@ -207,6 +216,15 @@ test_efl_ui_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL, EVAS_HINT_FILL); bt = elm_button_add(win); + elm_object_text_set(bt, "Edit"); + evas_object_smart_callback_add(bt, "clicked", my_efl_ui_text_bt_1, en); + evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0); + elm_box_pack_end(bx2, bt); + elm_object_focus_allow_set(bt, EINA_FALSE); + evas_object_show(bt); + + bt = elm_button_add(win); elm_object_text_set(bt, "Sel"); evas_object_smart_callback_add(bt, "clicked", my_efl_ui_text_bt_3, en); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); |