forked from enlightenment/efl
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
This commit is contained in:
parent
2d4f25fb32
commit
dfc9cd8a67
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -194,9 +194,17 @@ elm_object_focus_next(Evas_Object *obj,
|
|||
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.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)
|
||||
{
|
||||
|
@ -242,7 +250,11 @@ elm_object_focus_next_item_get(const Evas_Object *obj,
|
|||
Elm_Focus_Direction dir EINA_UNUSED)
|
||||
{
|
||||
API_ENTRY_VAL(NULL)
|
||||
/* FOCUS-FIXME */
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@ -252,7 +264,10 @@ elm_object_focus_next_item_set(Evas_Object *obj,
|
|||
Elm_Focus_Direction dir EINA_UNUSED)
|
||||
{
|
||||
API_ENTRY()
|
||||
/* FOCUS-FIXME */
|
||||
|
||||
#define MAP(direction, field) if (dir == EFL_UI_FOCUS_DIRECTION_ ##direction) pd->legacy_focus.item_ ##field = next_item;
|
||||
MAPPING()
|
||||
#undef MAP
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
|
Loading…
Reference in New Issue