1 /* Test for Focus Chain Linear*/
2 #include <Elementary.h>
4 # include "elementary_config.h"
6 #ifndef ELM_LIB_QUICKLAUNCH
8 static Evas_Object *foc = NULL;
11 _foc(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
14 printf("foc -> %p\n", foc);
18 _unfoc(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
21 printf("foc -> %p\n", foc);
25 _add(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
27 Evas_Object *bx = data, *en;
29 en = elm_entry_add(elm_object_top_widget_get(bx));
30 elm_entry_scrollable_set(en, EINA_TRUE);
31 elm_object_text_set(en, "An entry");
32 evas_object_smart_callback_add(en, "focused", _foc, NULL);
33 evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL);
34 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
35 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
36 elm_entry_single_line_set(en, EINA_TRUE);
37 elm_box_pack_start(bx, en);
42 _del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
44 if (foc) evas_object_del(foc);
48 _hide(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
50 if (foc) evas_object_hide(foc);
54 test_focus3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
56 Evas_Object *win, *bg, *bx, *bt, *en;
58 win = elm_win_add(NULL, "focus3", ELM_WIN_BASIC);
59 elm_win_title_set(win, "Focus 3");
60 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
61 evas_object_resize(win, 320, 480);
62 elm_win_autodel_set(win, EINA_TRUE);
65 elm_win_resize_object_add(win, bg);
66 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
69 bx = elm_box_add(win);
70 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71 elm_win_resize_object_add(win, bx);
74 en = elm_entry_add(win);
75 elm_entry_scrollable_set(en, EINA_TRUE);
76 elm_object_text_set(en, "An entry");
77 evas_object_smart_callback_add(en, "focused", _foc, NULL);
78 evas_object_smart_callback_add(en, "unfocused", _unfoc, NULL);
79 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
80 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
81 elm_entry_single_line_set(en, EINA_TRUE);
82 elm_box_pack_end(bx, en);
85 bt = elm_button_add(win);
86 elm_object_focus_allow_set(bt, 0);
87 elm_object_text_set(bt, "Add");
88 evas_object_smart_callback_add(bt, "clicked", _add, bx);
89 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
90 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
91 elm_box_pack_end(bx, bt);
94 bt = elm_button_add(win);
95 elm_object_focus_allow_set(bt, 0);
96 elm_object_text_set(bt, "Del");
97 evas_object_smart_callback_add(bt, "clicked", _del, NULL);
98 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
99 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
100 elm_box_pack_end(bx, bt);
101 evas_object_show(bt);
103 bt = elm_button_add(win);
104 elm_object_focus_allow_set(bt, 0);
105 elm_object_text_set(bt, "Hide");
106 evas_object_smart_callback_add(bt, "clicked", _hide, NULL);
107 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
108 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
109 elm_box_pack_end(bx, bt);
110 evas_object_show(bt);
112 evas_object_show(win);