summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2015-06-02 13:48:09 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2015-06-02 13:48:09 +0900
commite11728aaa059a16bfe52de832043dc6bbe6a014b (patch)
tree9b16ba7b9228e1dd53da844975102c3baa128126
parentf0a7fafa5959f7b182100e31cab2a808e3543c9b (diff)
missed from prvious commit
-rw-r--r--src/bin/test_focus_policy.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/bin/test_focus_policy.c b/src/bin/test_focus_policy.c
new file mode 100644
index 000000000..a54c00770
--- /dev/null
+++ b/src/bin/test_focus_policy.c
@@ -0,0 +1,115 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Elementary.h>
5
6static void
7_rdg_changed_cb(void *data, Evas_Object *obj,
8 void *event_info EINA_UNUSED)
9{
10 Evas_Object *bt = data;
11 int value = elm_radio_value_get(obj);
12
13 // set focus move policy to the test button
14 switch (value)
15 {
16 case 0:
17 elm_object_text_set(bt, "Test Button(MOUSE CLICK or KEY)");
18 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
19 break;
20 case 1:
21 elm_object_text_set(bt, "Test Button(MOUSE IN or KEY)");
22 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_IN);
23 break;
24 case 2:
25 elm_object_text_set(bt, "Test Button(KEY ONLY)");
26 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_KEY_ONLY);
27 break;
28 default:
29 break;
30 }
31}
32
33void
34test_focus_object_policy(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
35{
36 Evas_Object *win, *fr, *bx, *bt, *test_bt, *rdg, *rd;
37
38 win = elm_win_util_standard_add("focus-object-policy", "Focus Object Policy");
39 elm_win_autodel_set(win, EINA_TRUE);
40 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
41 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
42 elm_win_focus_highlight_style_set(win, "glow");
43
44 fr = elm_frame_add(win);
45 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
46 elm_win_resize_object_add(win, fr);
47 elm_object_style_set(fr, "pad_large");
48 evas_object_show(fr);
49
50 bx = elm_box_add(fr);
51 elm_object_content_set(fr, bx);
52 evas_object_show(bx);
53
54 bt = elm_button_add(bx);
55 elm_object_text_set(bt, "Button 1");
56 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
58 elm_box_pack_end(bx, bt);
59 evas_object_show(bt);
60
61 bt = elm_button_add(bx);
62 elm_object_text_set(bt, "Button 2");
63 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
65 elm_box_pack_end(bx, bt);
66 evas_object_show(bt);
67
68 // a button to test focus object policy
69 test_bt = elm_button_add(bx);
70 elm_object_text_set(test_bt, "Test Button(MOUSE CLICK or KEY)");
71 evas_object_size_hint_weight_set(test_bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
72 evas_object_size_hint_align_set(test_bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
73 elm_box_pack_end(bx, test_bt);
74 evas_object_show(test_bt);
75 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
76
77 bt = elm_button_add(bx);
78 elm_object_text_set(bt, "Button 4");
79 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
80 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
81 elm_box_pack_end(bx, bt);
82 evas_object_show(bt);
83
84 // radios to select focus object policy
85 rd = elm_radio_add(bx);
86 elm_radio_state_value_set(rd, 0);
87 evas_object_size_hint_align_set(rd, 0.0, 0.5);
88 elm_object_text_set(rd, "Focus Move Pollicy Mouse Click");
89 elm_box_pack_end(bx, rd);
90 evas_object_show(rd);
91 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
92
93 rdg = rd;
94
95 rd = elm_radio_add(bx);
96 elm_radio_state_value_set(rd, 1);
97 elm_radio_group_add(rd, rdg);
98 evas_object_size_hint_align_set(rd, 0.0, 0.5);
99 elm_object_text_set(rd, "Focus Move Policy Mouse In");
100 elm_box_pack_end(bx, rd);
101 evas_object_show(rd);
102 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
103
104 rd = elm_radio_add(bx);
105 elm_radio_state_value_set(rd, 2);
106 elm_radio_group_add(rd, rdg);
107 evas_object_size_hint_align_set(rd, 0.0, 0.5);
108 elm_object_text_set(rd, "Focus Move Pollicy Key Only");
109 elm_box_pack_end(bx, rd);
110 evas_object_show(rd);
111 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
112
113 evas_object_resize(win, 320, 320);
114 evas_object_show(win);
115}