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"
|
#include "elm_priv.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Eina_Bool old_focus;
|
||||||
} Efl_Ui_Focus_Object_Data;
|
} Efl_Ui_Focus_Object_Data;
|
||||||
|
|
||||||
EOLIAN static void
|
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)
|
efl_event_callback_call(obj, EFL_UI_FOCUS_OBJECT_EVENT_FOCUS_CHANGED , (void*) (uintptr_t) focus);
|
||||||
desc = EFL_UI_FOCUS_OBJECT_EVENT_FOCUS;
|
pd->old_focus = focus;
|
||||||
else
|
|
||||||
desc = EFL_UI_FOCUS_OBJECT_EVENT_UNFOCUS;
|
|
||||||
|
|
||||||
efl_event_callback_call(obj, desc, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,20 @@ mixin Efl.Ui.Focus.Object
|
||||||
[[Functions of focusable objects]]
|
[[Functions of focusable objects]]
|
||||||
methods {
|
methods {
|
||||||
geometry_get {
|
geometry_get {
|
||||||
|
[[The geometry which should be used to calculate the relations to others]]
|
||||||
params {
|
params {
|
||||||
@out rect : Eina.Rectangle;
|
@out rect : Eina.Rectangle; [[the geometry to use]]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@property focus {
|
@property focus {
|
||||||
[[This gets called by the manager and should never be called by someone else
|
[[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 {
|
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;
|
@empty .focus.get;
|
||||||
}
|
}
|
||||||
events {
|
events {
|
||||||
focus;
|
focus,changed : bool; [[Emitted if the focus state has changed]]
|
||||||
unfocus;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue