1 /* Test for Focus Chain Linear*/
3 # include "elementary_config.h"
5 #include <Elementary.h>
6 #ifndef ELM_LIB_QUICKLAUNCH
9 _event(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
11 if (type == EVAS_CALLBACK_KEY_DOWN)
13 else if (type == EVAS_CALLBACK_KEY_UP)
17 Evas_Event_Key_Down *ev = event_info;
18 printf("%s\n", ev->key);
20 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
25 _on_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *einfo __UNUSED__)
27 //Evas_Event_Key_Down *event = einfo;
28 //printf("%s %p Key %s Parent %p\n", evas_object_type_get(obj),
29 // obj, event->keyname, evas_object_smart_parent_get(obj));
33 _disable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
35 Evas_Object *bt = data;
36 elm_object_disabled_set(bt, EINA_TRUE);
40 _enable(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
42 Evas_Object *bt = data;
43 elm_object_disabled_set(bt, EINA_FALSE);
47 my_show(Evas_Object *obj)
49 evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN,
51 evas_object_show(obj);
55 test_focus(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
60 win = elm_win_util_standard_add("focus", "Focus");
61 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
62 evas_object_resize(win, 800, 600);
63 elm_object_event_callback_add(win, _event, NULL);
64 elm_win_autodel_set(win, EINA_TRUE);
67 Evas_Object *mainbx = elm_box_add(win);
68 elm_box_horizontal_set(mainbx, EINA_TRUE);
69 elm_win_resize_object_add(win, mainbx);
70 evas_object_size_hint_weight_set(mainbx, EVAS_HINT_EXPAND,
75 Evas_Object *bx = elm_box_add(win);
76 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND,
78 elm_box_pack_end(mainbx, bx);
82 Evas_Object *lb = elm_label_add(win);
83 elm_object_text_set(lb, "<b>Use Tab or Shift+Tab</b>");
84 evas_object_size_hint_weight_set(lb, 0.0, 0.0);
85 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL,
87 elm_box_pack_end(bx, lb);
92 Evas_Object *tg = elm_check_add(win);
93 elm_object_style_set(tg, "toggle");
94 elm_object_part_text_set(tg, "on", "Yes");
95 elm_object_part_text_set(tg, "off", "No");
96 elm_box_pack_end(bx, tg);
101 Evas_Object *en = elm_entry_add(win);
102 elm_entry_scrollable_set(en, EINA_TRUE);
103 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, 0.0);
104 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, 0.5);
105 elm_object_text_set(en, "This is a single line");
106 elm_entry_single_line_set(en, EINA_TRUE);
107 elm_box_pack_end(bx, en);
112 Evas_Object *bx2 = elm_box_add(win);
113 elm_box_horizontal_set(bx2, EINA_TRUE);
114 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL,
116 evas_object_size_hint_weight_set(bx2, 0.0, 0.0);
117 elm_box_pack_end(bx, bx2);
122 bt = elm_button_add(win);
123 elm_object_text_set(bt, "Box");
124 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
126 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
128 elm_object_disabled_set(bt, EINA_TRUE);
129 elm_box_pack_end(bx2, bt);
134 Evas_Object *sc = elm_scroller_add(win);
135 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND,
137 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL,
139 elm_scroller_bounce_set(sc, EINA_TRUE, EINA_TRUE);
140 elm_scroller_content_min_limit(sc, 1, 1);
141 elm_box_pack_end(bx2, sc);
146 bt = elm_button_add(win);
147 elm_object_text_set(bt, "Scroller");
148 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
150 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
151 elm_object_event_callback_add(bt, _event, NULL);
152 elm_object_content_set(sc, bt);
154 elm_object_event_callback_del(bt, _event, NULL);
163 bt = elm_button_add(win);
164 elm_object_text_set(bt, "Box");
165 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
167 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
168 elm_box_pack_end(bx, bt);
173 Evas_Object *bx2 = elm_box_add(win);
174 elm_box_horizontal_set(bx2, EINA_TRUE);
175 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL,
177 evas_object_size_hint_weight_set(bx2, 0.0, 0.0);
178 elm_box_pack_end(bx, bx2);
183 Evas_Object *bx3 = elm_box_add(win);
184 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL,
186 evas_object_size_hint_weight_set(bx3, 0.0, 0.0);
187 elm_box_pack_end(bx2, bx3);
193 bt = elm_button_add(win);
194 elm_object_text_set(bt, "Box");
195 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
197 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
198 elm_box_pack_end(bx3, bt);
204 Evas_Object *sc = elm_scroller_add(win);
205 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND,
207 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL,
209 elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
210 elm_scroller_content_min_limit(sc, 1, 0);
211 elm_box_pack_end(bx2, sc);
214 Evas_Object *bx3 = elm_box_add(win);
215 evas_object_size_hint_align_set(bx3, EVAS_HINT_FILL,
217 evas_object_size_hint_weight_set(bx3, 0.0, 0.0);
218 elm_object_content_set(sc, bx3);
224 bt = elm_button_add(win);
225 elm_object_text_set(bt, "BX Scroller");
226 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
228 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
229 elm_box_pack_end(bx3, bt);
238 Evas_Object *ly = elm_layout_add(win);
239 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
240 elm_layout_file_set(ly, buf, "twolines");
241 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND,
243 elm_box_pack_end(mainbx, ly);
247 Evas_Object *bx2 = elm_box_add(win);
248 elm_box_horizontal_set(bx2, EINA_TRUE);
249 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL,
251 evas_object_size_hint_weight_set(bx2, 0.0, 0.0);
252 elm_object_part_content_set(ly, "element1", bx2);
258 bt = elm_button_add(win);
259 elm_object_text_set(bt, "Layout");
260 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
262 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
263 elm_box_pack_end(bx2, bt);
265 elm_object_focus_custom_chain_prepend(bx2, bt, NULL);
270 Evas_Object *bx2 = elm_box_add(win);
271 evas_object_size_hint_align_set(bx2, EVAS_HINT_FILL,
273 evas_object_size_hint_weight_set(bx2, 0.0, 0.0);
274 elm_object_part_content_set(ly, "element2", bx2);
279 bt = elm_button_add(win);
280 elm_object_text_set(bt, "Disable");
281 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
283 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
284 elm_box_pack_end(bx2, bt);
285 evas_object_smart_callback_add(bt, "clicked", _disable, bt);
287 elm_object_focus_custom_chain_prepend(bx2, bt, NULL);
290 bt2 = elm_button_add(win);
291 elm_object_text_set(bt2, "Enable");
292 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL,
294 evas_object_size_hint_weight_set(bt2, 0.0, 0.0);
295 elm_box_pack_end(bx2, bt2);
296 evas_object_smart_callback_add(bt2, "clicked", _enable, bt);
298 elm_object_focus_custom_chain_append(bx2, bt2, NULL);
305 Evas_Object *bx = elm_box_add(win);
306 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND,
308 elm_box_pack_end(mainbx, bx);
312 Evas_Object *fr = elm_frame_add(win);
313 elm_object_text_set(fr, "Frame");
314 elm_box_pack_end(bx, fr);
315 evas_object_show(fr);
318 Evas_Object *tb = elm_table_add(win);
319 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
320 elm_object_content_set(fr, tb);
322 for (j = 0; j < 1; j++)
323 for (i = 0; i < 2; i++)
326 bt = elm_button_add(win);
327 elm_object_text_set(bt, "Table");
328 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
330 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
331 elm_table_pack(tb, bt, i, j, 1, 1);
338 Evas_Object *fr = elm_bubble_add(win);
339 elm_object_text_set(fr, "Bubble");
340 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
341 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL,
343 elm_box_pack_end(bx, fr);
344 evas_object_show(fr);
347 Evas_Object *tb = elm_table_add(win);
348 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
349 elm_object_content_set(fr, tb);
351 for (j = 0; j < 2; j++)
352 for (i = 0; i < 1; i++)
355 bt = elm_button_add(win);
356 elm_object_text_set(bt, "Table");
357 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
359 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
360 elm_table_pack(tb, bt, i, j, 1, 1);