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);
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);
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)
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);
+}
Efl_Ui_Focus_Object *legacy_target = NULL;
ELM_WIDGET_DATA_GET_OR_RETURN(logical, pd_logical);
- #define MAP(direction, field) if (dir == EFL_UI_FOCUS_DIRECTION_ ##direction && pd_logical->legacy_focus.field) legacy_target = pd_logical->legacy_focus.field;
+
+ #define MAP(direction, field) if (dir == EFL_UI_FOCUS_DIRECTION_ ##direction && pd_logical->legacy_focus.item_ ##field) legacy_target = elm_object_item_widget_get(pd_logical->legacy_focus.item_ ##field);
MAPPING()
#undef MAP
+ if (!legacy_target)
+ {
+ #define MAP(direction, field) if (dir == EFL_UI_FOCUS_DIRECTION_ ##direction && pd_logical->legacy_focus.field) legacy_target = pd_logical->legacy_focus.field;
+ MAPPING()
+ #undef MAP
+ }
+
if (legacy_target)
{
efl_ui_focus_util_focus(EFL_UI_FOCUS_UTIL_CLASS, legacy_target);
Elm_Focus_Direction dir EINA_UNUSED)
{
API_ENTRY_VAL(NULL)
- /* FOCUS-FIXME */
- //TIZEN_ONLY(20180607): Restore legacy focus
- //return NULL;
+
+ /* TIZEN_ONLY(20180607): Restore legacy focus
+ #define MAP(direction, field) if (dir == EFL_UI_FOCUS_DIRECTION_ ##direction && pd->legacy_focus.item_ ##field) return pd->legacy_focus.item_ ##field;
+ MAPPING()
+ #undef MAP
+
+ return NULL;
+ */
return efl_ui_widget_focus_next_item_get(obj, dir);
//
}
Elm_Focus_Direction dir EINA_UNUSED)
{
API_ENTRY()
- /* FOCUS-FIXME */
- //TIZEN_ONLY(20180607): Restore legacy focus
+
+ /* TIZEN_ONLY(20180607): Restore legacy focus
+ #define MAP(direction, field) if (dir == EFL_UI_FOCUS_DIRECTION_ ##direction) pd->legacy_focus.item_ ##field = next_item;
+ MAPPING()
+ #undef MAP
+ */
efl_ui_widget_focus_next_item_set(obj, next_item, dir);
//
}