summaryrefslogtreecommitdiff
path: root/efl/elementary
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-12-09 20:54:07 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2015-12-09 20:58:06 +0200
commit453c2a123c61c91d4af37c66e212ded6437e7796 (patch)
tree446b53cc9b1cfef7e092561002770fccb32585b2 /efl/elementary
parent8e7616c1b39733f675590d942cb2d098f4c5a40c (diff)
Elementary: Implement drag and drop
Has some issues which we can work on later, should be API stable now.
Diffstat (limited to 'efl/elementary')
-rw-r--r--efl/elementary/cnp_callbacks.pxi176
-rw-r--r--efl/elementary/gengrid_widget.pxi162
-rw-r--r--efl/elementary/genlist_widget.pxi169
-rw-r--r--efl/elementary/object.pxi336
4 files changed, 422 insertions, 421 deletions
diff --git a/efl/elementary/cnp_callbacks.pxi b/efl/elementary/cnp_callbacks.pxi
index 2e56c95..83b4646 100644
--- a/efl/elementary/cnp_callbacks.pxi
+++ b/efl/elementary/cnp_callbacks.pxi
@@ -18,6 +18,7 @@ cdef extern from "Elementary.h":
18 ctypedef void (*Elm_Drag_Done) (void *data, Evas_Object *obj, Eina_Bool accepted) 18 ctypedef void (*Elm_Drag_Done) (void *data, Evas_Object *obj, Eina_Bool accepted)
19 ctypedef void (*Elm_Drag_Accept) (void *data, Evas_Object *obj, Eina_Bool doaccept) 19 ctypedef void (*Elm_Drag_Accept) (void *data, Evas_Object *obj, Eina_Bool doaccept)
20 ctypedef void (*Elm_Drag_Pos) (void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action) 20 ctypedef void (*Elm_Drag_Pos) (void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action)
21 ctypedef void (*Elm_Drag_Start) (void *data, Evas_Object *obj)
21 ctypedef void (*Elm_Drag_Item_Container_Pos) (void *data, Evas_Object *cont, Elm_Object_Item *it, Evas_Coord x, Evas_Coord y, int xposret, int yposret, Elm_Xdnd_Action action) 22 ctypedef void (*Elm_Drag_Item_Container_Pos) (void *data, Evas_Object *cont, Elm_Object_Item *it, Evas_Coord x, Evas_Coord y, int xposret, int yposret, Elm_Xdnd_Action action)
22 ctypedef Eina_Bool (*Elm_Drop_Item_Container_Cb) (void *data, Evas_Object *obj, Elm_Object_Item *it, Elm_Selection_Data *ev, int xposret, int yposret) 23 ctypedef Eina_Bool (*Elm_Drop_Item_Container_Cb) (void *data, Evas_Object *obj, Elm_Object_Item *it, Elm_Selection_Data *ev, int xposret, int yposret)
23 24
@@ -37,30 +38,22 @@ cdef extern from "Elementary.h":
37 38
38 ctypedef _Elm_Drag_User_Info Elm_Drag_User_Info 39 ctypedef _Elm_Drag_User_Info Elm_Drag_User_Info
39 40
40 ctypedef Eina_Bool (*Elm_Item_Container_Data_Get_Cb)( 41 ctypedef Eina_Bool (*Elm_Item_Container_Data_Get_Cb)(Evas_Object *obj, Elm_Object_Item *it, Elm_Drag_User_Info *info)
41 Evas_Object *obj,
42 Elm_Object_Item *it,
43 Elm_Drag_User_Info *info)
44
45 Eina_Bool elm_drag_item_container_add(Evas_Object *obj, double tm_to_anim, double tm_to_drag, Elm_Xy_Item_Get_Cb itemgetcb, Elm_Item_Container_Data_Get_Cb data_get)
46 Eina_Bool elm_drag_item_container_del(Evas_Object *obj)
47 Eina_Bool elm_drop_item_container_add(Evas_Object *obj,
48 Elm_Sel_Format format,
49 Elm_Xy_Item_Get_Cb itemgetcb,
50 Elm_Drag_State entercb, void *enterdata,
51 Elm_Drag_State leavecb, void *leavedata,
52 Elm_Drag_Item_Container_Pos poscb, void *posdata,
53 Elm_Drop_Item_Container_Cb dropcb, void *cbdata)
54 Eina_Bool elm_drop_item_container_del(Evas_Object *obj)
55 42
56 Eina_Bool elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *buf, size_t buflen) 43 Eina_Bool elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *buf, size_t buflen)
57 Eina_Bool elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata) 44 Eina_Bool elm_cnp_selection_get(Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, Elm_Drop_Cb datacb, void *udata)
58 Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection) 45 Eina_Bool elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection)
59 void elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Selection_Loss_Cb func, const void *data) 46 void elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type selection, Elm_Selection_Loss_Cb func, const void *data)
60 # Eina_Bool elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format, Elm_Drag_State entercb, void *enterdata, Elm_Drag_State leavecb, void *leavedata, Elm_Drag_Pos poscb, void *posdata, Elm_Drop_Cb dropcb, void *cbdata) 47 Eina_Bool elm_drop_target_add(Evas_Object *obj, Elm_Sel_Format format, Elm_Drag_State entercb, void *enterdata, Elm_Drag_State leavecb, void *leavedata, Elm_Drag_Pos poscb, void *posdata, Elm_Drop_Cb dropcb, void *dropdata)
61 # Eina_Bool elm_drop_target_del(Evas_Object *obj) 48 Eina_Bool elm_drop_target_del(Evas_Object *obj, Elm_Sel_Format format, Elm_Drag_State entercb, void *enterdata, Elm_Drag_State leavecb, void *leavedata, Elm_Drag_Pos poscb, void *posdata, Elm_Drop_Cb dropcb, void *dropdata)
62 # Eina_Bool elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, Elm_Xdnd_Action action, Elm_Drag_Icon_Create_Cb createicon, void *createdata, Elm_Drag_Pos dragpos, void *dragdata, Elm_Drag_Accept acceptcb, void *acceptdata, Elm_Drag_State dragdone, void *donecbdata) 49 Eina_Bool elm_drag_start(Evas_Object *obj, Elm_Sel_Format format, const char *data, Elm_Xdnd_Action action, Elm_Drag_Icon_Create_Cb createicon, void *createdata, Elm_Drag_Pos dragpos, void *dragdata, Elm_Drag_Accept acceptcb, void *acceptdata, Elm_Drag_State dragdone, void *donecbdata)
63 # Eina_Bool elm_drag_action_set(Evas_Object *obj, Elm_Xdnd_Action action) 50 Eina_Bool elm_drag_cancel(Evas_Object *obj)
51 Eina_Bool elm_drag_action_set(Evas_Object *obj, Elm_Xdnd_Action action)
52 Eina_Bool elm_drag_item_container_add(Evas_Object *obj, double tm_to_anim, double tm_to_drag, Elm_Xy_Item_Get_Cb itemgetcb, Elm_Item_Container_Data_Get_Cb data_get)
53 Eina_Bool elm_drag_item_container_del(Evas_Object *obj)
54 Eina_Bool elm_drop_item_container_add(Evas_Object *obj, Elm_Sel_Format format, Elm_Xy_Item_Get_Cb itemgetcb, Elm_Drag_State entercb, void *enterdata, Elm_Drag_State leavecb, void *leavedata, Elm_Drag_Item_Container_Pos poscb, void *posdata, Elm_Drop_Item_Container_Cb dropcb, void *dropdata)
55 Eina_Bool elm_drop_item_container_del(Evas_Object *obj)
56
64 57
65cdef class SelectionData(object): 58cdef class SelectionData(object):
66 59
@@ -85,8 +78,8 @@ cdef class SelectionData(object):
85 78
86 property data: 79 property data:
87 def __get__(self): 80 def __get__(self):
88 # TODO: void * 81 # TODO: check if this can have anything other than text data
89 return <const char *>self.sel_data.data 82 return _ctouni(<const char *>self.sel_data.data)
90 83
91 property len: 84 property len:
92 """:type: size_t""" 85 """:type: size_t"""
@@ -104,6 +97,7 @@ cdef class SelectionData(object):
104 def __get__(self): 97 def __get__(self):
105 return self.sel_data.action 98 return self.sel_data.action
106 99
100
107cdef Eina_Bool py_elm_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *ev) with gil: 101cdef Eina_Bool py_elm_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *ev) with gil:
108 """Callback invoked when the selected data is 'dropped' at its destination. 102 """Callback invoked when the selected data is 'dropped' at its destination.
109 103
@@ -117,16 +111,18 @@ cdef Eina_Bool py_elm_drop_cb(void *data, Evas_Object *obj, Elm_Selection_Data *
117 cdef: 111 cdef:
118 SelectionData sd = SelectionData.__new__(SelectionData) 112 SelectionData sd = SelectionData.__new__(SelectionData)
119 bint ret 113 bint ret
114 evasObject o = object_from_instance(obj)
120 sd.sel_data = ev 115 sd.sel_data = ev
121 116
122 o = <object>data 117 cb_func, cb_data = <object>data
123 cb_func = o.cnp_drop_cb
124 cb_data = o.cnp_drop_data
125 118
126 ret = cb_func(o, sd, cb_data) 119 try:
120 ret = cb_func(o, sd, cb_data)
121 except Exception:
122 traceback.print_exc()
123 return 0
127 124
128 sd.sel_data = NULL 125 sd.sel_data = NULL
129
130 return ret 126 return ret
131 127
132cdef Elm_Object_Item *py_elm_xy_item_get_cb(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret) with gil: 128cdef Elm_Object_Item *py_elm_xy_item_get_cb(Evas_Object *obj, Evas_Coord x, Evas_Coord y, int *xposret, int *yposret) with gil:
@@ -140,12 +136,12 @@ cdef Elm_Object_Item *py_elm_xy_item_get_cb(Evas_Object *obj, Evas_Coord x, Evas
140 :return: object under x,y cords or NULL if not found. 136 :return: object under x,y cords or NULL if not found.
141 137
142 """ 138 """
139 print("in xy_item_get_cb")
143 assert obj != NULL, "obj is NULL" 140 assert obj != NULL, "obj is NULL"
144 141
145 cdef: 142 cdef:
146 evasObject o = object_from_instance(obj) 143 evasObject o = object_from_instance(obj)
147 object xpos1, ypos1 144 object xpos1, ypos1
148 int xpos2, ypos2
149 ObjectItem it 145 ObjectItem it
150 146
151 try: 147 try:
@@ -156,13 +152,14 @@ cdef Elm_Object_Item *py_elm_xy_item_get_cb(Evas_Object *obj, Evas_Coord x, Evas
156 return NULL 152 return NULL
157 153
158 if xpos1 is not None: 154 if xpos1 is not None:
159 xpos2 = xpos1 155 xposret[0] = <int>xpos1
160 xposret[0] = xpos2
161 if ypos1 is not None: 156 if ypos1 is not None:
162 ypos2 = ypos1 157 yposret[0] = <int>ypos1
163 yposret[0] = ypos2
164 158
165 return it.item 159 if it:
160 return it.item
161 else:
162 return NULL
166 163
167cdef void py_elm_selection_loss_cb(void *data, Elm_Sel_Type selection) with gil: 164cdef void py_elm_selection_loss_cb(void *data, Elm_Sel_Type selection) with gil:
168 """Callback invoked when the selection ownership for a given selection is lost. 165 """Callback invoked when the selection ownership for a given selection is lost.
@@ -189,16 +186,14 @@ cdef Evas_Object *py_elm_drag_icon_create_cb(
189 the drag icon object relative to the source drag object 186 the drag icon object relative to the source drag object
190 :return: An object to fill the drag window with or NULL if not needed 187 :return: An object to fill the drag window with or NULL if not needed
191 188
192 .. versionadded:: 1.8
193
194 """ 189 """
190 print("in drag_icon_create_cb")
195 assert data != NULL, "data is NULL" 191 assert data != NULL, "data is NULL"
196 192
197 cdef: 193 cdef:
198 evasObject win1 = object_from_instance(win) 194 evasObject win1 = object_from_instance(win)
199 evasObject icon 195 evasObject icon
200 object xoff1 = None, yoff1 = None 196 object xoff1 = None, yoff1 = None
201 Evas_Coord xoff2, yoff2
202 197
203 createicon, createdata = <object>data 198 createicon, createdata = <object>data
204 199
@@ -219,11 +214,9 @@ cdef Evas_Object *py_elm_drag_icon_create_cb(
219 icon, xoff1, yoff1 = ret 214 icon, xoff1, yoff1 = ret
220 215
221 if xoff1 is not None: 216 if xoff1 is not None:
222 xoff2 = xoff1 217 xoff[0] = <Evas_Coord>xoff1
223 xoff[0] = xoff2
224 if yoff1 is not None: 218 if yoff1 is not None:
225 yoff2 = yoff1 219 yoff[0] = <Evas_Coord>yoff1
226 yoff[0] = yoff2
227 220
228 return icon.obj 221 return icon.obj
229 222
@@ -233,10 +226,19 @@ cdef void py_elm_drag_state_cb(void *data, Evas_Object *obj) with gil:
233 :param data: Application specific data 226 :param data: Application specific data
234 :param obj: The object where the drag started 227 :param obj: The object where the drag started
235 228
236 .. versionadded:: 1.8
237
238 """ 229 """
239 print("in drag_state_cb") 230 print("in drag_state_cb")
231 assert data != NULL, "data is NULL"
232
233 cdef:
234 evasObject o = object_from_instance(obj)
235
236 statecb, statedata = <object>data
237
238 try:
239 statecb(o, statedata)
240 except Exception:
241 traceback.print_exc()
240 242
241cdef void py_elm_drag_done_cb(void *data, Evas_Object *obj, Eina_Bool accepted) with gil: 243cdef void py_elm_drag_done_cb(void *data, Evas_Object *obj, Eina_Bool accepted) with gil:
242 """Callback called when a drag is finished. 244 """Callback called when a drag is finished.
@@ -245,9 +247,8 @@ cdef void py_elm_drag_done_cb(void *data, Evas_Object *obj, Eina_Bool accepted)
245 :param obj: The object where the drag started 247 :param obj: The object where the drag started
246 :param accepted: TRUE if the dropped-data is accepted on drop 248 :param accepted: TRUE if the dropped-data is accepted on drop
247 249
248 .. versionadded:: 1.8
249
250 """ 250 """
251 print("in drag_done_cb")
251 assert data != NULL, "data is NULL" 252 assert data != NULL, "data is NULL"
252 253
253 cdef: 254 cdef:
@@ -267,10 +268,19 @@ cdef void py_elm_drag_accept_cb(void *data, Evas_Object *obj, Eina_Bool doaccept
267 :param obj: The object where the drag started 268 :param obj: The object where the drag started
268 :param doaccept: A boolean as to if the target accepts the drag or not 269 :param doaccept: A boolean as to if the target accepts the drag or not
269 270
270 .. versionadded:: 1.8
271
272 """ 271 """
273 print("in drag_accept_cb") 272 print("in drag_accept_cb")
273 assert data != NULL, "data is NULL"
274
275 cdef:
276 evasObject o = object_from_instance(obj)
277
278 acceptcb, acceptdata = <object>data
279
280 try:
281 acceptcb(o, <bint>doaccept, acceptdata)
282 except Exception:
283 traceback.print_exc()
274 284
275cdef void py_elm_drag_pos_cb(void *data, Evas_Object *obj, 285cdef void py_elm_drag_pos_cb(void *data, Evas_Object *obj,
276 Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action) with gil: 286 Evas_Coord x, Evas_Coord y, Elm_Xdnd_Action action) with gil:
@@ -281,8 +291,6 @@ cdef void py_elm_drag_pos_cb(void *data, Evas_Object *obj,
281 :param x: The X coordinate relative to the top-left of the object 291 :param x: The X coordinate relative to the top-left of the object
282 :param y: The Y coordinate relative to the top-left of the object 292 :param y: The Y coordinate relative to the top-left of the object
283 293
284 .. versionadded:: 1.8
285
286 """ 294 """
287 print("in drag_pos_cb") 295 print("in drag_pos_cb")
288 assert data != NULL, "data is NULL" 296 assert data != NULL, "data is NULL"
@@ -314,11 +322,18 @@ cdef void py_elm_drag_item_container_pos(
314 :param yposret: Position relative to item (upper (-1), middle (0), bottom (1) 322 :param yposret: Position relative to item (upper (-1), middle (0), bottom (1)
315 :param action: The drag action to be done 323 :param action: The drag action to be done
316 324
317 .. versionadded:: 1.8
318
319 """ 325 """
320 print("in drag_item_container_pos") 326 print("in drag_item_container_pos")
321 327
328 cdef:
329 evasObject o = object_from_instance(cont)
330 ObjectItem item = _object_item_to_python(it)
331
332 try:
333 o.data["drag_item_container_pos"](o, item, x, y, xposret, yposret, action, <object>data if data is not NULL else None)
334 except Exception:
335 traceback.print_exc()
336
322cdef Eina_Bool py_elm_drop_item_container_cb( 337cdef Eina_Bool py_elm_drop_item_container_cb(
323 void *data, Evas_Object *obj, Elm_Object_Item *it, 338 void *data, Evas_Object *obj, Elm_Object_Item *it,
324 Elm_Selection_Data *ev, int xposret, int yposret) with gil: 339 Elm_Selection_Data *ev, int xposret, int yposret) with gil:
@@ -334,14 +349,17 @@ cdef Eina_Bool py_elm_drop_item_container_cb(
334 :param yposret: Position relative to item (upper (-1), middle (0), bottom (1) 349 :param yposret: Position relative to item (upper (-1), middle (0), bottom (1)
335 350
336 """ 351 """
352 print("in drop_item_container_cb")
337 assert obj != NULL, "obj is NULL" 353 assert obj != NULL, "obj is NULL"
338 354
339 cdef: 355 cdef:
340 evasObject o = object_from_instance(obj) 356 evasObject o = object_from_instance(obj)
341 ObjectItem item = _object_item_to_python(it) 357 ObjectItem item
342 SelectionData evdata = SelectionData.__new__(SelectionData) 358 SelectionData evdata = SelectionData.__new__(SelectionData)
343 object cbdata = None 359 object cbdata = None
344 360
361 item = _object_item_to_python(it)
362
345 evdata.sel_data = ev 363 evdata.sel_data = ev
346 364
347 cb = o.data["drop_item_container_cb"] 365 cb = o.data["drop_item_container_cb"]
@@ -355,6 +373,9 @@ cdef Eina_Bool py_elm_drop_item_container_cb(
355 traceback.print_exc() 373 traceback.print_exc()
356 return 0 374 return 0
357 375
376 return ret
377
378
358cdef class DragUserInfo(object): 379cdef class DragUserInfo(object):
359 """ 380 """
360 381
@@ -376,6 +397,18 @@ cdef class DragUserInfo(object):
376 :param donecbdata: Application data to pass to @p dragdone (output) 397 :param donecbdata: Application data to pass to @p dragdone (output)
377 398
378 """ 399 """
400 # Elm_Sel_Format format;
401 # const char *data;
402 # Eina_List *icons;
403 # Elm_Xdnd_Action action;
404 # Elm_Drag_Icon_Create_Cb createicon;
405 # void *createdata;
406 # Elm_Drag_Pos dragpos;
407 # void *dragdata;
408 # Elm_Drag_Accept acceptcb;
409 # void *acceptdata;
410 # Elm_Drag_Done dragdone;
411 # void *donecbdata;
379 cdef: 412 cdef:
380 public Elm_Sel_Format format 413 public Elm_Sel_Format format
381 public Elm_Xdnd_Action action 414 public Elm_Xdnd_Action action
@@ -392,19 +425,6 @@ cdef class DragUserInfo(object):
392 if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value) 425 if isinstance(value, unicode): value = PyUnicode_AsUTF8String(value)
393 self._data = value 426 self._data = value
394 427
395 # Elm_Sel_Format format;
396 # const char *data;
397 # Eina_List *icons;
398 # Elm_Xdnd_Action action;
399 # Elm_Drag_Icon_Create_Cb createicon;
400 # void *createdata;
401 # Elm_Drag_Pos dragpos;
402 # void *dragdata;
403 # Elm_Drag_Accept acceptcb;
404 # void *acceptdata;
405 # Elm_Drag_Done dragdone;
406 # void *donecbdata;
407
408 428
409cdef Eina_Bool py_elm_item_container_data_get_cb( 429cdef Eina_Bool py_elm_item_container_data_get_cb(
410 Evas_Object *obj, Elm_Object_Item *it, Elm_Drag_User_Info *info) with gil: 430 Evas_Object *obj, Elm_Object_Item *it, Elm_Drag_User_Info *info) with gil:
@@ -418,42 +438,42 @@ cdef Eina_Bool py_elm_item_container_data_get_cb(
418 438
419 """ 439 """
420 cdef: 440 cdef:
421 DragUserInfo ret = DragUserInfo.__new__(DragUserInfo) 441 DragUserInfo pyinfo = DragUserInfo.__new__(DragUserInfo)
422 evasObject o = object_from_instance(obj) 442 evasObject o = object_from_instance(obj)
423 ObjectItem item = _object_item_to_python(it) 443 ObjectItem item = _object_item_to_python(it)
444 bint ret
424 445
425 try: 446 try:
426 func = o.data["item_container_data_get_cb"] 447 func = o.data["item_container_data_get_cb"]
427 func(o, item, ret) 448 ret = func(o, item, pyinfo)
428 except Exception: 449 except Exception:
429 traceback.print_exc() 450 traceback.print_exc()
430 return 0 451 return 0
431 452
432 if ret is not None: 453 if ret:
433 info.format = ret.format 454 info.format = pyinfo.format
434 info.data = ret._data 455 info.data = strdup(pyinfo._data)
435 info.icons = python_list_objects_to_eina_list(ret.icons) 456 info.icons = python_list_objects_to_eina_list(pyinfo.icons)
436 if ret.createicon is not None: 457 if pyinfo.createicon is not None:
437 info.createicon = py_elm_drag_icon_create_cb 458 info.createicon = py_elm_drag_icon_create_cb
438 createdata = (ret.createicon, ret.createdata) 459 createdata = (pyinfo.createicon, pyinfo.createdata)
439 Py_INCREF(createdata) 460 Py_INCREF(createdata)
440 info.createdata = <void *>createdata 461 info.createdata = <void *>createdata
441 if ret.dragpos is not None: 462 if pyinfo.dragpos is not None:
442 info.dragpos = py_elm_drag_pos_cb 463 info.dragpos = py_elm_drag_pos_cb
443 dragdata = (ret.dragpos, ret.dragdata) 464 dragdata = (pyinfo.dragpos, pyinfo.dragdata)
444 Py_INCREF(dragdata) 465 Py_INCREF(dragdata)
445 info.dragdata = <void *>dragdata 466 info.dragdata = <void *>dragdata
446 if ret.acceptcb is not None: 467 if pyinfo.acceptcb is not None:
447 info.acceptcb = py_elm_drag_accept_cb 468 info.acceptcb = py_elm_drag_accept_cb
448 acceptdata = (ret.acceptcb, ret.acceptdata) 469 acceptdata = (pyinfo.acceptcb, pyinfo.acceptdata)
449 Py_INCREF(acceptdata) 470 Py_INCREF(acceptdata)
450 info.acceptdata = <void *>acceptdata 471 info.acceptdata = <void *>acceptdata
451 if ret.dragdone is not None: 472 if pyinfo.dragdone is not None:
452 info.dragdone =py_elm_drag_done_cb 473 info.dragdone =py_elm_drag_done_cb
453 donecbdata = (ret.dragdone, ret.donecbdata) 474 donecbdata = (pyinfo.dragdone, pyinfo.donecbdata)
454 Py_INCREF(donecbdata) 475 Py_INCREF(donecbdata)
455 info.donecbdata = <void *>donecbdata 476 info.donecbdata = <void *>donecbdata
456 return 1 477 return 1
457 else: 478 else:
458 print("ret is None")
459 return 0 479 return 0
diff --git a/efl/elementary/gengrid_widget.pxi b/efl/elementary/gengrid_widget.pxi
index 1d6b502..e27c737 100644
--- a/efl/elementary/gengrid_widget.pxi
+++ b/efl/elementary/gengrid_widget.pxi
@@ -627,111 +627,111 @@ cdef class Gengrid(Object):
627 flags)) 627 flags))
628 628
629 # 629 #
630 # TODO: Drag and Drop 630 # Drag and Drop
631 # ============= 631 # =============
632 632
633 # def drag_item_container_add(self, 633 def drag_item_container_add(self,
634 # double tm_to_anim, double tm_to_drag, 634 double tm_to_anim, double tm_to_drag,
635 # itemgetcb = None, 635 itemgetcb = None,
636 # data_get = None): 636 data_get = None):
637 # """ 637 """
638
639 # Set a item container (list, genlist, grid) as source of drag
640
641 # :param tm_to_anim: Time period to wait before start animation.
642 # :param tm_to_drag: Time period to wait before start dragging.
643 # :param itemgetcb: Callback to get Evas object for item at (x,y)
644 # :param data_get: Callback to get drag info
645
646 # :raise RuntimeError: if setting drag source failed.
647 638
648 # :since: 1.8 639 Set a item container (list, genlist, grid) as source of drag
649 640
650 # """ 641 :param tm_to_anim: Time period to wait before start animation.
651 # if itemgetcb is not None: 642 :param tm_to_drag: Time period to wait before start dragging.
652 # if not callable(itemgetcb): 643 :param itemgetcb: Callback to get Evas object for item at (x,y)
653 # raise TypeError("itemgetcb must be callable.") 644 :param data_get: Callback to get drag info
654 # self.data["xy_item_get_cb"] = itemgetcb
655 645
656 # self.data["item_container_data_get_cb"] = data_get 646 :raise RuntimeError: if setting drag source failed.
657 647
658 # if not elm_drag_item_container_add(self.obj, 648 .. versionadded:: 1.17
659 # tm_to_anim,
660 # tm_to_drag,
661 # <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
662 # <Elm_Item_Container_Data_Get_Cb>py_elm_item_container_data_get_cb if data_get is not None else NULL):
663 # raise RuntimeError
664 649
665 # def drag_item_container_del(self): 650 """
666 # """ 651 if itemgetcb is not None:
652 if not callable(itemgetcb):
653 raise TypeError("itemgetcb must be callable.")
654 self.data["xy_item_get_cb"] = itemgetcb
667 655
668 # Deletes a item container from drag-source list 656 self.data["item_container_data_get_cb"] = data_get
669 657
670 # :raise RuntimeError: if deleting drag source failed. 658 if not elm_drag_item_container_add(self.obj,
659 tm_to_anim,
660 tm_to_drag,
661 <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
662 <Elm_Item_Container_Data_Get_Cb>py_elm_item_container_data_get_cb if data_get is not None else NULL):
663 raise RuntimeError
671 664
672 # :since: 1.8 665 def drag_item_container_del(self):
666 """
673 667
674 # """ 668 Deletes a item container from drag-source list
675 # if not elm_drag_item_container_del(self.obj):
676 # raise RuntimeError
677 669
678 # def drop_item_container_add(self, Elm_Sel_Format format, 670 :raise RuntimeError: if deleting drag source failed.
679 # itemgetcb = None, entercb = None, enterdata = None,
680 # leavecb = None, leavedata = None,
681 # poscb = None, posdata = None, dropcb = None, cbdata = None):
682 # """
683 671
684 # Set a item container (list, genlist, grid) as target for drop. 672 .. versionadded:: 1.17
685 673
686 # :param format: The formats supported for dropping 674 """
687 # :param itemgetcb: Callback to get Evas object for item at (x,y) 675 if not elm_drag_item_container_del(self.obj):
688 # :param entercb: The function to call when the object is entered with a drag 676 raise RuntimeError
689 # :param enterdata: The application data to pass to enterdata
690 # :param leavecb: The function to call when the object is left with a drag
691 # :param leavedata: The application data to pass to leavedata
692 # :param poscb: The function to call when the object has a drag over it
693 # :param posdata: The application data to pass to posdata
694 # :param dropcb: The function to call when a drop has occurred
695 # :param cbdata: The application data to pass to dropcb
696 677
697 # :raise RuntimeError: if setting drop target failed. 678 def drop_item_container_add(self, Elm_Sel_Format format,
679 itemgetcb = None, entercb = None, enterdata = None,
680 leavecb = None, leavedata = None,
681 poscb = None, posdata = None, dropcb = None, cbdata = None):
682 """
698 683
699 # :since: 1.8 684 Set a item container (list, genlist, grid) as target for drop.
700 685
701 # """ 686 :param format: The formats supported for dropping
702 # if itemgetcb is not None: 687 :param itemgetcb: Callback to get Evas object for item at (x,y)
703 # if not callable(itemgetcb): 688 :param entercb: The function to call when the object is entered with a drag
704 # raise TypeError("itemgetcb must be callable.") 689 :param enterdata: The application data to pass to enterdata
705 # self.data["xy_item_get_cb"] = itemgetcb 690 :param leavecb: The function to call when the object is left with a drag
691 :param leavedata: The application data to pass to leavedata
692 :param poscb: The function to call when the object has a drag over it
693 :param posdata: The application data to pass to posdata
694 :param dropcb: The function to call when a drop has occurred
695 :param cbdata: The application data to pass to dropcb
706 696
707 # self.data["drag_item_container_pos"] = poscb 697 :raise RuntimeError: if setting drop target failed.
708 # self.data["drop_item_container_cb"] = dropcb
709 698
710 # if not elm_drop_item_container_add(self.obj, 699 .. versionadded:: 1.17
711 # format,
712 # <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
713 # <Elm_Drag_State>py_elm_drag_state_cb if entercb is not None else NULL,
714 # <void *>enterdata if enterdata is not None else NULL,
715 # <Elm_Drag_State>py_elm_drag_state_cb if leavecb is not None else NULL,
716 # <void *>leavedata if leavedata is not None else NULL,
717 # <Elm_Drag_Item_Container_Pos>py_elm_drag_item_container_pos if poscb is not None else NULL,
718 # <void *>posdata if posdata is not None else NULL,
719 # <Elm_Drop_Item_Container_Cb>py_elm_drop_item_container_cb if dropcb is not None else NULL,
720 # <void *>cbdata if cbdata is not None else NULL):
721 # raise RuntimeError
722 700
723 # def drop_item_container_del(self): 701 """
724 # """ 702 if itemgetcb is not None:
703 if not callable(itemgetcb):
704 raise TypeError("itemgetcb must be callable.")
705 self.data["xy_item_get_cb"] = itemgetcb
706
707 self.data["drag_item_container_pos"] = poscb
708 self.data["drop_item_container_cb"] = dropcb
709
710 if not elm_drop_item_container_add(self.obj,
711 format,
712 <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
713 <Elm_Drag_State>py_elm_drag_state_cb if entercb is not None else NULL,
714 <void *>enterdata if enterdata is not None else NULL,
715 <Elm_Drag_State>py_elm_drag_state_cb if leavecb is not None else NULL,
716 <void *>leavedata if leavedata is not None else NULL,
717 <Elm_Drag_Item_Container_Pos>py_elm_drag_item_container_pos if poscb is not None else NULL,
718 <void *>posdata if posdata is not None else NULL,
719 <Elm_Drop_Item_Container_Cb>py_elm_drop_item_container_cb if dropcb is not None else NULL,
720 <void *>cbdata if cbdata is not None else NULL):
721 raise RuntimeError
722
723 def drop_item_container_del(self):
724 """
725 725
726 # Removes a container from list of drop targets. 726 Removes a container from list of drop targets.
727 727
728 # :raise RuntimeError: if deleting drop target failed. 728 :raise RuntimeError: if deleting drop target failed.
729 729
730 # :since: 1.8 730 .. versionadded:: 1.17
731 731
732 # """ 732 """
733 # if not elm_drop_item_container_del(self.obj): 733 if not elm_drop_item_container_del(self.obj):
734 # raise RuntimeError 734 raise RuntimeError
735 735
736 736
737 737
diff --git a/efl/elementary/genlist_widget.pxi b/efl/elementary/genlist_widget.pxi
index 6b77072..9c86788 100644
--- a/efl/elementary/genlist_widget.pxi
+++ b/efl/elementary/genlist_widget.pxi
@@ -104,7 +104,7 @@ cdef class Genlist(Object):
104 def item_append(self, 104 def item_append(self,
105 GenlistItemClass item_class not None, 105 GenlistItemClass item_class not None,
106 item_data, 106 item_data,
107 GenlistItem parent_item=None, 107 ObjectItem parent_item=None,
108 int flags=ELM_GENLIST_ITEM_NONE, 108 int flags=ELM_GENLIST_ITEM_NONE,
109 func=None): 109 func=None):
110 """Append a new item (add as last row) to this genlist. 110 """Append a new item (add as last row) to this genlist.
@@ -142,7 +142,7 @@ cdef class Genlist(Object):
142 def item_prepend( self, 142 def item_prepend( self,
143 GenlistItemClass item_class not None, 143 GenlistItemClass item_class not None,
144 item_data, 144 item_data,
145 GenlistItem parent_item=None, 145 ObjectItem parent_item=None,
146 int flags=ELM_GENLIST_ITEM_NONE, 146 int flags=ELM_GENLIST_ITEM_NONE,
147 func=None): 147 func=None):
148 """Prepend a new item (add as first row) to this genlist. 148 """Prepend a new item (add as first row) to this genlist.
@@ -180,7 +180,7 @@ cdef class Genlist(Object):
180 def item_insert_before( self, 180 def item_insert_before( self,
181 GenlistItemClass item_class not None, 181 GenlistItemClass item_class not None,
182 item_data, 182 item_data,
183 GenlistItem before_item=None, 183 ObjectItem before_item=None,
184 int flags=ELM_GENLIST_ITEM_NONE, 184 int flags=ELM_GENLIST_ITEM_NONE,
185 func=None 185 func=None
186 ): 186 ):
@@ -216,7 +216,7 @@ cdef class Genlist(Object):
216 def item_insert_after( self, 216 def item_insert_after( self,
217 GenlistItemClass item_class not None, 217 GenlistItemClass item_class not None,
218 item_data, 218 item_data,
219 GenlistItem after_item=None, 219 ObjectItem after_item=None,
220 int flags=ELM_GENLIST_ITEM_NONE, 220 int flags=ELM_GENLIST_ITEM_NONE,
221 func=None 221 func=None
222 ): 222 ):
@@ -253,7 +253,7 @@ cdef class Genlist(Object):
253 GenlistItemClass item_class not None, 253 GenlistItemClass item_class not None,
254 item_data, 254 item_data,
255 comparison_func not None, 255 comparison_func not None,
256 GenlistItem parent_item=None, 256 ObjectItem parent_item=None,
257 int flags=ELM_GENLIST_ITEM_NONE, 257 int flags=ELM_GENLIST_ITEM_NONE,
258 func=None 258 func=None
259 #API XXX: *args, **kwargs 259 #API XXX: *args, **kwargs
@@ -710,111 +710,108 @@ cdef class Genlist(Object):
710 return bool(elm_genlist_focus_on_selection_get(self.obj)) 710 return bool(elm_genlist_focus_on_selection_get(self.obj))
711 711
712 # 712 #
713 # TODO: Drag and Drop 713 # Drag and Drop
714 # ============= 714 # =============
715 715
716 # def drag_item_container_add(self, 716 def drag_item_container_add(self, double tm_to_anim, double tm_to_drag, itemgetcb = None, data_get = None):
717 # double tm_to_anim, double tm_to_drag, 717 """
718 # itemgetcb = None,
719 # data_get = None):
720 # """
721
722 # Set a item container (list, genlist, grid) as source of drag
723
724 # :param tm_to_anim: Time period to wait before start animation.
725 # :param tm_to_drag: Time period to wait before start dragging.
726 # :param itemgetcb: Callback to get Evas object for item at (x,y)
727 # :param data_get: Callback to get drag info
728
729 # :raise RuntimeError: if setting drag source failed.
730 718
731 # :since: 1.8 719 Set a item container (list, genlist, grid) as source of drag
732 720
733 # """ 721 :param tm_to_anim: Time period to wait before start animation.
734 # if itemgetcb is not None: 722 :param tm_to_drag: Time period to wait before start dragging.
735 # if not callable(itemgetcb): 723 :param itemgetcb: Callback to get Evas object for item at (x,y)
736 # raise TypeError("itemgetcb must be callable.") 724 :param data_get: Callback to get drag info
737 # self.data["xy_item_get_cb"] = itemgetcb
738 725
739 # self.data["item_container_data_get_cb"] = data_get 726 :raise RuntimeError: if setting drag source failed.
740 727
741 # if not elm_drag_item_container_add(self.obj, 728 .. versionadded:: 1.17
742 # tm_to_anim,
743 # tm_to_drag,
744 # <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
745 # <Elm_Item_Container_Data_Get_Cb>py_elm_item_container_data_get_cb if data_get is not None else NULL):
746 # raise RuntimeError
747 729
748 # def drag_item_container_del(self): 730 """
749 # """ 731 if itemgetcb is not None:
732 if not callable(itemgetcb):
733 raise TypeError("itemgetcb must be callable.")
734 self.data["xy_item_get_cb"] = itemgetcb
750 735
751 # Deletes a item container from drag-source list 736 self.data["item_container_data_get_cb"] = data_get
752 737
753 # :raise RuntimeError: if deleting drag source failed. 738 if not elm_drag_item_container_add(self.obj,
739 tm_to_anim,
740 tm_to_drag,
741 <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
742 <Elm_Item_Container_Data_Get_Cb>py_elm_item_container_data_get_cb if data_get is not None else NULL):
743 raise RuntimeError
754 744
755 # :since: 1.8 745 def drag_item_container_del(self):
746 """
756 747
757 # """ 748 Deletes a item container from drag-source list
758 # if not elm_drag_item_container_del(self.obj):
759 # raise RuntimeError
760 749
761 # def drop_item_container_add(self, Elm_Sel_Format format, 750 :raise RuntimeError: if deleting drag source failed.
762 # itemgetcb = None, entercb = None, enterdata = None,
763 # leavecb = None, leavedata = None,
764 # poscb = None, posdata = None, dropcb = None, cbdata = None):
765 # """
766 751
767 # Set a item container (list, genlist, grid) as target for drop. 752 .. versionadded:: 1.17
768 753
769 # :param format: The formats supported for dropping 754 """
770 # :param itemgetcb: Callback to get Evas object for item at (x,y) 755 if not elm_drag_item_container_del(self.obj):
771 # :param entercb: The function to call when the object is entered with a drag 756 raise RuntimeError
772 # :param enterdata: The application data to pass to enterdata
773 # :param leavecb: The function to call when the object is left with a drag
774 # :param leavedata: The application data to pass to leavedata
775 # :param poscb: The function to call when the object has a drag over it
776 # :param posdata: The application data to pass to posdata
777 # :param dropcb: The function to call when a drop has occurred
778 # :param cbdata: The application data to pass to dropcb
779 757
780 # :raise RuntimeError: if setting drop target failed. 758 def drop_item_container_add(self, Elm_Sel_Format format,
759 itemgetcb = None, entercb = None, enterdata = None,
760 leavecb = None, leavedata = None,
761 poscb = None, posdata = None, dropcb = None, cbdata = None):
762 """
781 763
782 # :since: 1.8 764 Set a item container (list, genlist, grid) as target for drop.
783 765
784 # """ 766 :param format: The formats supported for dropping
785 # if itemgetcb is not None: 767 :param itemgetcb: Callback to get Evas object for item at (x,y)
786 # if not callable(itemgetcb): 768 :param entercb: The function to call when the object is entered with a drag
787 # raise TypeError("itemgetcb must be callable.") 769 :param enterdata: The application data to pass to enterdata
788 # self.data["xy_item_get_cb"] = itemgetcb 770 :param leavecb: The function to call when the object is left with a drag
771 :param leavedata: The application data to pass to leavedata
772 :param poscb: The function to call when the object has a drag over it
773 :param posdata: The application data to pass to posdata
774 :param dropcb: The function to call when a drop has occurred
775 :param cbdata: The application data to pass to dropcb
789 776
790 # self.data["drag_item_container_pos"] = poscb 777 :raise RuntimeError: if setting drop target failed.
791 # self.data["drop_item_container_cb"] = dropcb
792 778
793 # if not elm_drop_item_container_add(self.obj, 779 .. versionadded:: 1.17
794 # format,
795 # <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
796 # <Elm_Drag_State>py_elm_drag_state_cb if entercb is not None else NULL,
797 # <void *>enterdata if enterdata is not None else NULL,
798 # <Elm_Drag_State>py_elm_drag_state_cb if leavecb is not None else NULL,
799 # <void *>leavedata if leavedata is not None else NULL,
800 # <Elm_Drag_Item_Container_Pos>py_elm_drag_item_container_pos if poscb is not None else NULL,
801 # <void *>posdata if posdata is not None else NULL,
802 # <Elm_Drop_Item_Container_Cb>py_elm_drop_item_container_cb if dropcb is not None else NULL,
803 # <void *>cbdata if cbdata is not None else NULL):
804 # raise RuntimeError
805 780
806 # def drop_item_container_del(self): 781 """
807 # """ 782 if itemgetcb is not None:
783 if not callable(itemgetcb):
784 raise TypeError("itemgetcb must be callable.")
785 self.data["xy_item_get_cb"] = itemgetcb
786
787 self.data["drag_item_container_pos"] = poscb
788 self.data["drop_item_container_cb"] = dropcb
789
790 if not elm_drop_item_container_add(self.obj,
791 format,
792 <Elm_Xy_Item_Get_Cb>py_elm_xy_item_get_cb if itemgetcb is not None else NULL,
793 <Elm_Drag_State>py_elm_drag_state_cb if entercb is not None else NULL,
794 <void *>enterdata if enterdata is not None else NULL,
795 <Elm_Drag_State>py_elm_drag_state_cb if leavecb is not None else NULL,
796 <void *>leavedata if leavedata is not None else NULL,
797 <Elm_Drag_Item_Container_Pos>py_elm_drag_item_container_pos if poscb is not None else NULL,
798 <void *>posdata if posdata is not None else NULL,
799 <Elm_Drop_Item_Container_Cb>py_elm_drop_item_container_cb if dropcb is not None else NULL,
800 <void *>cbdata if cbdata is not None else NULL):
801 raise RuntimeError
802
803 def drop_item_container_del(self):
804 """
808 805
809 # Removes a container from list of drop targets. 806 Removes a container from list of drop targets.
810 807
811 # :raise RuntimeError: if deleting drop target failed. 808 :raise RuntimeError: if deleting drop target failed.
812 809
813 # :since: 1.8 810 .. versionadded:: 1.17
814 811
815 # """ 812 """
816 # if not elm_drop_item_container_del(self.obj): 813 if not elm_drop_item_container_del(self.obj):
817 # raise RuntimeError 814 raise RuntimeError
818 815
819 816
820 def callback_activated_add(self, func, *args, **kwargs): 817 def callback_activated_add(self, func, *args, **kwargs):
diff --git a/efl/elementary/object.pxi b/efl/elementary/object.pxi
index 68dc40f..27c91fb 100644
--- a/efl/elementary/object.pxi
+++ b/efl/elementary/object.pxi
@@ -895,7 +895,7 @@ cdef class Object(SmartObject):
895 895
896 """ 896 """
897 elm_object_focus_next_item_set(self.obj, next.item, direction) 897 elm_object_focus_next_item_set(self.obj, next.item, direction)
898 898
899 property focused_item: 899 property focused_item:
900 """The focused object item in an object tree. 900 """The focused object item in an object tree.
901 901
@@ -964,9 +964,9 @@ cdef class Object(SmartObject):
964 964
965 property focus_move_policy: 965 property focus_move_policy:
966 """The focus movement policy for the object. 966 """The focus movement policy for the object.
967 967
968 :type: :ref:`Elm_Focus_Move_Policy` 968 :type: :ref:`Elm_Focus_Move_Policy`
969 969
970 .. versionadded:: 1.15 970 .. versionadded:: 1.15
971 971
972 """ 972 """
@@ -990,7 +990,7 @@ cdef class Object(SmartObject):
990 be scrolled as an item. 990 be scrolled as an item.
991 991
992 :type: :ref:`Elm_Focus_Region_Show_Mode` 992 :type: :ref:`Elm_Focus_Region_Show_Mode`
993 993
994 .. versionadded:: 1.16 994 .. versionadded:: 1.16
995 995
996 """ 996 """
@@ -1324,12 +1324,12 @@ cdef class Object(SmartObject):
1324 return elm_object_tooltip_orient_get(self.obj) 1324 return elm_object_tooltip_orient_get(self.obj)
1325 def __set__(self, Elm_Tooltip_Orient orient): 1325 def __set__(self, Elm_Tooltip_Orient orient):
1326 elm_object_tooltip_orient_set(self.obj, orient) 1326 elm_object_tooltip_orient_set(self.obj, orient)
1327 1327
1328 def tooltip_orient_set(self, Elm_Tooltip_Orient orient): 1328 def tooltip_orient_set(self, Elm_Tooltip_Orient orient):
1329 elm_object_tooltip_orient_set(self.obj, orient) 1329 elm_object_tooltip_orient_set(self.obj, orient)
1330 def tooltip_orient_get(self): 1330 def tooltip_orient_get(self):
1331 return elm_object_tooltip_orient_get(self.obj) 1331 return elm_object_tooltip_orient_get(self.obj)
1332 1332
1333 property tooltip_window_mode: 1333 property tooltip_window_mode:
1334 def __get__(self): 1334 def __get__(self):
1335 return bool(elm_object_tooltip_window_mode_get(self.obj)) 1335 return bool(elm_object_tooltip_window_mode_get(self.obj))
@@ -1619,177 +1619,161 @@ cdef class Object(SmartObject):
1619 # Drag n Drop 1619 # Drag n Drop
1620 # =========== 1620 # ===========
1621 1621
1622 # def drop_target_add(self, Elm_Sel_Format format, 1622 def drop_target_add(self, Elm_Sel_Format fmt,
1623 # entercb, enterdata, leavecb, leavedata, poscb, posdata, dropcb, dropdata): 1623 entercb=None, enterdata=None, leavecb=None, leavedata=None,
1624 # """Set the given object as a target for drops for drag-and-drop 1624 poscb=None, posdata=None, dropcb=None, dropdata=None):
1625 1625 """Set the given object as a target for drops for drag-and-drop
1626 # :param format: The formats supported for dropping 1626
1627 # :param entercb: The function to call when the object is entered with a drag 1627 :param format: The formats supported for dropping
1628 # :param enterdata: The application data to pass to enterdata 1628 :param entercb: The function to call when the object is entered with a drag
1629 # :param leavecb: The function to call when the object is left with a drag 1629 :param enterdata: The application data to pass to enterdata
1630 # :param leavedata: The application data to pass to leavecb 1630 :param leavecb: The function to call when the object is left with a drag
1631 # :param poscb: The function to call when the object has a drag over it 1631 :param leavedata: The application data to pass to leavecb
1632 # :param posdata: The application data to pass to poscb 1632 :param poscb: The function to call when the object has a drag over it
1633 # :param dropcb: The function to call when a drop has occurred 1633 :param posdata: The application data to pass to poscb
1634 # :param cbdata: The application data to pass to dropcb 1634 :param dropcb: The function to call when a drop has occurred
1635 # :raise RuntimeError: if adding as drop target fails. 1635 :param cbdata: The application data to pass to dropcb
1636 1636 :raise RuntimeError: if adding as drop target fails.
1637 # :since: 1.8 1637
1638 1638 .. versionadded:: 1.17
1639 # """ 1639
1640 # if not callable(entercb) \ 1640 """
1641 # or not callable(leavecb) \ 1641 if entercb:
1642 # or not callable(poscb) \ 1642 if not callable(entercb):
1643 # or not callable(dropcb): 1643 raise TypeError("A callback passed is not callable.")
1644 # raise TypeError("A callback passed is not callable.") 1644 enter = (entercb, enterdata)
1645 1645 Py_INCREF(enter)
1646 # enter = (entercb, enterdata) 1646 if leavecb:
1647 # leave = (leavecb, leavedata) 1647 if not callable(leavecb):
1648 # pos = (poscb, posdata) 1648 raise TypeError("A callback passed is not callable.")
1649 # drop = (dropcb, dropdata) 1649 leave = (leavecb, leavedata)
1650 1650 Py_INCREF(leave)
1651 # if not elm_drop_target_add( 1651 if poscb:
1652 # self.obj, format, 1652 if not callable(poscb):
1653 # py_elm_drag_state_cb, <void *>enter, 1653 raise TypeError("A callback passed is not callable.")
1654 # py_elm_drag_state_cb, <void *>leave, 1654 pos = (poscb, posdata)
1655 # py_elm_drag_pos_cb, <void *>pos, 1655 Py_INCREF(pos)
1656 # py_elm_drop_cb, <void *>drop 1656 if dropcb:
1657 # ): 1657 if not callable(dropcb):
1658 # raise RuntimeError("Could not add drop target.") 1658 raise TypeError("A callback passed is not callable.")
1659 1659 drop = (dropcb, dropdata)
1660 # def drop_target_del(self): 1660 Py_INCREF(drop)
1661 # """Deletes the drop target status of an object 1661
1662 1662 if not elm_drop_target_add(
1663 # :raise RuntimeError: if removing drop status fails. 1663 self.obj, fmt,
1664 1664 <Elm_Drag_State>py_elm_drag_state_cb if entercb else NULL, <void *>enter if entercb else NULL,
1665 # :since: 1.8 1665 <Elm_Drag_State>py_elm_drag_state_cb if leavecb else NULL, <void *>leave if leavecb else NULL,
1666 1666 <Elm_Drag_Pos>py_elm_drag_pos_cb if poscb else NULL, <void *>pos if poscb else NULL,
1667 # """ 1667 <Elm_Drop_Cb>py_elm_drop_cb if dropcb else NULL, <void *>drop if dropcb else NULL
1668 # if not elm_drop_target_del(self.obj): 1668 ):
1669 # raise RuntimeError("Could not delete drop target status.") 1669 raise RuntimeError("Could not add drop target.")
1670 1670
1671 # def drag_start(self, Elm_Sel_Format format, 1671 def drop_target_del(self, Elm_Sel_Format fmt,
1672 # data, Elm_Xdnd_Action action, createicon, createdata, 1672 entercb, enterdata, leavecb, leavedata, poscb, posdata, dropcb, dropdata):
1673 # dragpos, dragdata, acceptcb, acceptdata, dragdone, donecbdata): 1673 """Deletes the drop target status of an object
1674 # """Begins a drag given a source object 1674
1675 1675 @param format The formats supported for dropping
1676 # :param format: The drag formats supported by the data 1676 @param entercb The function to call when the object is entered with a drag
1677 # :param data: The drag data itself (a string) 1677 @param enterdata The application data to pass to enterdata
1678 # :param action: The drag action to be done 1678 @param leavecb The function to call when the object is left with a drag
1679 # :param createicon: Function to call to create a drag object, 1679 @param leavedata The application data to pass to leavedata
1680 # or NULL if not wanted 1680 @param poscb The function to call when the object has a drag over it
1681 # :param createdata: Application data passed to ``createicon`` 1681 @param posdata The application data to pass to posdata
1682 # :param dragpos: Function called with each position of the drag, 1682 @param dropcb The function to call when a drop has occurred
1683 # x, y being screen coordinates if possible, and action being 1683 @param dropdata The application data to pass to dropcb
1684 # the current action. 1684 @return Returns @c EINA_TRUE, if successful, or @c EINA_FALSE if not.
1685 # :param dragdata: Application data passed to ``dragpos`` 1685
1686 # :param acceptcb: Function called indicating if drop target accepts 1686 .. versionadded:: 1.17
1687 # (or does not) the drop data while dragging 1687
1688 1688 """
1689 # :param acceptdata: Application data passed to ``acceptcb`` 1689 if entercb:
1690 # :param dragdone: Function to call when drag is done 1690 if not callable(entercb):
1691 # :param donecbdata: Application data to pass to ``dragdone`` 1691 raise TypeError("A callback passed is not callable.")
1692 # :raise RuntimeError: if starting drag fails. 1692 enter = (entercb, enterdata)
1693 1693 Py_INCREF(enter)
1694 # :since: 1.8 1694 if leavecb:
1695 1695 if not callable(leavecb):
1696 # """ 1696 raise TypeError("A callback passed is not callable.")
1697 # if not elm_drag_start(Evas_Object *obj, format, 1697 leave = (leavecb, leavedata)
1698 # <const char *>data, action, 1698 Py_INCREF(leave)
1699 # Elm_Drag_Icon_Create_Cb createicon, void *createdata, 1699 if poscb:
1700 # Elm_Drag_Pos dragpos, void *dragdata, 1700 if not callable(poscb):
1701 # Elm_Drag_Accept acceptcb, void *acceptdata, 1701 raise TypeError("A callback passed is not callable.")
1702 # Elm_Drag_State dragdone, void *donecbdata): 1702 pos = (poscb, posdata)
1703 # raise RuntimeError("Could not start drag.") 1703 Py_INCREF(pos)
1704 1704 if dropcb:
1705 # def drag_action_set(self, Elm_Xdnd_Action action): 1705 if not callable(dropcb):
1706 # """Changes the current drag action 1706 raise TypeError("A callback passed is not callable.")
1707 1707 drop = (dropcb, dropdata)
1708 # :param action: The drag action to be done 1708 Py_INCREF(drop)
1709 # :raise RuntimeError: if changing drag action fails. 1709
1710 1710 if not elm_drop_target_del(
1711 # :since: 1.8 1711 self.obj, fmt,
1712 1712 <Elm_Drag_State>py_elm_drag_state_cb if entercb else NULL, <void *>enter if entercb else NULL,
1713 # """ 1713 <Elm_Drag_State>py_elm_drag_state_cb if leavecb else NULL, <void *>leave if leavecb else NULL,
1714 # if not elm_drag_action_set(Evas_Object *obj, action): 1714 <Elm_Drag_Pos>py_elm_drag_pos_cb if poscb else NULL, <void *>pos if poscb else NULL,
1715 # raise RuntimeError("Could not set cnp xdnd action.") 1715 <Elm_Drop_Cb>py_elm_drop_cb if dropcb else NULL, <void *>drop if dropcb else NULL
1716 1716 ):
1717 # def drag_item_container_add(self, double tm_to_anim, double tm_to_drag, 1717 raise RuntimeError("Could not del drop target.")
1718 # itemgetcb, data_get): 1718
1719 # """ 1719 def drag_start(self, Elm_Sel_Format format,
1720 1720 data, Elm_Xdnd_Action action, createicon, createdata,
1721 # Set a item container (list, genlist, grid) as source of drag 1721 dragpos, dragdata, acceptcb, acceptdata, dragdone, donecbdata):
1722 1722 """Begins a drag given a source object
1723 # :param tm_to_anim: Time period to wait before start animation. 1723
1724 # :param tm_to_drag: Time period to wait before start dragging. 1724 :param format: The drag formats supported by the data
1725 # :param itemgetcb: Callback to get Evas_Object pointer for item at (x,y) 1725 :param data: The drag data itself (a string)
1726 # :param data_get: Callback to get drag info 1726 :param action: The drag action to be done
1727 # :return: Returns EINA_TRUE, if successful, or EINA_FALSE if not. 1727 :param createicon: Function to call to create a drag object,
1728 or NULL if not wanted
1729 :param createdata: Application data passed to ``createicon``
1730 :param dragpos: Function called with each position of the drag,
1731 x, y being screen coordinates if possible, and action being
1732 the current action.
1733 :param dragdata: Application data passed to ``dragpos``
1734 :param acceptcb: Function called indicating if drop target accepts
1735 (or does not) the drop data while dragging
1736
1737 :param acceptdata: Application data passed to ``acceptcb``
1738 :param dragdone: Function to call when drag is done
1739 :param donecbdata: Application data to pass to ``dragdone``
1740 :raise RuntimeError: if starting drag fails.
1741
1742 .. versionadded:: 1.17
1743
1744 """
1745 if not callable(createicon) \
1746 or not callable(dragpos) \
1747 or not callable(acceptcb) \
1748 or not callable(dragdone):
1749 raise TypeError("A callback passed is not callable.")
1750
1751 create = (createicon, createdata)
1752 pos = (dragpos, dragdata)
1753 accept = (acceptcb, acceptdata)
1754 done = (dragdone, donecbdata)
1755
1756 if not elm_drag_start(self.obj, format,
1757 <const char *>data, action,
1758 py_elm_drag_icon_create_cb, <void *>create,
1759 py_elm_drag_pos_cb, <void *>pos,
1760 py_elm_drag_accept_cb, <void *>accept,
1761 py_elm_drag_state_cb, <void *>done
1762 ):
1763 raise RuntimeError("Could not start drag.")
1764
1765 def drag_action_set(self, Elm_Xdnd_Action action):
1766 """Changes the current drag action
1767
1768 :param action: The drag action to be done
1769 :raise RuntimeError: if changing drag action fails.
1770
1771 .. versionadded:: 1.17
1772
1773 """
1774 if not elm_drag_action_set(self.obj, action):
1775 raise RuntimeError("Could not set cnp xdnd action.")
1728 1776
1729 # :since: 1.8
1730
1731 # """
1732 # if not elm_drag_item_container_add(self.obj, tm_to_anim, tm_to_drag,
1733 # Elm_Xy_Item_Get_Cb itemgetcb, Elm_Item_Container_Data_Get_Cb data_get):
1734 # raise RuntimeError
1735
1736 # def drag_item_container_del(self):
1737 # """
1738
1739 # Deletes a item container from drag-source list
1740
1741 # :return: Returns EINA_TRUE, if successful, or EINA_FALSE if not.
1742
1743 # :since: 1.8
1744
1745 # """
1746 # if not elm_drag_item_container_del(self.obj):
1747 # raise RuntimeError
1748
1749 # def drop_item_container_add(self, format, itemgetcb, entercb, enterdata,
1750 # leavecb, leavedata, poscb, posdata, dropcb, cbdata):
1751 # """
1752
1753 # Set a item container (list, genlist, grid) as target for drop.
1754
1755 # :param format: The formats supported for dropping
1756 # :param itemgetcb: Callback to get Evas_Object pointer for item at (x,y)
1757 # :param entercb: The function to call when the object is entered with a drag
1758 # :param enterdata: The application data to pass to enterdata
1759 # :param leavecb: The function to call when the object is left with a drag
1760 # :param leavedata: The application data to pass to leavedata
1761 # :param poscb: The function to call when the object has a drag over it
1762 # :param posdata: The application data to pass to posdata
1763 # :param dropcb: The function to call when a drop has occurred
1764 # :param cbdata: The application data to pass to dropcb
1765 # :return: Returns EINA_TRUE, if successful, or EINA_FALSE if not.
1766
1767 # :since: 1.8
1768
1769 # """
1770 # if not elm_drop_item_container_add(self.obj,
1771 # Elm_Sel_Format format,
1772 # Elm_Xy_Item_Get_Cb itemgetcb,
1773 # Elm_Drag_State entercb, void *enterdata,
1774 # Elm_Drag_State leavecb, void *leavedata,
1775 # Elm_Drag_Item_Container_Pos poscb, void *posdata,
1776 # Elm_Drop_Item_Container_Cb dropcb, void *cbdata):
1777 # raise RuntimeError
1778
1779 # def drop_item_container_del(self):
1780 # """
1781
1782 # Removes a container from list of drop targets.
1783
1784 # :param obj: The container object
1785 # :return: Returns EINA_TRUE, if successful, or EINA_FALSE if not.
1786
1787
1788 # :since: 1.8
1789
1790 # """
1791 # if not elm_drop_item_container_del(self.obj):
1792 # raise RuntimeError
1793 1777
1794 # 1778 #
1795 # Access (TODO) 1779 # Access (TODO)