summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorAmitesh Singh <amitesh.sh@samsung.com>2014-02-03 17:44:16 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-02-03 17:52:02 +0900
commitd1ef695dfbcb4a4569d2b906f2ec27201fdc1b65 (patch)
treead3fdb89acc70e0287d404c3820a7e3e328382b8 /src/bin
parent8a68d8293f5967964edf39c2bb110edb63d299cb (diff)
focus: Added "focus_part" support on elm widget.
Summary: Currently, focus highlight comes on the widget's geometry. Elementary does not have option to provide the focus highlight on widget's part. This patch provides the option to provide focus highlight on the widget's part. e.g. data.item: "focus_part" "part"; The focus highlight would come on part's geometry instead of widget's geometry. This patch only works on widgets which uses resize_obj. Reviewers: seoz, woohyun Differential Revision: https://phab.enlightenment.org/D499
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_focus_style.c64
2 files changed, 64 insertions, 2 deletions
diff --git a/src/bin/test.c b/src/bin/test.c
index 4c9e790f4..c270bd603 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -188,6 +188,7 @@ void test_focus2(void *data, Evas_Object *obj, void *event_info);
188void test_focus_hide_del(void *data, Evas_Object *obj, void *event_info); 188void test_focus_hide_del(void *data, Evas_Object *obj, void *event_info);
189void test_focus_custom_chain(void *data, Evas_Object *obj, void *event_info); 189void test_focus_custom_chain(void *data, Evas_Object *obj, void *event_info);
190void test_focus_style(void *data, Evas_Object *obj, void *event_info); 190void test_focus_style(void *data, Evas_Object *obj, void *event_info);
191void test_focus_part(void *data, Evas_Object *obj, void *event_info);
191void test_flipselector(void *data, Evas_Object *obj, void *event_info); 192void test_flipselector(void *data, Evas_Object *obj, void *event_info);
192void test_diskselector(void *data, Evas_Object *obj, void *event_info); 193void test_diskselector(void *data, Evas_Object *obj, void *event_info);
193void test_colorselector(void *data, Evas_Object *obj, void *event_info); 194void test_colorselector(void *data, Evas_Object *obj, void *event_info);
@@ -753,6 +754,7 @@ add_tests:
753 ADD_TEST(NULL, "Focus", "Focus Hide/Del", test_focus_hide_del); 754 ADD_TEST(NULL, "Focus", "Focus Hide/Del", test_focus_hide_del);
754 ADD_TEST(NULL, "Focus", "Focus Custom Chain", test_focus_custom_chain); 755 ADD_TEST(NULL, "Focus", "Focus Custom Chain", test_focus_custom_chain);
755 ADD_TEST(NULL, "Focus", "Focus Style", test_focus_style); 756 ADD_TEST(NULL, "Focus", "Focus Style", test_focus_style);
757 ADD_TEST(NULL, "Focus", "Focus On Part", test_focus_part);
756 758
757 //------------------------------// 759 //------------------------------//
758 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe); 760 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
diff --git a/src/bin/test_focus_style.c b/src/bin/test_focus_style.c
index 7533c2c4d..a9bfafd64 100644
--- a/src/bin/test_focus_style.c
+++ b/src/bin/test_focus_style.c
@@ -26,8 +26,7 @@ test_focus_style(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
26 char win_focus_theme[PATH_MAX] = { 0 }; 26 char win_focus_theme[PATH_MAX] = { 0 };
27 27
28 sprintf(win_focus_theme, "%s/objects/test_focus_style.edj", elm_app_data_dir_get()); 28 sprintf(win_focus_theme, "%s/objects/test_focus_style.edj", elm_app_data_dir_get());
29 29 elm_theme_extension_add(NULL, win_focus_theme);
30 elm_theme_overlay_add(NULL, win_focus_theme);
31 30
32 win = elm_win_util_standard_add("focus-style", "Focus Style"); 31 win = elm_win_util_standard_add("focus-style", "Focus Style");
33 elm_win_autodel_set(win, EINA_TRUE); 32 elm_win_autodel_set(win, EINA_TRUE);
@@ -114,3 +113,64 @@ test_focus_style(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
114 evas_object_resize(win, 320, 320); 113 evas_object_resize(win, 320, 320);
115 evas_object_show(win); 114 evas_object_show(win);
116} 115}
116
117void
118test_focus_part(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
119{
120 Evas_Object *win, *fr, *bx, *chk, *layout, *ic, *btn;
121 char win_focus_theme[PATH_MAX] = {0}, buf[PATH_MAX] = {0};
122
123 sprintf(win_focus_theme, "%s/objects/test_focus_style.edj", elm_app_data_dir_get());
124 elm_theme_extension_add(NULL, win_focus_theme);
125
126 win = elm_win_util_standard_add("focus_part", "Focus On Part");
127 elm_win_autodel_set(win, EINA_TRUE);
128 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
129 elm_win_focus_highlight_animate_set(win, EINA_TRUE);
130
131 fr = elm_frame_add(win);
132 evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
133 elm_win_resize_object_add(win, fr);
134 elm_object_style_set(fr, "pad_large");
135 evas_object_show(fr);
136
137 bx = elm_box_add(fr);
138 elm_object_content_set(fr, bx);
139 evas_object_show(bx);
140
141 chk = elm_check_add(bx);
142 elm_object_style_set(chk, "focus_text");
143 evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
144 evas_object_size_hint_align_set(chk, EVAS_HINT_FILL, EVAS_HINT_FILL);
145 elm_object_text_set(chk, "Focus highlight on text part only");
146 elm_check_state_set(chk, EINA_TRUE);
147 elm_box_pack_end(bx, chk);
148 evas_object_show(chk);
149
150 layout = elm_layout_add(bx);
151 evas_object_size_hint_weight_set(chk, EVAS_HINT_EXPAND, 0.0);
152 evas_object_size_hint_align_set(chk, EVAS_HINT_FILL, EVAS_HINT_FILL);
153 elm_layout_theme_set(layout, "layout", "focus", "example");
154 elm_box_pack_end(bx, layout);
155 elm_object_focus_allow_set(layout, EINA_TRUE);
156 evas_object_show(layout);
157
158 ic = elm_icon_add(win);
159 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
160 elm_image_file_set(ic, buf, NULL);
161 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
162 btn = elm_button_add(win);
163 elm_object_style_set(btn, "focus_icon");
164 elm_object_text_set(btn, "Focus highlight on icon part only");
165 elm_object_part_content_set(btn, "icon", ic);
166 elm_box_pack_end(bx, btn);
167 evas_object_show(btn);
168
169 btn = elm_button_add(win);
170 elm_object_text_set(btn, "Button");
171 elm_box_pack_end(bx, btn);
172 evas_object_show(btn);
173
174 evas_object_resize(win, 320, 320);
175 evas_object_show(win);
176}