forked from enlightenment/efl
Better management to focus cycle.
Now Widgets can control between children interation or receive focus itself. And focus_cycle has now one default code. And don't pass focus to disabled widgets SVN revision: 52959
This commit is contained in:
parent
697a5ad65e
commit
6fd3d0b565
|
@ -98,6 +98,8 @@ test_focus(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_size_hint_align_set(bt, EVAS_HINT_FILL,
|
||||
EVAS_HINT_FILL);
|
||||
evas_object_size_hint_weight_set(bt, 0.0, 0.0);
|
||||
if (i%2)
|
||||
elm_object_disabled_set(bt, EINA_TRUE);
|
||||
elm_box_pack_end(bx2, bt);
|
||||
my_show(bt);
|
||||
}
|
||||
|
|
|
@ -86,25 +86,17 @@ _elm_panel_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool
|
|||
if ((!wd) || (!wd->content))
|
||||
return EINA_FALSE;
|
||||
|
||||
if (wd->hidden)
|
||||
return EINA_FALSE;
|
||||
|
||||
cur = wd->content;
|
||||
|
||||
/* Try Focus cycle in subitem */
|
||||
if (elm_widget_focus_cycle(cur, dir, circular))
|
||||
if ((!wd->hidden) && elm_widget_focus_cycle(cur, dir, circular))
|
||||
return EINA_TRUE;
|
||||
/* Ignore focused subitem */
|
||||
if (elm_widget_focus_get(cur) && (!circular))
|
||||
/* Ignore is previous focused */
|
||||
if (elm_widget_focus_get(obj) && (!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;
|
||||
/* Get Focus*/
|
||||
elm_widget_focus_steal(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -118,17 +118,15 @@ _elm_scroller_focus_cycle_hook(Evas_Object *obj, Elm_Focus_Direction dir, Eina_B
|
|||
/* 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))
|
||||
/* Abort if content is focusable */
|
||||
if (elm_widget_can_focus_get(cur) || elm_widget_child_can_focus_get(cur))
|
||||
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;
|
||||
/* Ignore is previous focused */
|
||||
if (elm_widget_focus_get(obj) && (!circular))
|
||||
return EINA_FALSE;
|
||||
/* Get Focus*/
|
||||
elm_widget_focus_steal(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -749,9 +749,22 @@ EAPI Eina_Bool
|
|||
elm_widget_focus_cycle(Evas_Object *obj, Elm_Focus_Direction dir, Eina_Bool circular)
|
||||
{
|
||||
API_ENTRY return EINA_FALSE;
|
||||
if (!sd->focus_cycle_func) return EINA_FALSE;
|
||||
|
||||
return sd->focus_cycle_func(obj, dir, circular);
|
||||
/* Ignore if disabled */
|
||||
if ((!evas_object_visible_get(obj)) || elm_widget_disabled_get(obj))
|
||||
return EINA_FALSE;
|
||||
|
||||
/* Try use hook */
|
||||
if (sd->focus_cycle_func)
|
||||
return sd->focus_cycle_func(obj, dir, circular);
|
||||
|
||||
/* Ignore if previous focused*/
|
||||
if ((!elm_widget_can_focus_get(obj)) || (elm_widget_focus_get(obj) && (!circular)))
|
||||
return EINA_FALSE;
|
||||
|
||||
/* Get focus*/
|
||||
elm_widget_focus_steal(obj);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
|
@ -802,15 +815,6 @@ elm_widget_focus_cycle_next_get(Evas_Object *obj, Eina_List *items, void *(*list
|
|||
/* Try Focus cycle in subitem */
|
||||
if (elm_widget_focus_cycle(cur, dir, child_circular))
|
||||
break;
|
||||
/* Ignore focused subitem */
|
||||
if (elm_widget_focus_get(cur) && (!child_circular))
|
||||
continue;
|
||||
/* Try give the focus to sub item*/
|
||||
if (elm_widget_can_focus_get(cur))
|
||||
{
|
||||
elm_widget_focus_steal(cur);
|
||||
break;
|
||||
}
|
||||
}
|
||||
circular = circular && (!child_circular);
|
||||
child_circular = !child_circular;
|
||||
|
|
Loading…
Reference in New Issue