forked from enlightenment/efl
selection: add efl_selection interface
Efl_Selection is the object interface for selection api of elm_cnp. It allows get, set, clear, check selection.
This commit is contained in:
parent
763daa870e
commit
f191d6821f
|
@ -97,6 +97,7 @@ elm_public_eolian_files = \
|
|||
lib/elementary/efl_access_window.eo \
|
||||
lib/elementary/efl_config_global.eo \
|
||||
lib/elementary/elm_code_widget.eo \
|
||||
lib/elementary/efl_selection.eo \
|
||||
$(NULL)
|
||||
|
||||
# More public files -- FIXME
|
||||
|
@ -761,6 +762,7 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/efl_ui_scroll_manager.c \
|
||||
lib/elementary/efl_ui_pan.c \
|
||||
lib/elementary/efl_selection_manager.c \
|
||||
lib/elementary/efl_selection.c \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
|
|
@ -324,6 +324,7 @@ EAPI extern Elm_Version *elm_version;
|
|||
# include "efl_selection_types.eot.h"
|
||||
# include "efl_ui_dnd_types.eot.h"
|
||||
# include <efl_ui_pan.eo.h>
|
||||
# include "efl_selection.eo.h"
|
||||
#endif
|
||||
|
||||
/* include deprecated calls last of all */
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "elementary_config.h"
|
||||
#endif
|
||||
|
||||
#define EFL_SELECTION_MANAGER_BETA
|
||||
|
||||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
#define MY_CLASS EFL_SELECTION_MIXIN
|
||||
#define MY_CLASS_NAME "Efl.Selection"
|
||||
|
||||
static inline Eo*
|
||||
_selection_manager_get(Eo *obj)
|
||||
{
|
||||
Eo *top = elm_widget_top_get(obj);
|
||||
if (!top)
|
||||
{
|
||||
top = obj;
|
||||
}
|
||||
Eo *sel_man = efl_key_data_get(top, "__selection_manager");
|
||||
if (!sel_man)
|
||||
{
|
||||
sel_man = efl_add(EFL_SELECTION_MANAGER_CLASS, top);
|
||||
efl_key_data_set(top, "__selection_manager", sel_man);
|
||||
}
|
||||
return sel_man;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_selection_selection_get(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Type type, Efl_Selection_Format format,
|
||||
void *data_func_data, Efl_Selection_Data_Ready data_func, Eina_Free_Cb data_func_free_cb, unsigned int seat)
|
||||
{
|
||||
Eo *sel_man = _selection_manager_get(obj);
|
||||
efl_selection_manager_selection_get(sel_man, obj, type, format,
|
||||
data_func_data, data_func,
|
||||
data_func_free_cb, seat);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Future *
|
||||
_efl_selection_selection_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Type type, Efl_Selection_Format format, Eina_Slice data, unsigned int seat)
|
||||
{
|
||||
Eo *sel_man = _selection_manager_get(obj);
|
||||
return efl_selection_manager_selection_set(sel_man, obj, type, format, data, seat);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_selection_selection_clear(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Type type, unsigned int seat)
|
||||
{
|
||||
Eo *sel_man = _selection_manager_get(obj);
|
||||
efl_selection_manager_selection_clear(sel_man, obj, type, seat);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_selection_has_owner(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Type type, unsigned int seat)
|
||||
{
|
||||
Eo *sel_man = _selection_manager_get(obj);
|
||||
return efl_selection_manager_selection_has_owner(sel_man, obj, type, seat);
|
||||
}
|
||||
|
||||
|
||||
#include "efl_selection.eo.c"
|
|
@ -0,0 +1,45 @@
|
|||
import efl_selection_types;
|
||||
|
||||
mixin Efl.Selection {
|
||||
[[Efl Selection class]]
|
||||
data: null;
|
||||
methods {
|
||||
selection_set {
|
||||
[[Set the selection data to the object]]
|
||||
params {
|
||||
@in type: Efl.Selection.Type; [[Selection Type]]
|
||||
@in format: Efl.Selection.Format; [[Selection Format]]
|
||||
@in data: Eina.Slice;
|
||||
@in seat: uint;[[Specified seat for multiple seats case.]]
|
||||
}
|
||||
return: ptr(Eina.Future); [[Future for tracking when the selection is lost]]
|
||||
}
|
||||
selection_get {
|
||||
[[Get the data from the object that has selection]]
|
||||
params {
|
||||
@in type: Efl.Selection.Type; [[Selection Type]]
|
||||
@in format: Efl.Selection.Format; [[Selection Format]]
|
||||
@in data_func: Efl.Selection.Data_Ready; [[Data ready function pointer]]
|
||||
@in seat: uint;[[Specified seat for multiple seats case.]]
|
||||
}
|
||||
}
|
||||
selection_clear {
|
||||
[[Clear the selection data from the object]]
|
||||
params {
|
||||
@in type: Efl.Selection.Type; [[Selection Type]]
|
||||
@in seat: uint; [[Specified seat for multiple seats case.]]
|
||||
}
|
||||
}
|
||||
has_owner {
|
||||
[[Determine whether the selection data has owner]]
|
||||
params {
|
||||
@in type: Efl.Selection.Type; [[Selection type]]
|
||||
@in seat: uint; [[Specified seat for multiple seats case.]]
|
||||
}
|
||||
return: bool; [[EINA_TRUE if there is object owns selection, otherwise EINA_FALSE]]
|
||||
}
|
||||
}
|
||||
events {
|
||||
selection,changed; [[Called when display server's selection has changed]]
|
||||
}
|
||||
}
|
|
@ -753,7 +753,7 @@ _x11_fixes_selection_notify(void *data, int t EINA_UNUSED, void *event)
|
|||
e.type = type;
|
||||
e.seat = 1; /* under x11 this is always the default seat */
|
||||
e.exist = !!ev->owner;
|
||||
//efl_event_callback_call(sel->owner, EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
|
||||
efl_event_callback_call(sel->owner, EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
|
||||
//ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, e, NULL, NULL);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
|
@ -2512,7 +2512,7 @@ _wl_selection_changed(void *data, int type EINA_UNUSED, void *event)
|
|||
e.display = ecore_wl2_display_connect(ecore_wl2_display_name_get(ev->display));
|
||||
e.exist = !!ecore_wl2_dnd_selection_get(seat);
|
||||
//ecore_event_add(ELM_CNP_EVENT_SELECTION_CHANGED, e, _wl_selection_changed_free, ev->display);
|
||||
//efl_event_callback_call(sel->request_obj, EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
|
||||
efl_event_callback_call(sel->request_obj, EFL_SELECTION_EVENT_SELECTION_CHANGED, &e);
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ struct Efl.Ui.Widget.Focus_State {
|
|||
abstract Efl.Ui.Widget (Efl.Canvas.Group, Efl.Access,
|
||||
Efl.Access.Component, Efl.Ui.Focus.User, Efl.Part,
|
||||
Efl.Ui.Focus.Object, Efl.Ui.Base, Efl.Ui.Cursor,
|
||||
Efl.Ui.Translatable)
|
||||
Efl.Ui.Translatable, Efl.Selection)
|
||||
{
|
||||
[[Elementary widget abstract class]]
|
||||
legacy_prefix: elm_widget;
|
||||
|
|
Loading…
Reference in New Issue