forked from enlightenment/efl
focus: update object definition
the event is now a bit better, since you only need to subscribe to one event instead of two, the new state is passed in the event.
This commit is contained in:
parent
01f46ae205
commit
357715f091
|
@ -6,20 +6,16 @@
|
|||
#include "elm_priv.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
Eina_Bool old_focus;
|
||||
} Efl_Ui_Focus_Object_Data;
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd EINA_UNUSED, Eina_Bool focus)
|
||||
_efl_ui_focus_object_focus_set(Eo *obj, Efl_Ui_Focus_Object_Data *pd, Eina_Bool focus)
|
||||
{
|
||||
const Efl_Event_Description *desc;
|
||||
if (pd->old_focus == focus) return;
|
||||
|
||||
if (focus)
|
||||
desc = EFL_UI_FOCUS_OBJECT_EVENT_FOCUS;
|
||||
else
|
||||
desc = EFL_UI_FOCUS_OBJECT_EVENT_UNFOCUS;
|
||||
|
||||
efl_event_callback_call(obj, desc, NULL);
|
||||
efl_event_callback_call(obj, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , (void*) (uintptr_t) focus);
|
||||
pd->old_focus = focus;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,17 +3,20 @@ mixin Efl.Ui.Focus.Object
|
|||
[[Functions of focusable objects]]
|
||||
methods {
|
||||
geometry_get {
|
||||
[[The geometry which should be used to calculate the relations to others]]
|
||||
params {
|
||||
@out rect : Eina.Rectangle;
|
||||
@out rect : Eina.Rectangle; [[the geometry to use]]
|
||||
}
|
||||
}
|
||||
@property focus {
|
||||
[[This gets called by the manager and should never be called by someone else
|
||||
|
||||
It can be used by a implementation of a focus object to adapt to changes which are needed
|
||||
It can be used by a implementation of a focus object to adapt to changes which are needed.
|
||||
|
||||
The function is emitting the focus state events, if focus is different to the state before.
|
||||
]]
|
||||
values {
|
||||
focus : bool;
|
||||
focus : bool; [[The state in which the object should be put]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +25,6 @@ mixin Efl.Ui.Focus.Object
|
|||
@empty .focus.get;
|
||||
}
|
||||
events {
|
||||
focus;
|
||||
unfocus;
|
||||
focus,changed : bool; [[Emitted if the focus state has changed]]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue