summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-03 11:46:48 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-17 09:12:22 +0100
commitdfc9cd8a6735b5fa77ca953ad7d7e4ec50ee495a (patch)
tree2dd78ad051dc4ce6bb0a0a8d990f356b689e5673 /src/bin
parent2d4f25fb3298756a024f96367fc2aeea26b1e9fe (diff)
downloadefl-dfc9cd8a6735b5fa77ca953ad7d7e4ec50ee495a.tar.gz
elm_focus: implement elm_object_focus_next_item_set / get
you can use this now to let the focus move to the widget container of the passed item. I know this patch contains a whitespace change, but i have to get out this whitespace each & every time i am editing the file - which is annoying. So remove it once, which makes further work easier. fixes T6183. Reviewed-by: YeongJong Lee <yj34.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D7408
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_focus.c62
2 files changed, 63 insertions, 1 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 1cedec20ac..9298e9b2e2 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -258,6 +258,7 @@ void test_focus_object_policy(void *data, Evas_Object *obj, void *event_info);
void test_focus4(void *data, Evas_Object *obj, void *event_info);
void test_focus5(void *data, Evas_Object *obj, void *event_info);
void test_focus6(void *data, Evas_Object *obj, void *event_info);
+void test_focus7(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
void test_flipselector(void *data, Evas_Object *obj, void *event_info);
void test_diskselector(void *data, Evas_Object *obj, void *event_info);
void test_colorselector(void *data, Evas_Object *obj, void *event_info);
@@ -1147,6 +1148,7 @@ add_tests:
ADD_TEST(NULL, "Focus", "Focus 4", test_focus4);
ADD_TEST(NULL, "Focus", "Focus 5", test_focus5);
ADD_TEST(NULL, "Focus", "Focus 6", test_focus6);
+ ADD_TEST(NULL, "Focus", "Focus 7", test_focus7);
//------------------------------//
ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
diff --git a/src/bin/elementary/test_focus.c b/src/bin/elementary/test_focus.c
index ceb6e5cdd5..d1b04eef5e 100644
--- a/src/bin/elementary/test_focus.c
+++ b/src/bin/elementary/test_focus.c
@@ -1031,7 +1031,7 @@ _focus5_btn_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info E
Evas_Object *grid = data;
struct _focus5_obj *layout = evas_object_data_get(grid, "layout");
- // brrr...a really naive looping
+ // brrr...a really naive looping
if (layout == _focus5_layout_data1)
_focus5_layout(grid, _focus5_layout_data2);
else if (layout == _focus5_layout_data2)
@@ -1224,3 +1224,63 @@ test_focus6(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
evas_object_resize(win, 400, 400);
evas_object_show(win);
}
+
+void
+test_focus7(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win, *box, *btn, *gl;
+ Elm_Genlist_Item_Class *itc;
+ Elm_Object_Item *it;
+ int i;
+
+ win = elm_win_util_standard_add("focus7", "Focus 7");
+ elm_win_autodel_set(win, EINA_TRUE);
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+
+ // main vertical box
+ box = elm_box_add(win);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, box);
+ evas_object_show(box);
+
+ // genlist in a swallow
+ gl = elm_genlist_add(box);
+ evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
+ elm_box_pack_end(box, gl);
+
+ itc = elm_genlist_item_class_new();
+ itc->item_style = "default";
+ itc->func.text_get = _focus6_gl_text_get;
+ for (i = 0; i < 3; i++)
+ {
+ it = elm_genlist_item_append(gl, itc, (void*)(uintptr_t)i, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ if (i == 1)
+ {
+ elm_genlist_item_selected_set(it, EINA_TRUE);
+
+ /* focus should start from second item */
+ elm_object_item_focus_set(it, EINA_TRUE);
+ }
+ }
+ elm_genlist_item_class_free(itc);
+ evas_object_show(gl);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "To the right will result in genlist focus");
+ elm_object_focus_next_item_set(btn, it, ELM_FOCUS_RIGHT);
+ elm_box_pack_end(box, btn);
+ evas_object_show(btn);
+
+ btn = elm_button_add(win);
+ elm_object_text_set(btn, "UP");
+ elm_box_pack_end(box, btn);
+ evas_object_show(btn);
+
+ // size and show the window
+ evas_object_resize(win, 400, 400);
+ evas_object_show(win);
+}