efl_ui_focus: add flag to indicate if a child has the focus

this is usefull for later implementations in spinner and fileselector.
A event for this was not added because the result is only really usefull
after a focus operation has been successfull.

Differential Revision: https://phab.enlightenment.org/D7102
This commit is contained in:
Marcel Hollerbach 2018-09-24 11:02:09 +02:00
parent c5add3ef40
commit c972347c1c
2 changed files with 23 additions and 0 deletions

View File

@ -10,6 +10,7 @@
typedef struct {
Eina_Bool old_focus;
Eina_Bool ongoing_prepare_call;
Eina_Bool child_focus;
} Efl_Ui_Focus_Object_Data;
EOLIAN static void
@ -18,6 +19,7 @@ _efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd, Eina_Bool
if (pd->old_focus == focus) return;
pd->old_focus = focus;
efl_ui_focus_object_child_focus_set(efl_ui_focus_object_focus_parent_get(obj), focus);
efl_event_callback_call(obj, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , (void*) (uintptr_t) focus);
}
@ -39,6 +41,21 @@ _efl_ui_focus_object_prepare_logical(Eo *obj, Efl_Ui_Focus_Object_Data *pd)
pd->ongoing_prepare_call = EINA_FALSE;
}
EOLIAN static void
_efl_ui_focus_object_child_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd, Eina_Bool child_focus)
{
if (child_focus == pd->child_focus) return;
pd->child_focus = child_focus;
efl_ui_focus_object_child_focus_set(efl_ui_focus_object_focus_parent_get(obj), pd->child_focus);
}
EOLIAN static Eina_Bool
_efl_ui_focus_object_child_focus_get(const Eo *obj EINA_UNUSED, Efl_Ui_Focus_Object_Data *pd)
{
return pd->child_focus;
}
#include "efl_ui_focus_object.eo.c"

View File

@ -54,6 +54,12 @@ mixin Efl.Ui.Focus.Object
logical_parent : Efl.Ui.Focus.Object; [[The focus parent.]]
}
}
@property child_focus @protected {
[[set if a child of this element has focus or not.]]
values {
child_focus : bool;
}
}
prepare_logical {
[[Tells the object that its children will be queried soon by the given manager.
The call will be a NOP if there is already a active preprare_logical call on this object