forked from enlightenment/efl
dnd: add efl_ui_dnd_container
efl_ui_dnd_container is the interface of dnd for container objects.
This commit is contained in:
parent
e6ab4b41ed
commit
35339504b0
|
@ -99,6 +99,7 @@ elm_public_eolian_files = \
|
||||||
lib/elementary/elm_code_widget.eo \
|
lib/elementary/elm_code_widget.eo \
|
||||||
lib/elementary/efl_selection.eo \
|
lib/elementary/efl_selection.eo \
|
||||||
lib/elementary/efl_ui_dnd.eo \
|
lib/elementary/efl_ui_dnd.eo \
|
||||||
|
lib/elementary/efl_ui_dnd_container.eo \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# More public files -- FIXME
|
# More public files -- FIXME
|
||||||
|
|
|
@ -326,6 +326,7 @@ EAPI extern Elm_Version *elm_version;
|
||||||
# include <efl_ui_pan.eo.h>
|
# include <efl_ui_pan.eo.h>
|
||||||
# include <efl_selection.eo.h>
|
# include <efl_selection.eo.h>
|
||||||
# include <efl_ui_dnd.eo.h>
|
# include <efl_ui_dnd.eo.h>
|
||||||
|
# include <efl_ui_dnd_container.eo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* include deprecated calls last of all */
|
/* include deprecated calls last of all */
|
||||||
|
|
|
@ -13,6 +13,12 @@
|
||||||
#include <Elementary_Cursor.h>
|
#include <Elementary_Cursor.h>
|
||||||
#include "elm_priv.h"
|
#include "elm_priv.h"
|
||||||
|
|
||||||
|
typedef struct _Efl_Ui_Dnd_Container_Data Efl_Ui_Dnd_Container_Data;
|
||||||
|
struct _Efl_Ui_Dnd_Container_Data
|
||||||
|
{
|
||||||
|
unsigned int drag_delay_time;
|
||||||
|
};
|
||||||
|
|
||||||
extern int _wl_default_seat_id_get(Evas_Object *obj);
|
extern int _wl_default_seat_id_get(Evas_Object *obj);
|
||||||
|
|
||||||
static inline Eo*
|
static inline Eo*
|
||||||
|
@ -37,7 +43,6 @@ _efl_ui_dnd_drag_start(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format forma
|
||||||
Efl_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb,
|
Efl_Selection_Action action, void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb,
|
||||||
unsigned int seat)
|
unsigned int seat)
|
||||||
{
|
{
|
||||||
ERR("In");
|
|
||||||
Eo *sel_man = _selection_manager_get(obj);
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
efl_selection_manager_drag_start(sel_man, obj, format, data, action,
|
efl_selection_manager_drag_start(sel_man, obj, format, data, action,
|
||||||
icon_func_data, icon_func, icon_func_free_cb,
|
icon_func_data, icon_func, icon_func_free_cb,
|
||||||
|
@ -47,7 +52,6 @@ _efl_ui_dnd_drag_start(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format forma
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat)
|
_efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat)
|
||||||
{
|
{
|
||||||
ERR("In");
|
|
||||||
Eo *sel_man = _selection_manager_get(obj);
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
efl_selection_manager_drag_cancel(sel_man, obj, seat);
|
efl_selection_manager_drag_cancel(sel_man, obj, seat);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +59,6 @@ _efl_ui_dnd_drag_cancel(Eo *obj, void *pd EINA_UNUSED, unsigned int seat)
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Action action, unsigned int seat)
|
_efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Action action, unsigned int seat)
|
||||||
{
|
{
|
||||||
ERR("In");
|
|
||||||
Eo *sel_man = _selection_manager_get(obj);
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
efl_selection_manager_drag_action_set(sel_man, obj, action, seat);
|
efl_selection_manager_drag_action_set(sel_man, obj, action, seat);
|
||||||
}
|
}
|
||||||
|
@ -64,8 +67,6 @@ _efl_ui_dnd_drag_action_set(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Action
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat)
|
_efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat)
|
||||||
{
|
{
|
||||||
ERR("In");
|
|
||||||
|
|
||||||
Eo *sel_man = _selection_manager_get(obj);
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
efl_selection_manager_drop_target_add(sel_man, obj, format, seat);
|
efl_selection_manager_drop_target_add(sel_man, obj, format, seat);
|
||||||
}
|
}
|
||||||
|
@ -73,9 +74,63 @@ _efl_ui_dnd_drop_target_add(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_ui_dnd_drop_target_del(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat)
|
_efl_ui_dnd_drop_target_del(Eo *obj, void *pd EINA_UNUSED, Efl_Selection_Format format, unsigned int seat)
|
||||||
{
|
{
|
||||||
ERR("In");
|
|
||||||
Eo *sel_man = _selection_manager_get(obj);
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
efl_selection_manager_drop_target_del(sel_man, obj, format, seat);
|
efl_selection_manager_drop_target_del(sel_man, obj, format, seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static double
|
||||||
|
_efl_ui_dnd_container_drag_delay_time_get(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Container_Data *pd)
|
||||||
|
{
|
||||||
|
return pd->drag_delay_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_dnd_container_drag_delay_time_set(Eo *obj EINA_UNUSED, Efl_Ui_Dnd_Container_Data *pd, double drag_delay_time)
|
||||||
|
{
|
||||||
|
pd->drag_delay_time = drag_delay_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_dnd_container_drag_item_add(Eo *obj, Efl_Ui_Dnd_Container_Data *pd,
|
||||||
|
void *data_func_data, Efl_Dnd_Drag_Data_Get data_func, Eina_Free_Cb data_func_free_cb,
|
||||||
|
void *item_func_data, Efl_Dnd_Item_Get item_func, Eina_Free_Cb item_func_free_cb,
|
||||||
|
void *icon_func_data, Efl_Dnd_Drag_Icon_Create icon_func, Eina_Free_Cb icon_func_free_cb,
|
||||||
|
void *icon_list_func_data, Efl_Dnd_Drag_Icon_List_Create icon_list_func, Eina_Free_Cb icon_list_func_free_cb,
|
||||||
|
unsigned int seat)
|
||||||
|
{
|
||||||
|
double drag_delay_time = pd->drag_delay_time;
|
||||||
|
double anim_time = elm_config_drag_anim_duration_get();
|
||||||
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
|
efl_selection_manager_container_drag_item_add(sel_man, obj, drag_delay_time, anim_time,
|
||||||
|
data_func_data, data_func, data_func_free_cb,
|
||||||
|
item_func_data, item_func, item_func_free_cb,
|
||||||
|
icon_func_data, icon_func, icon_func_free_cb,
|
||||||
|
icon_list_func_data, icon_list_func, icon_list_func_free_cb,
|
||||||
|
seat);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_efl_ui_dnd_container_drag_item_del(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, unsigned int seat)
|
||||||
|
{
|
||||||
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
|
efl_selection_manager_container_drag_item_del(sel_man, obj, seat);
|
||||||
|
}
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_dnd_container_drop_item_add(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED,
|
||||||
|
Efl_Selection_Format format,
|
||||||
|
void *item_func_data, Efl_Dnd_Item_Get item_func, Eina_Free_Cb item_func_free_cb,
|
||||||
|
unsigned int seat)
|
||||||
|
{
|
||||||
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
|
efl_selection_manager_container_drop_item_add(sel_man, obj, format, item_func_data, item_func, item_func_free_cb, seat);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_ui_dnd_container_drop_item_del(Eo *obj, Efl_Ui_Dnd_Container_Data *pd EINA_UNUSED, unsigned int seat)
|
||||||
|
{
|
||||||
|
Eo *sel_man = _selection_manager_get(obj);
|
||||||
|
efl_selection_manager_container_drop_item_del(sel_man, obj, seat);
|
||||||
|
}
|
||||||
|
|
||||||
#include "efl_ui_dnd.eo.c"
|
#include "efl_ui_dnd.eo.c"
|
||||||
|
#include "efl_ui_dnd_container.eo.c"
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
import efl_ui_dnd_types;
|
||||||
|
|
||||||
|
mixin Efl.Ui.Dnd.Container {
|
||||||
|
methods {
|
||||||
|
@property drag_delay_time {
|
||||||
|
[[The time since mouse down happens to drag starts.]]
|
||||||
|
set {
|
||||||
|
legacy: null;
|
||||||
|
}
|
||||||
|
get {
|
||||||
|
legacy: null;
|
||||||
|
}
|
||||||
|
values {
|
||||||
|
time: double; [[The drag delay time]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drag_item_add { //drag_item_callback //property
|
||||||
|
[[This registers a drag for items in a container. Many items can be
|
||||||
|
dragged at a time. During dragging, there are three events emitted:
|
||||||
|
EFL_DND_EVENT_DRAG_POS, EFL_DND_EVENT_DRAG_ACCEPT, EFL_DND_EVENT_DRAG_DONE.]]
|
||||||
|
params {
|
||||||
|
//@in time_to_drag: double; [[Time since mouse down happens to drag starts]] //drag_delay: property
|
||||||
|
//@in anim_durataion: double; [[animation duration]] //just config
|
||||||
|
@in data_func: Efl.Dnd.Drag_Data_Get; [[Data and its format]]
|
||||||
|
@in item_func: Efl.Dnd.Item_Get; [[Item to determine drag start]]
|
||||||
|
@in icon_func: Efl.Dnd.Drag_Icon_Create; [[Icon used during drag]]
|
||||||
|
@in icon_list_func: Efl.Dnd.Drag_Icon_List_Create; [[Icons used for animations CHECKING ]]
|
||||||
|
@in seat: uint; [[Specified seat for multiple seats case.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drag_item_del { //remove
|
||||||
|
[[Remove drag function of items in the container object.]]
|
||||||
|
params {
|
||||||
|
@in seat: uint; [[Specified seat for multiple seats case.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drop_item_add {
|
||||||
|
params {
|
||||||
|
@in format: Efl.Selection.Format; [[Accepted data formats]]
|
||||||
|
@in item_func: Efl.Dnd.Item_Get; [[Get item at specific position]]
|
||||||
|
@in seat: uint; [[Specified seat for multiple seats case.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drop_item_del {
|
||||||
|
params {
|
||||||
|
@in seat: uint; [[Specified seat for multiple seats case.]]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -508,6 +508,7 @@ _desc_init(void)
|
||||||
ELM_CONFIG_VAL(D, T, entry_select_allow, T_UCHAR);
|
ELM_CONFIG_VAL(D, T, entry_select_allow, T_UCHAR);
|
||||||
ELM_CONFIG_VAL(D, T, offline, T_UCHAR);
|
ELM_CONFIG_VAL(D, T, offline, T_UCHAR);
|
||||||
ELM_CONFIG_VAL(D, T, powersave, T_INT);
|
ELM_CONFIG_VAL(D, T, powersave, T_INT);
|
||||||
|
ELM_CONFIG_VAL(D, T, drag_anim_duration, T_DOUBLE);
|
||||||
#undef T
|
#undef T
|
||||||
#undef D
|
#undef D
|
||||||
#undef T_INT
|
#undef T_INT
|
||||||
|
@ -1821,6 +1822,7 @@ _config_load(void)
|
||||||
_elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
|
_elm_config->icon_theme = eina_stringshare_add(ELM_CONFIG_ICON_THEME_ELEMENTARY);
|
||||||
_elm_config->popup_scrollable = EINA_FALSE;
|
_elm_config->popup_scrollable = EINA_FALSE;
|
||||||
_elm_config->entry_select_allow = EINA_TRUE;
|
_elm_config->entry_select_allow = EINA_TRUE;
|
||||||
|
_elm_config->drag_anim_duration = 0.0;
|
||||||
_env_get();
|
_env_get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2021,6 +2023,7 @@ _elm_config_reload_do(void)
|
||||||
KEEP_VAL(gl_msaa);
|
KEEP_VAL(gl_msaa);
|
||||||
KEEP_STR(icon_theme);
|
KEEP_STR(icon_theme);
|
||||||
KEEP_VAL(entry_select_allow);
|
KEEP_VAL(entry_select_allow);
|
||||||
|
KEEP_VAL(drag_anim_duration);
|
||||||
|
|
||||||
_elm_config->priv = prev_config->priv;
|
_elm_config->priv = prev_config->priv;
|
||||||
_config_free(prev_config);
|
_config_free(prev_config);
|
||||||
|
@ -2791,6 +2794,9 @@ _env_get(void)
|
||||||
if (s) _elm_config->popup_vertical_align = _elm_atof(s);
|
if (s) _elm_config->popup_vertical_align = _elm_atof(s);
|
||||||
s = getenv("ELM_POPUP_SCROLLABLE");
|
s = getenv("ELM_POPUP_SCROLLABLE");
|
||||||
if (s) _elm_config->popup_scrollable = atoi(s);
|
if (s) _elm_config->popup_scrollable = atoi(s);
|
||||||
|
|
||||||
|
s = getenv("EFL_UI_DND_DRAG_ANIM_DURATION");
|
||||||
|
if (s) _elm_config->drag_anim_duration = _elm_atof(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -4637,6 +4643,20 @@ elm_config_powersave_set(int set)
|
||||||
_elm_config->powersave = set;
|
_elm_config->powersave = set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI double
|
||||||
|
elm_config_drag_anim_duration_get(void)
|
||||||
|
{
|
||||||
|
if (!_elm_config) return 0.0;
|
||||||
|
return _elm_config->drag_anim_duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
elm_config_drag_anim_duration_set(double set)
|
||||||
|
{
|
||||||
|
if (!_elm_config) return;
|
||||||
|
_elm_config->drag_anim_duration = set;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_elm_config_profile_set(const char *profile)
|
_elm_config_profile_set(const char *profile)
|
||||||
{
|
{
|
||||||
|
@ -5074,6 +5094,7 @@ _efl_config_global_efl_config_config_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNU
|
||||||
CONFIG_GETS(web_backend);
|
CONFIG_GETS(web_backend);
|
||||||
CONFIG_GETB(offline);
|
CONFIG_GETB(offline);
|
||||||
CONFIG_GETI(powersave);
|
CONFIG_GETI(powersave);
|
||||||
|
CONFIG_GETD(drag_anim_duration);
|
||||||
|
|
||||||
const size_t len = sizeof("audio_mute") - 1;
|
const size_t len = sizeof("audio_mute") - 1;
|
||||||
if (!strncmp(name, "audio_mute", len))
|
if (!strncmp(name, "audio_mute", len))
|
||||||
|
|
|
@ -2201,6 +2201,25 @@ EAPI int elm_config_powersave_get(void);
|
||||||
*/
|
*/
|
||||||
EAPI void elm_config_powersave_set(int set);
|
EAPI void elm_config_powersave_set(int set);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the animation duration for container objects
|
||||||
|
*
|
||||||
|
* @return Animation duration
|
||||||
|
*
|
||||||
|
* @since 1.21
|
||||||
|
* @see elm_config_drag_anim_duration_set()
|
||||||
|
*/
|
||||||
|
EAPI double elm_config_drag_anim_duration_get();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the animation duration for container objects
|
||||||
|
*
|
||||||
|
* @param set Animation duration
|
||||||
|
*
|
||||||
|
* @since 1.21
|
||||||
|
* @see elm_config_drag_anim_duration_get()
|
||||||
|
*/
|
||||||
|
EAPI void elm_config_drag_anim_duration_set();
|
||||||
|
|
||||||
/* new efl.config interface helpers in C */
|
/* new efl.config interface helpers in C */
|
||||||
|
|
||||||
|
|
|
@ -327,6 +327,7 @@ struct _Elm_Config_Flags
|
||||||
Eina_Bool gl_msaa : 1;
|
Eina_Bool gl_msaa : 1;
|
||||||
Eina_Bool icon_theme : 1;
|
Eina_Bool icon_theme : 1;
|
||||||
Eina_Bool entry_select_allow : 1; // unused
|
Eina_Bool entry_select_allow : 1; // unused
|
||||||
|
Eina_Bool drag_anim_duration : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Elm_Config
|
struct _Elm_Config
|
||||||
|
@ -463,6 +464,7 @@ struct _Elm_Config
|
||||||
unsigned char entry_select_allow;
|
unsigned char entry_select_allow;
|
||||||
Eina_Bool offline;
|
Eina_Bool offline;
|
||||||
int powersave;
|
int powersave;
|
||||||
|
double drag_anim_duration;
|
||||||
|
|
||||||
/* Not part of the EET file */
|
/* Not part of the EET file */
|
||||||
Eina_Bool is_mirrored : 1;
|
Eina_Bool is_mirrored : 1;
|
||||||
|
|
Loading…
Reference in New Issue