elm_interface_scrollable: fix bringing in of items

This commit is contained in:
Marcel Hollerbach 2016-12-20 18:21:58 +01:00
parent 073c72acce
commit 7994fa3f68
4 changed files with 30 additions and 1 deletions

View File

@ -1132,6 +1132,7 @@ _efl_ui_focus_manager_focus(Eo *obj, Efl_Ui_Focus_Manager_Data *pd, Efl_Ui_Focus
//populate the new change
if (old_focus) efl_ui_focus_object_focus_set(old_focus->focusable, EINA_FALSE);
efl_ui_focus_object_focus_set(node->focusable, EINA_TRUE);
efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, node->focusable);
}
else if (node->redirect_manager)
{

View File

@ -176,5 +176,6 @@ class Efl.Ui.Focus.Manager (Efl.Object) {
redirect,changed : Efl.Ui.Focus.Manager; [[Emitted when the redirect object has changed, the old manager is passed as event info]]
pre,flush; [[Emitted once the graph calculationg will be performed]]
coords,dirty; [[Emitted once the graph is dirty, this means there are potential changes in border_elements you want to know about]]
focused : Efl.Ui.Focus.Object; [[Emitted if the manager has focused a object]]
}
}

View File

@ -4632,6 +4632,28 @@ _elm_interface_scrollable_class_constructor(Efl_Class *klass)
EAPI void elm_pan_gravity_set(Elm_Pan *obj EINA_UNUSED, double x EINA_UNUSED, double y EINA_UNUSED) {}
EAPI void elm_pan_gravity_get(const Elm_Pan *obj EINA_UNUSED, double *x EINA_UNUSED, double *y EINA_UNUSED) {}
static void
_focused_element(void *data, const Efl_Event *event)
{
Eina_Rectangle geom;
Eina_Rectangle obj_geom;
Efl_Ui_Focus_Object *obj = data;
Efl_Ui_Focus_Object *focus = event->info;
Elm_Scrollable_Smart_Interface_Data *pd;
pd = efl_data_scope_get(obj, MY_SCROLLABLE_INTERFACE);
if (!focus) return;
evas_object_geometry_get(focus, &geom.x, &geom.y, &geom.w, &geom.h);
evas_object_geometry_get(pd->content, &obj_geom.x, &obj_geom.y, &obj_geom.w, &obj_geom.h);
geom.x = geom.x - obj_geom.x;
geom.y = geom.y - obj_geom.y;
elm_interface_scrollable_region_bring_in(obj, geom.x, geom.y, geom.w, geom.h);
}
EOLIAN static Efl_Object*
_elm_interface_scrollable_efl_object_constructor(Eo *obj, Elm_Scrollable_Smart_Interface_Data *pd EINA_UNUSED)
{
@ -4640,6 +4662,12 @@ _elm_interface_scrollable_efl_object_constructor(Eo *obj, Elm_Scrollable_Smart_I
efl_composite_attach(obj, pd->manager);
efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, obj);
efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_PRE_FLUSH , obj);
efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY , obj);
efl_event_callback_forwarder_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, obj);
efl_event_callback_add(pd->manager, EFL_UI_FOCUS_MANAGER_EVENT_FOCUSED, _focused_element, obj);
return efl_constructor(efl_super(obj, MY_SCROLLABLE_INTERFACE));
}

View File

@ -683,7 +683,6 @@ mixin Elm.Interface_Scrollable(Efl.Ui.Scrollable, Efl.Canvas.Group, Efl.Ui.Focus
Efl.Canvas.Group.group_add;
Efl.Canvas.Group.group_del;
Efl.Ui.Focus.Manager.border_elements.get;
Efl.Ui.Focus.Manager.focus;
}
events {
changed; [[Called when content changed]]