forked from enlightenment/efl
efl_ui_focus_util: add a util class
the util class is for common code that is just added again and again.
This commit is contained in:
parent
c37226ef5e
commit
738cb8a2bb
|
@ -46,6 +46,7 @@ elm_public_eolian_files = \
|
|||
lib/elementary/efl_ui_focus_user.eo \
|
||||
lib/elementary/efl_ui_focus_layer.eo \
|
||||
lib/elementary/efl_ui_focus_composition.eo \
|
||||
lib/elementary/efl_ui_focus_util.eo \
|
||||
lib/elementary/efl_ui_button_part.eo \
|
||||
lib/elementary/efl_ui_flip_part.eo \
|
||||
lib/elementary/efl_ui_layout_part.eo \
|
||||
|
@ -703,6 +704,7 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/efl_ui_focus_parent_provider.c \
|
||||
lib/elementary/efl_ui_focus_parent_provider_standard.c \
|
||||
lib/elementary/efl_ui_focus_parent_provider_gen.c \
|
||||
lib/elementary/efl_ui_focus_util.c \
|
||||
lib/elementary/elm_widget_item_static_focus.c \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -144,6 +144,7 @@ EAPI extern Elm_Version *elm_version;
|
|||
# include "efl_ui_focus_manager_sub.eo.h"
|
||||
# include "efl_ui_focus_manager_root_focus.eo.h"
|
||||
# include "efl_ui_focus_user.eo.h"
|
||||
# include "efl_ui_focus_util.eo.h"
|
||||
# include <efl_ui_textpath.eo.h>
|
||||
# include <efl_ui_translatable.eo.h>
|
||||
# include <efl_ui_focus_composition.eo.h>
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
typedef struct {
|
||||
|
||||
} Efl_Ui_Focus_Util_Data;
|
||||
|
||||
static void
|
||||
_manager_changed(void *data, const Efl_Event *event EINA_UNUSED)
|
||||
{
|
||||
efl_ui_focus_util_focus(EFL_UI_FOCUS_UTIL_CLASS, data);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_focus_util_focus(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Focus_User *user)
|
||||
{
|
||||
Elm_Widget *top, *o;
|
||||
Efl_Ui_Focus_Manager *m;
|
||||
m = efl_ui_focus_user_manager_get(user);
|
||||
|
||||
top = elm_widget_top_get(user);
|
||||
|
||||
o = efl_key_data_get(top, "__delayed_focus_set");
|
||||
efl_event_callback_del(o, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, o);
|
||||
efl_key_data_set(top, "__delayed_focus_set", NULL);
|
||||
|
||||
if (!m)
|
||||
{
|
||||
//delayed focusung
|
||||
efl_key_data_set(top, "__delayed_focus_set", user);
|
||||
efl_event_callback_add(user, EFL_UI_FOCUS_USER_EVENT_MANAGER_CHANGED, _manager_changed, user);
|
||||
return;
|
||||
}
|
||||
|
||||
efl_ui_focus_manager_focus_set(m, user);
|
||||
}
|
||||
|
||||
#include "efl_ui_focus_util.eo.c"
|
|
@ -0,0 +1,9 @@
|
|||
class Efl.Ui.Focus.Util(Efl.Object) {
|
||||
methods {
|
||||
focus @class {
|
||||
params {
|
||||
focus_elem : Efl.Ui.Focus.Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue