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)
downloadelementary-538f3f992008b71662c1213293ba777425c69d63.tar.gz
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,
switch (value)
{
case 0:
- elm_object_text_set(bt, "Test Button(MOUSE CLICK or KEY)");
+ elm_object_text_set(bt, "Test Button (MOUSE CLICK or KEY)");
elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
break;
case 1:
- elm_object_text_set(bt, "Test Button(MOUSE IN or KEY)");
+ elm_object_text_set(bt, "Test Button (MOUSE IN or KEY)");
elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_IN);
break;
case 2:
- elm_object_text_set(bt, "Test Button(KEY ONLY)");
+ elm_object_text_set(bt, "Test Button (KEY ONLY)");
elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_KEY_ONLY);
break;
default:
@@ -33,7 +33,7 @@ _rdg_changed_cb(void *data, Evas_Object *obj,
void
test_focus_object_policy(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- Evas_Object *win, *fr, *bx, *bt, *test_bt, *rdg, *rd;
+ Evas_Object *win, *fr, *fr2, *bx, *fr_bx, *bt, *test_bt, *lbl, *rdg, *rd;
win = elm_win_util_standard_add("focus-object-policy", "Focus Object Policy");
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
elm_object_content_set(fr, bx);
evas_object_show(bx);
- bt = elm_button_add(bx);
- elm_object_text_set(bt, "Button 1");
- evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, bt);
- evas_object_show(bt);
-
- bt = elm_button_add(bx);
- elm_object_text_set(bt, "Button 2");
- evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, bt);
- evas_object_show(bt);
-
- // a button to test focus object policy
- test_bt = elm_button_add(bx);
- elm_object_text_set(test_bt, "Test Button(MOUSE CLICK or KEY)");
- evas_object_size_hint_weight_set(test_bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(test_bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, test_bt);
- evas_object_show(test_bt);
- elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
-
- bt = elm_button_add(bx);
- elm_object_text_set(bt, "Button 4");
- evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_box_pack_end(bx, bt);
- evas_object_show(bt);
-
- // radios to select focus object policy
- rd = elm_radio_add(bx);
- elm_radio_state_value_set(rd, 0);
- evas_object_size_hint_align_set(rd, 0.0, 0.5);
- elm_object_text_set(rd, "Focus Move Pollicy Mouse Click");
- elm_box_pack_end(bx, rd);
- evas_object_show(rd);
- evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
-
- rdg = rd;
-
- rd = elm_radio_add(bx);
- elm_radio_state_value_set(rd, 1);
- elm_radio_group_add(rd, rdg);
- evas_object_size_hint_align_set(rd, 0.0, 0.5);
- elm_object_text_set(rd, "Focus Move Policy Mouse In");
- elm_box_pack_end(bx, rd);
- evas_object_show(rd);
- evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
-
- rd = elm_radio_add(bx);
- elm_radio_state_value_set(rd, 2);
- elm_radio_group_add(rd, rdg);
- evas_object_size_hint_align_set(rd, 0.0, 0.5);
- elm_object_text_set(rd, "Focus Move Pollicy Key Only");
- elm_box_pack_end(bx, rd);
- evas_object_show(rd);
- evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
+ /* frame 1 for normal buttons */
+ {
+ fr2 = elm_frame_add(bx);
+ evas_object_size_hint_weight_set(fr2, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(fr2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr2, "Focusable Buttons");
+ elm_box_pack_end(bx, fr2);
+ evas_object_show(fr2);
+
+ fr_bx = elm_box_add(fr2);
+ elm_object_content_set(fr2, fr_bx);
+ evas_object_show(fr_bx);
+
+ bt = elm_button_add(fr_bx);
+ elm_object_text_set(bt, "Button 1");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(fr_bx, bt);
+ evas_object_show(bt);
+ elm_object_focus_set(bt, EINA_TRUE);
+
+ bt = elm_button_add(fr_bx);
+ elm_object_text_set(bt, "Button 2");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(fr_bx, bt);
+ evas_object_show(bt);
+
+ // a button to test focus object policy
+ test_bt = elm_button_add(fr_bx);
+ elm_object_text_set(test_bt, "Test Button (MOUSE CLICK or KEY)");
+ evas_object_size_hint_weight_set(test_bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(test_bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(fr_bx, test_bt);
+ evas_object_show(test_bt);
+
+ elm_object_focus_move_policy_set(bt, ELM_FOCUS_MOVE_POLICY_CLICK);
+ bt = elm_button_add(fr_bx);
+ elm_object_text_set(bt, "Button 4");
+ evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_box_pack_end(fr_bx, bt);
+ evas_object_show(bt);
+ }
+
+ /* a frame 2 for the test button */
+ {
+ fr2 = elm_frame_add(bx);
+ evas_object_size_hint_weight_set(fr2, EVAS_HINT_EXPAND, 0);
+ evas_object_size_hint_align_set(fr2, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_object_text_set(fr2, "Focus Options for a TEST button");
+ elm_box_pack_end(bx, fr2);
+ evas_object_show(fr2);
+
+ fr_bx = elm_box_add(fr2);
+ elm_object_content_set(fr2, fr_bx);
+ evas_object_show(fr_bx);
+
+ lbl = elm_label_add(fr_bx);
+ evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0);
+ 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.");
+ elm_box_pack_end(fr_bx, lbl);
+ evas_object_show(lbl);
+
+ // radios to select focus object policy
+ rd = elm_radio_add(fr_bx);
+ elm_radio_state_value_set(rd, 0);
+ evas_object_size_hint_align_set(rd, 0.0, 0.5);
+ elm_object_text_set(rd, "Focus Move Pollicy Mouse Click");
+ elm_box_pack_end(fr_bx, rd);
+ evas_object_show(rd);
+ evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
+
+ rdg = rd;
+
+ rd = elm_radio_add(fr_bx);
+ elm_radio_state_value_set(rd, 1);
+ elm_radio_group_add(rd, rdg);
+ evas_object_size_hint_align_set(rd, 0.0, 0.5);
+ elm_object_text_set(rd, "Focus Move Policy Mouse In");
+ elm_box_pack_end(fr_bx, rd);
+ evas_object_show(rd);
+ evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
+
+ rd = elm_radio_add(fr_bx);
+ elm_radio_state_value_set(rd, 2);
+ elm_radio_group_add(rd, rdg);
+ evas_object_size_hint_align_set(rd, 0.0, 0.5);
+ elm_object_text_set(rd, "Focus Move Pollicy Key Only");
+ elm_box_pack_end(fr_bx, rd);
+ evas_object_show(rd);
+ evas_object_smart_callback_add(rd, "changed", _rdg_changed_cb, test_bt);
+ }
evas_object_resize(win, 320, 320);
evas_object_show(win);