[WM_ROT] Fixed floating mode window rotation bug that window doesn't send ROTATION_DO...
[platform/core/uifw/e17.git] / src / bin / e_dnd.h
1 #ifdef E_TYPEDEFS
2
3 typedef enum _E_Drag_Type
4 {
5    E_DRAG_NONE,
6    E_DRAG_INTERNAL,
7    E_DRAG_XDND
8 } E_Drag_Type;
9
10 typedef struct _E_Drag            E_Drag;
11 typedef struct _E_Drop_Handler    E_Drop_Handler;
12 typedef struct _E_Event_Dnd_Enter E_Event_Dnd_Enter;
13 typedef struct _E_Event_Dnd_Move  E_Event_Dnd_Move;
14 typedef struct _E_Event_Dnd_Leave E_Event_Dnd_Leave;
15 typedef struct _E_Event_Dnd_Drop  E_Event_Dnd_Drop;
16
17 #else
18 #ifndef E_DND_H
19 #define E_DND_H
20
21 #define E_DRAG_TYPE 0xE0b0100f
22
23 struct _E_Drag
24 {
25    E_Object           e_obj_inherit;
26
27    void              *data;
28    int                data_size;
29
30    E_Drag_Type        type;
31
32    struct
33    {
34       void *(*convert)(E_Drag * drag, const char *type);
35       void  (*finished)(E_Drag *drag, int dropped);
36       void  (*key_down)(E_Drag *drag, Ecore_Event_Key *e);
37       void  (*key_up)(E_Drag *drag, Ecore_Event_Key *e);
38    } cb;
39
40    E_Container       *container;
41    Ecore_Evas        *ecore_evas;
42    Evas              *evas;
43    Ecore_X_Window     evas_win;
44    E_Container_Shape *shape;
45    Evas_Object       *object;
46
47    int                x, y, w, h;
48    int                dx, dy;
49
50    int                shape_rects_num;
51    Ecore_X_Rectangle *shape_rects;
52
53    unsigned int       layer;
54    unsigned char      visible : 1;
55    unsigned char      need_shape_export : 1;
56    unsigned char      xy_update : 1;
57
58    unsigned int       num_types;
59    const char        *types[];
60 };
61
62 struct _E_Drop_Handler
63 {
64    struct
65    {
66       void  (*enter)(void *data, const char *type, void *event);
67       void  (*move)(void *data, const char *type, void *event);
68       void  (*leave)(void *data, const char *type, void *event);
69       void  (*drop)(void *data, const char *type, void *event);
70       Ecore_Task_Cb xds;
71       void *data;
72    } cb;
73
74    E_Object     *obj;
75    int           x, y, w, h;
76
77    unsigned char active : 1;
78    unsigned char entered : 1;
79    const char   *active_type;
80    unsigned int  num_types;
81    const char   *types[];
82 };
83
84 struct _E_Event_Dnd_Enter
85 {
86    void        *data;
87    int          x, y;
88    Ecore_X_Atom action;
89 };
90
91 struct _E_Event_Dnd_Move
92 {
93    int          x, y;
94    Ecore_X_Atom action;
95 };
96
97 struct _E_Event_Dnd_Leave
98 {
99    int x, y;
100 };
101
102 struct _E_Event_Dnd_Drop
103 {
104    void *data;
105    int   x, y;
106 };
107
108 EINTERN int          e_dnd_init(void);
109 EINTERN int          e_dnd_shutdown(void);
110
111 EAPI int             e_dnd_active(void);
112
113 /* x and y are the top left coords of the object that is to be dragged */
114 EAPI E_Drag         *e_drag_new(E_Container *container, int x, int y,
115                                 const char **types, unsigned int num_types,
116                                 void *data, int size,
117                                 void *(*convert_cb)(E_Drag * drag, const char *type),
118                                 void (*finished_cb)(E_Drag *drag, int dropped));
119 EAPI Evas           *e_drag_evas_get(const E_Drag *drag);
120 EAPI void            e_drag_object_set(E_Drag *drag, Evas_Object *object);
121 EAPI void            e_drag_move(E_Drag *drag, int x, int y);
122 EAPI void            e_drag_resize(E_Drag *drag, int w, int h);
123 EAPI void            e_drag_idler_before(void);
124 EAPI void            e_drag_key_down_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_Event_Key *e));
125 EAPI void            e_drag_key_up_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_Event_Key *e));
126
127 /* x and y are the coords where the mouse is when dragging starts */
128 EAPI int             e_drag_start(E_Drag *drag, int x, int y);
129 EAPI int             e_drag_xdnd_start(E_Drag *drag, int x, int y);
130
131 EAPI void e_drop_xds_update(Eina_Bool enable, const char *value);
132 EAPI void e_drop_handler_xds_set(E_Drop_Handler *handler, Ecore_Task_Cb cb);
133 EAPI E_Drop_Handler *e_drop_handler_add(E_Object *obj,
134                                         void *data,
135                                         void (*enter_cb)(void *data, const char *type, void *event),
136                                         void (*move_cb)(void *data, const char *type, void *event),
137                                         void (*leave_cb)(void *data, const char *type, void *event),
138                                         void (*drop_cb)(void *data, const char *type, void *event),
139                                         const char **types, unsigned int num_types,
140                                         int x, int y, int w, int h);
141 EAPI void         e_drop_handler_geometry_set(E_Drop_Handler *handler, int x, int y, int w, int h);
142 EAPI int          e_drop_inside(const E_Drop_Handler *handler, int x, int y);
143 EAPI void         e_drop_handler_del(E_Drop_Handler *handler);
144 EAPI int          e_drop_xdnd_register_set(Ecore_X_Window win, int reg);
145 EAPI void         e_drop_handler_responsive_set(E_Drop_Handler *handler);
146 EAPI int          e_drop_handler_responsive_get(const E_Drop_Handler *handler);
147 EAPI void         e_drop_handler_action_set(Ecore_X_Atom action);
148 EAPI Ecore_X_Atom e_drop_handler_action_get(void);
149
150 #endif
151 #endif
152
153 #ifndef MIN
154 # define MIN(x, y) (((x) > (y)) ? (y) : (x))
155 #endif