summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2015-06-19 14:06:16 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2015-06-26 10:30:21 +0900
commit538f3f992008b71662c1213293ba777425c69d63 (patch)
tree76ae4e7a0d490208182595ee53ec25e1eccb9600
parent3c655aa5ae2c4361526cade434c726be41baea59 (diff)
test_focus_policy: Enhance object focus policy test.
- Add more descriptions in the test. - Set the focus to the first button automatically.
-rw-r--r--src/bin/test_focus_policy.c159
1 files changed, 97 insertions, 62 deletions
diff --git a/src/bin/test_focus_policy.c b/src/bin/test_focus_policy.c
index a54c00770..66a424453 100644
--- a/src/bin/test_focus_policy.c
+++ b/src/bin/test_focus_policy.c
@@ -14,15 +14,15 @@ _rdg_changed_cb(void *data, Evas_Object *obj,
14 switch (value) 14 switch (value)
15 { 15 {
16 case 0: 16 case 0:
17 elm_object_text_set(bt, "Test Button(MOUSE CLICK or KEY)"); 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); 18 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
19 break; 19 break;
20 case 1: 20 case 1:
21 elm_object_text_set(bt, "Test Button(MOUSE IN or KEY)"); 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); 22 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_IN);
23 break; 23 break;
24 case 2: 24 case 2:
25 elm_object_text_set(bt, "Test Button(KEY ONLY)"); 25 elm_object_text_set(bt, "Test Button (KEY ONLY)");
26 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_KEY_ONLY); 26 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_KEY_ONLY);
27 break; 27 break;
28 default: 28 default:
@@ -33,7 +33,7 @@ _rdg_changed_cb(void *data, Evas_Object *obj,
33void 33void
34test_focus_object_policy(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 34test_focus_object_policy(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
35{ 35{
36 Evas_Object *win, *fr, *bx, *bt, *test_bt, *rdg, *rd; 36 Evas_Object *win, *fr, *fr2, *bx, *fr_bx, *bt, *test_bt, *lbl, *rdg, *rd;
37 37
38 win = elm_win_util_standard_add("focus-object-policy", "Focus Object Policy"); 38 win = elm_win_util_standard_add("focus-object-policy", "Focus Object Policy");
39 elm_win_autodel_set(win, EINA_TRUE); 39 elm_win_autodel_set(win, EINA_TRUE);
@@ -51,64 +51,99 @@ test_focus_object_policy(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
51 elm_object_content_set(fr, bx); 51 elm_object_content_set(fr, bx);
52 evas_object_show(bx); 52 evas_object_show(bx);
53 53
54 bt = elm_button_add(bx); 54 /* frame 1 for normal buttons */
55 elm_object_text_set(bt, "Button 1"); 55 {
56 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 56 fr2 = elm_frame_add(bx);
57 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); 57 evas_object_size_hint_weight_set(fr2, EVAS_HINT_EXPAND, 0);
58 elm_box_pack_end(bx, bt); 58 evas_object_size_hint_align_set(fr2, EVAS_HINT_FILL, EVAS_HINT_FILL);
59 evas_object_show(bt); 59 elm_object_text_set(fr2, "Focusable Buttons");
60 60 elm_box_pack_end(bx, fr2);
61 bt = elm_button_add(bx); 61 evas_object_show(fr2);
62 elm_object_text_set(bt, "Button 2"); 62
63 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 63 fr_bx = elm_box_add(fr2);
64 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); 64 elm_object_content_set(fr2, fr_bx);
65 elm_box_pack_end(bx, bt); 65 evas_object_show(fr_bx);
66 evas_object_show(bt); 66
67 67 bt = elm_button_add(fr_bx);
68 // a button to test focus object policy 68 elm_object_text_set(bt, "Button 1");
69 test_bt = elm_button_add(bx); 69 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
70 elm_object_text_set(test_bt, "Test Button(MOUSE CLICK or KEY)"); 70 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
71 evas_object_size_hint_weight_set(test_bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 71 elm_box_pack_end(fr_bx, bt);
72 evas_object_size_hint_align_set(test_bt, EVAS_HINT_FILL, EVAS_HINT_FILL); 72 evas_object_show(bt);
73 elm_box_pack_end(bx, test_bt); 73 elm_object_focus_set(bt, EINA_TRUE);
74 evas_object_show(test_bt); 74
75 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK); 75 bt = elm_button_add(fr_bx);
76 76 elm_object_text_set(bt, "Button 2");
77 bt = elm_button_add(bx); 77 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
78 elm_object_text_set(bt, "Button 4"); 78 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
79 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 79 elm_box_pack_end(fr_bx, bt);
80 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); 80 evas_object_show(bt);
81 elm_box_pack_end(bx, bt); 81
82 evas_object_show(bt); 82 // a button to test focus object policy
83 83 test_bt = elm_button_add(fr_bx);
84 // radios to select focus object policy 84 elm_object_text_set(test_bt, "Test Button (MOUSE CLICK or KEY)");
85 rd = elm_radio_add(bx); 85 evas_object_size_hint_weight_set(test_bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
86 elm_radio_state_value_set(rd, 0); 86 evas_object_size_hint_align_set(test_bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
87 evas_object_size_hint_align_set(rd, 0.0, 0.5); 87 elm_box_pack_end(fr_bx, test_bt);
88 elm_object_text_set(rd, "Focus Move Pollicy Mouse Click"); 88 evas_object_show(test_bt);
89 elm_box_pack_end(bx, rd); 89
90 evas_object_show(rd); 90 elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
91 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt); 91 bt = elm_button_add(fr_bx);
92 92 elm_object_text_set(bt, "Button 4");
93 rdg = rd; 93 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
94 94 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
95 rd = elm_radio_add(bx); 95 elm_box_pack_end(fr_bx, bt);
96 elm_radio_state_value_set(rd, 1); 96 evas_object_show(bt);
97 elm_radio_group_add(rd, rdg); 97 }
98 evas_object_size_hint_align_set(rd, 0.0, 0.5); 98
99 elm_object_text_set(rd, "Focus Move Policy Mouse In"); 99 /* a frame 2 for the test button */
100 elm_box_pack_end(bx, rd); 100 {
101 evas_object_show(rd); 101 fr2 = elm_frame_add(bx);
102 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt); 102 evas_object_size_hint_weight_set(fr2, EVAS_HINT_EXPAND, 0);
103 103 evas_object_size_hint_align_set(fr2, EVAS_HINT_FILL, EVAS_HINT_FILL);
104 rd = elm_radio_add(bx); 104 elm_object_text_set(fr2, "Focus Options for a TEST button");
105 elm_radio_state_value_set(rd, 2); 105 elm_box_pack_end(bx, fr2);
106 elm_radio_group_add(rd, rdg); 106 evas_object_show(fr2);
107 evas_object_size_hint_align_set(rd, 0.0, 0.5); 107
108 elm_object_text_set(rd, "Focus Move Pollicy Key Only"); 108 fr_bx = elm_box_add(fr2);
109 elm_box_pack_end(bx, rd); 109 elm_object_content_set(fr2, fr_bx);
110 evas_object_show(rd); 110 evas_object_show(fr_bx);
111 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt); 111
112 lbl = elm_label_add(fr_bx);
113 evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0);
114 elm_object_text_set(lbl, "This focus option will be applied only for a TEST button. <br/>The focus policies of other buttons will be remain in MOUSE CLICK status.");
115 elm_box_pack_end(fr_bx, lbl);
116 evas_object_show(lbl);
117
118 // radios to select focus object policy
119 rd = elm_radio_add(fr_bx);
120 elm_radio_state_value_set(rd, 0);
121 evas_object_size_hint_align_set(rd, 0.0, 0.5);
122 elm_object_text_set(rd, "Focus Move Pollicy Mouse Click");
123 elm_box_pack_end(fr_bx, rd);
124 evas_object_show(rd);
125 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
126
127 rdg = rd;
128
129 rd = elm_radio_add(fr_bx);
130 elm_radio_state_value_set(rd, 1);
131 elm_radio_group_add(rd, rdg);
132 evas_object_size_hint_align_set(rd, 0.0, 0.5);
133 elm_object_text_set(rd, "Focus Move Policy Mouse In");
134 elm_box_pack_end(fr_bx, rd);
135 evas_object_show(rd);
136 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
137
138 rd = elm_radio_add(fr_bx);
139 elm_radio_state_value_set(rd, 2);
140 elm_radio_group_add(rd, rdg);
141 evas_object_size_hint_align_set(rd, 0.0, 0.5);
142 elm_object_text_set(rd, "Focus Move Pollicy Key Only");
143 elm_box_pack_end(fr_bx, rd);
144 evas_object_show(rd);
145 evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
146 }
112 147
113 evas_object_resize(win, 320, 320); 148 evas_object_resize(win, 320, 320);
114 evas_object_show(win); 149 evas_object_show(win);