forked from enlightenment/efl
Adding focus cycle hook to Inwin and Frame.
SVN revision: 52960
This commit is contained in:
parent
6fd3d0b565
commit
e29b0b64b4
|
@ -260,22 +260,37 @@ test_focus(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
{//Third Col
|
||||
Evas_Object *tb = elm_table_add(win);
|
||||
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_box_pack_end(mainbx, tb);
|
||||
my_show(tb);
|
||||
for (j = 0; j < 3; j++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
Evas_Object *bt;
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Button");
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
|
||||
EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_table_pack(tb, bt, i, j, 1, 1);
|
||||
my_show(bt);
|
||||
}
|
||||
Evas_Object *bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND,
|
||||
EVAS_HINT_EXPAND);
|
||||
elm_box_pack_end(mainbx, bx);
|
||||
my_show(bx);
|
||||
|
||||
{
|
||||
Evas_Object *fr = elm_frame_add(win);
|
||||
elm_frame_label_set(fr, "Frame");
|
||||
elm_box_pack_end(bx, fr);
|
||||
evas_object_show(fr);
|
||||
|
||||
{
|
||||
Evas_Object *tb = elm_table_add(win);
|
||||
evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_frame_content_set(fr, tb);
|
||||
my_show(tb);
|
||||
for (j = 0; j < 3; j++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
Evas_Object *bt;
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Table");
|
||||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
|
||||
EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
elm_table_pack(tb, bt, i, j, 1, 1);
|
||||
my_show(bt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{ //Panel
|
||||
|
|
|
@ -46,6 +46,33 @@ _theme_hook(Evas_Object *obj)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_frame_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Object *cur;
|
||||
|
||||
if ((!wd) || (!wd->content))
|
||||
return EINA_FALSE;
|
||||
|
||||
cur = wd->content;
|
||||
|
||||
/* Try Focus cycle in subitem */
|
||||
if (elm_widget_focus_cycle(cur, dir, circular))
|
||||
return EINA_TRUE;
|
||||
/* Ignore focused subitem */
|
||||
if (elm_widget_focus_get(cur) && (!circular))
|
||||
return EINA_FALSE;
|
||||
/* Try give the focus to sub item*/
|
||||
if (elm_widget_can_focus_get(cur))
|
||||
{
|
||||
elm_widget_focus_steal(cur);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
|
@ -107,6 +134,7 @@ elm_frame_add(Evas_Object *parent)
|
|||
elm_widget_data_set(obj, wd);
|
||||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_focus_cycle_hook_set(obj, _elm_frame_focus_cycle_hook);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
|
||||
wd->frm = edje_object_add(e);
|
||||
|
|
|
@ -133,7 +133,7 @@ _elm_win_focus_out(Ecore_Evas *ee)
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_win_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular)
|
||||
_elm_win_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular __UNUSED__)
|
||||
{
|
||||
Elm_Win *wd = elm_widget_data_get(obj);
|
||||
Eina_List *items;
|
||||
|
@ -143,6 +143,8 @@ _elm_win_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool c
|
|||
if ((!wd) || (!wd->subobjs))
|
||||
return EINA_FALSE;
|
||||
|
||||
circular = EINA_TRUE;
|
||||
|
||||
/* Focus chain */
|
||||
/* TODO: Change this to use other chain */
|
||||
items = wd->subobjs;
|
||||
|
@ -2055,6 +2057,21 @@ _theme_hook(Evas_Object *obj)
|
|||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_elm_inwin_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular __UNUSED__)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Object *cur;
|
||||
|
||||
if ((!wd) || (!wd->content))
|
||||
return EINA_FALSE;
|
||||
|
||||
cur = wd->content;
|
||||
|
||||
/* Try Focus cycle in subitem */
|
||||
return elm_widget_focus_cycle(cur, dir, EINA_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
|
@ -2114,6 +2131,7 @@ elm_win_inwin_add(Evas_Object *obj)
|
|||
elm_widget_data_set(obj2, wd);
|
||||
elm_widget_del_hook_set(obj2, _del_hook);
|
||||
elm_widget_theme_hook_set(obj2, _theme_hook);
|
||||
elm_widget_focus_cycle_hook_set(obj2, _elm_inwin_focus_cycle_hook);
|
||||
elm_widget_can_focus_set(obj2, EINA_FALSE);
|
||||
|
||||
wd->frm = edje_object_add(win->evas);
|
||||
|
|
Loading…
Reference in New Issue