1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gdk.DragContext;
26 
27 private import gdk.Device;
28 private import gdk.Screen;
29 private import gdk.Window;
30 private import glib.ListG;
31 private import gobject.ObjectG;
32 private import gobject.Signals;
33 private import gtkc.gdk;
34 public  import gtkc.gdktypes;
35 private import std.algorithm;
36 
37 
38 /** */
39 public class DragContext : ObjectG
40 {
41 	/** the main Gtk struct */
42 	protected GdkDragContext* gdkDragContext;
43 
44 	/** Get the main Gtk struct */
45 	public GdkDragContext* getDragContextStruct()
46 	{
47 		return gdkDragContext;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)gdkDragContext;
54 	}
55 
56 	protected override void setStruct(GObject* obj)
57 	{
58 		gdkDragContext = cast(GdkDragContext*)obj;
59 		super.setStruct(obj);
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GdkDragContext* gdkDragContext, bool ownedRef = false)
66 	{
67 		this.gdkDragContext = gdkDragContext;
68 		super(cast(GObject*)gdkDragContext, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return gdk_drag_context_get_type();
76 	}
77 
78 	/**
79 	 * Determines the bitmask of actions proposed by the source if
80 	 * gdk_drag_context_get_suggested_action() returns %GDK_ACTION_ASK.
81 	 *
82 	 * Returns: the #GdkDragAction flags
83 	 *
84 	 * Since: 2.22
85 	 */
86 	public GdkDragAction getActions()
87 	{
88 		return gdk_drag_context_get_actions(gdkDragContext);
89 	}
90 
91 	/**
92 	 * Returns the destination windw for the DND operation.
93 	 *
94 	 * Returns: a #GdkWindow
95 	 *
96 	 * Since: 3.0
97 	 */
98 	public Window getDestWindow()
99 	{
100 		auto p = gdk_drag_context_get_dest_window(gdkDragContext);
101 		
102 		if(p is null)
103 		{
104 			return null;
105 		}
106 		
107 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
108 	}
109 
110 	/**
111 	 * Returns the #GdkDevice associated to the drag context.
112 	 *
113 	 * Returns: The #GdkDevice associated to @context.
114 	 */
115 	public Device getDevice()
116 	{
117 		auto p = gdk_drag_context_get_device(gdkDragContext);
118 		
119 		if(p is null)
120 		{
121 			return null;
122 		}
123 		
124 		return ObjectG.getDObject!(Device)(cast(GdkDevice*) p);
125 	}
126 
127 	/**
128 	 * Returns the window on which the drag icon should be rendered
129 	 * during the drag operation. Note that the window may not be
130 	 * available until the drag operation has begun. GDK will move
131 	 * the window in accordance with the ongoing drag operation.
132 	 * The window is owned by @context and will be destroyed when
133 	 * the drag operation is over.
134 	 *
135 	 * Returns: the drag window, or %NULL
136 	 *
137 	 * Since: 3.20
138 	 */
139 	public Window getDragWindow()
140 	{
141 		auto p = gdk_drag_context_get_drag_window(gdkDragContext);
142 		
143 		if(p is null)
144 		{
145 			return null;
146 		}
147 		
148 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
149 	}
150 
151 	/**
152 	 * Returns the drag protocol thats used by this context.
153 	 *
154 	 * Returns: the drag protocol
155 	 *
156 	 * Since: 3.0
157 	 */
158 	public GdkDragProtocol getProtocol()
159 	{
160 		return gdk_drag_context_get_protocol(gdkDragContext);
161 	}
162 
163 	/**
164 	 * Determines the action chosen by the drag destination.
165 	 *
166 	 * Returns: a #GdkDragAction value
167 	 *
168 	 * Since: 2.22
169 	 */
170 	public GdkDragAction getSelectedAction()
171 	{
172 		return gdk_drag_context_get_selected_action(gdkDragContext);
173 	}
174 
175 	/**
176 	 * Returns the #GdkWindow where the DND operation started.
177 	 *
178 	 * Returns: a #GdkWindow
179 	 *
180 	 * Since: 2.22
181 	 */
182 	public Window getSourceWindow()
183 	{
184 		auto p = gdk_drag_context_get_source_window(gdkDragContext);
185 		
186 		if(p is null)
187 		{
188 			return null;
189 		}
190 		
191 		return ObjectG.getDObject!(Window)(cast(GdkWindow*) p);
192 	}
193 
194 	/**
195 	 * Determines the suggested drag action of the context.
196 	 *
197 	 * Returns: a #GdkDragAction value
198 	 *
199 	 * Since: 2.22
200 	 */
201 	public GdkDragAction getSuggestedAction()
202 	{
203 		return gdk_drag_context_get_suggested_action(gdkDragContext);
204 	}
205 
206 	/**
207 	 * Retrieves the list of targets of the context.
208 	 *
209 	 * Returns: a #GList of targets
210 	 *
211 	 * Since: 2.22
212 	 */
213 	public ListG listTargets()
214 	{
215 		auto p = gdk_drag_context_list_targets(gdkDragContext);
216 		
217 		if(p is null)
218 		{
219 			return null;
220 		}
221 		
222 		return new ListG(cast(GList*) p);
223 	}
224 
225 	/**
226 	 * Requests the drag and drop operation to be managed by @context.
227 	 * When a drag and drop operation becomes managed, the #GdkDragContext
228 	 * will internally handle all input and source-side #GdkEventDND events
229 	 * as required by the windowing system.
230 	 *
231 	 * Once the drag and drop operation is managed, the drag context will
232 	 * emit the following signals:
233 	 * - The #GdkDragContext::action-changed signal whenever the final action
234 	 * to be performed by the drag and drop operation changes.
235 	 * - The #GdkDragContext::drop-performed signal after the user performs
236 	 * the drag and drop gesture (typically by releasing the mouse button).
237 	 * - The #GdkDragContext::dnd-finished signal after the drag and drop
238 	 * operation concludes (after all #GdkSelection transfers happen).
239 	 * - The #GdkDragContext::cancel signal if the drag and drop operation is
240 	 * finished but doesn't happen over an accepting destination, or is
241 	 * cancelled through other means.
242 	 *
243 	 * Params:
244 	 *     ipcWindow = Window to use for IPC messaging/events
245 	 *     actions = the actions supported by the drag source
246 	 *
247 	 * Returns: #TRUE if the drag and drop operation is managed.
248 	 *
249 	 * Since: 3.20
250 	 */
251 	public bool manageDnd(Window ipcWindow, GdkDragAction actions)
252 	{
253 		return gdk_drag_context_manage_dnd(gdkDragContext, (ipcWindow is null) ? null : ipcWindow.getWindowStruct(), actions) != 0;
254 	}
255 
256 	/**
257 	 * Associates a #GdkDevice to @context, so all Drag and Drop events
258 	 * for @context are emitted as if they came from this device.
259 	 *
260 	 * Params:
261 	 *     device = a #GdkDevice
262 	 */
263 	public void setDevice(Device device)
264 	{
265 		gdk_drag_context_set_device(gdkDragContext, (device is null) ? null : device.getDeviceStruct());
266 	}
267 
268 	/**
269 	 * Sets the position of the drag window that will be kept
270 	 * under the cursor hotspot. Initially, the hotspot is at the
271 	 * top left corner of the drag window.
272 	 *
273 	 * Params:
274 	 *     hotX = x coordinate of the drag window hotspot
275 	 *     hotY = y coordinate of the drag window hotspot
276 	 *
277 	 * Since: 3.20
278 	 */
279 	public void setHotspot(int hotX, int hotY)
280 	{
281 		gdk_drag_context_set_hotspot(gdkDragContext, hotX, hotY);
282 	}
283 
284 	protected class OnActionChangedDelegateWrapper
285 	{
286 		static OnActionChangedDelegateWrapper[] listeners;
287 		void delegate(GdkDragAction, DragContext) dlg;
288 		gulong handlerId;
289 		
290 		this(void delegate(GdkDragAction, DragContext) dlg)
291 		{
292 			this.dlg = dlg;
293 			this.listeners ~= this;
294 		}
295 		
296 		void remove(OnActionChangedDelegateWrapper source)
297 		{
298 			foreach(index, wrapper; listeners)
299 			{
300 				if (wrapper.handlerId == source.handlerId)
301 				{
302 					listeners[index] = null;
303 					listeners = std.algorithm.remove(listeners, index);
304 					break;
305 				}
306 			}
307 		}
308 	}
309 
310 	/**
311 	 * A new action is being chosen for the drag and drop operation.
312 	 *
313 	 * This signal will only be emitted if the #GdkDragContext manages
314 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
315 	 * for more information.
316 	 *
317 	 * Params:
318 	 *     action = The action currently chosen
319 	 *
320 	 * Since: 3.20
321 	 */
322 	gulong addOnActionChanged(void delegate(GdkDragAction, DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
323 	{
324 		auto wrapper = new OnActionChangedDelegateWrapper(dlg);
325 		wrapper.handlerId = Signals.connectData(
326 			this,
327 			"action-changed",
328 			cast(GCallback)&callBackActionChanged,
329 			cast(void*)wrapper,
330 			cast(GClosureNotify)&callBackActionChangedDestroy,
331 			connectFlags);
332 		return wrapper.handlerId;
333 	}
334 	
335 	extern(C) static void callBackActionChanged(GdkDragContext* dragcontextStruct, GdkDragAction action, OnActionChangedDelegateWrapper wrapper)
336 	{
337 		wrapper.dlg(action, wrapper.outer);
338 	}
339 	
340 	extern(C) static void callBackActionChangedDestroy(OnActionChangedDelegateWrapper wrapper, GClosure* closure)
341 	{
342 		wrapper.remove(wrapper);
343 	}
344 
345 	protected class OnCancelDelegateWrapper
346 	{
347 		static OnCancelDelegateWrapper[] listeners;
348 		void delegate(GdkDragCancelReason, DragContext) dlg;
349 		gulong handlerId;
350 		
351 		this(void delegate(GdkDragCancelReason, DragContext) dlg)
352 		{
353 			this.dlg = dlg;
354 			this.listeners ~= this;
355 		}
356 		
357 		void remove(OnCancelDelegateWrapper source)
358 		{
359 			foreach(index, wrapper; listeners)
360 			{
361 				if (wrapper.handlerId == source.handlerId)
362 				{
363 					listeners[index] = null;
364 					listeners = std.algorithm.remove(listeners, index);
365 					break;
366 				}
367 			}
368 		}
369 	}
370 
371 	/**
372 	 * The drag and drop operation was cancelled.
373 	 *
374 	 * This signal will only be emitted if the #GdkDragContext manages
375 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
376 	 * for more information.
377 	 *
378 	 * Params:
379 	 *     reason = The reason the context was cancelled
380 	 *
381 	 * Since: 3.20
382 	 */
383 	gulong addOnCancel(void delegate(GdkDragCancelReason, DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
384 	{
385 		auto wrapper = new OnCancelDelegateWrapper(dlg);
386 		wrapper.handlerId = Signals.connectData(
387 			this,
388 			"cancel",
389 			cast(GCallback)&callBackCancel,
390 			cast(void*)wrapper,
391 			cast(GClosureNotify)&callBackCancelDestroy,
392 			connectFlags);
393 		return wrapper.handlerId;
394 	}
395 	
396 	extern(C) static void callBackCancel(GdkDragContext* dragcontextStruct, GdkDragCancelReason reason, OnCancelDelegateWrapper wrapper)
397 	{
398 		wrapper.dlg(reason, wrapper.outer);
399 	}
400 	
401 	extern(C) static void callBackCancelDestroy(OnCancelDelegateWrapper wrapper, GClosure* closure)
402 	{
403 		wrapper.remove(wrapper);
404 	}
405 
406 	protected class OnDndFinishedDelegateWrapper
407 	{
408 		static OnDndFinishedDelegateWrapper[] listeners;
409 		void delegate(DragContext) dlg;
410 		gulong handlerId;
411 		
412 		this(void delegate(DragContext) dlg)
413 		{
414 			this.dlg = dlg;
415 			this.listeners ~= this;
416 		}
417 		
418 		void remove(OnDndFinishedDelegateWrapper source)
419 		{
420 			foreach(index, wrapper; listeners)
421 			{
422 				if (wrapper.handlerId == source.handlerId)
423 				{
424 					listeners[index] = null;
425 					listeners = std.algorithm.remove(listeners, index);
426 					break;
427 				}
428 			}
429 		}
430 	}
431 
432 	/**
433 	 * The drag and drop operation was finished, the drag destination
434 	 * finished reading all data. The drag source can now free all
435 	 * miscellaneous data.
436 	 *
437 	 * This signal will only be emitted if the #GdkDragContext manages
438 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
439 	 * for more information.
440 	 *
441 	 * Since: 3.20
442 	 */
443 	gulong addOnDndFinished(void delegate(DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
444 	{
445 		auto wrapper = new OnDndFinishedDelegateWrapper(dlg);
446 		wrapper.handlerId = Signals.connectData(
447 			this,
448 			"dnd-finished",
449 			cast(GCallback)&callBackDndFinished,
450 			cast(void*)wrapper,
451 			cast(GClosureNotify)&callBackDndFinishedDestroy,
452 			connectFlags);
453 		return wrapper.handlerId;
454 	}
455 	
456 	extern(C) static void callBackDndFinished(GdkDragContext* dragcontextStruct, OnDndFinishedDelegateWrapper wrapper)
457 	{
458 		wrapper.dlg(wrapper.outer);
459 	}
460 	
461 	extern(C) static void callBackDndFinishedDestroy(OnDndFinishedDelegateWrapper wrapper, GClosure* closure)
462 	{
463 		wrapper.remove(wrapper);
464 	}
465 
466 	protected class OnDropPerformedDelegateWrapper
467 	{
468 		static OnDropPerformedDelegateWrapper[] listeners;
469 		void delegate(int, DragContext) dlg;
470 		gulong handlerId;
471 		
472 		this(void delegate(int, DragContext) dlg)
473 		{
474 			this.dlg = dlg;
475 			this.listeners ~= this;
476 		}
477 		
478 		void remove(OnDropPerformedDelegateWrapper source)
479 		{
480 			foreach(index, wrapper; listeners)
481 			{
482 				if (wrapper.handlerId == source.handlerId)
483 				{
484 					listeners[index] = null;
485 					listeners = std.algorithm.remove(listeners, index);
486 					break;
487 				}
488 			}
489 		}
490 	}
491 
492 	/**
493 	 * The drag and drop operation was performed on an accepting client.
494 	 *
495 	 * This signal will only be emitted if the #GdkDragContext manages
496 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
497 	 * for more information.
498 	 *
499 	 * Params:
500 	 *     time = the time at which the drop happened.
501 	 *
502 	 * Since: 3.20
503 	 */
504 	gulong addOnDropPerformed(void delegate(int, DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
505 	{
506 		auto wrapper = new OnDropPerformedDelegateWrapper(dlg);
507 		wrapper.handlerId = Signals.connectData(
508 			this,
509 			"drop-performed",
510 			cast(GCallback)&callBackDropPerformed,
511 			cast(void*)wrapper,
512 			cast(GClosureNotify)&callBackDropPerformedDestroy,
513 			connectFlags);
514 		return wrapper.handlerId;
515 	}
516 	
517 	extern(C) static void callBackDropPerformed(GdkDragContext* dragcontextStruct, int time, OnDropPerformedDelegateWrapper wrapper)
518 	{
519 		wrapper.dlg(time, wrapper.outer);
520 	}
521 	
522 	extern(C) static void callBackDropPerformedDestroy(OnDropPerformedDelegateWrapper wrapper, GClosure* closure)
523 	{
524 		wrapper.remove(wrapper);
525 	}
526 
527 	/**
528 	 * Aborts a drag without dropping.
529 	 *
530 	 * This function is called by the drag source.
531 	 *
532 	 * This function does not need to be called in managed drag and drop
533 	 * operations. See gdk_drag_context_manage_dnd() for more information.
534 	 *
535 	 * Params:
536 	 *     context = a #GdkDragContext
537 	 *     time = the timestamp for this operation
538 	 */
539 	public static void dragAbort(DragContext context, uint time)
540 	{
541 		gdk_drag_abort((context is null) ? null : context.getDragContextStruct(), time);
542 	}
543 
544 	/**
545 	 * Starts a drag and creates a new drag context for it.
546 	 * This function assumes that the drag is controlled by the
547 	 * client pointer device, use gdk_drag_begin_for_device() to
548 	 * begin a drag with a different device.
549 	 *
550 	 * This function is called by the drag source.
551 	 *
552 	 * Params:
553 	 *     window = the source window for this drag.
554 	 *     targets = the offered targets,
555 	 *         as list of #GdkAtoms
556 	 *
557 	 * Returns: a newly created #GdkDragContext
558 	 */
559 	public static DragContext dragBegin(Window window, ListG targets)
560 	{
561 		auto p = gdk_drag_begin((window is null) ? null : window.getWindowStruct(), (targets is null) ? null : targets.getListGStruct());
562 		
563 		if(p is null)
564 		{
565 			return null;
566 		}
567 		
568 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p, true);
569 	}
570 
571 	/**
572 	 * Starts a drag and creates a new drag context for it.
573 	 *
574 	 * This function is called by the drag source.
575 	 *
576 	 * Params:
577 	 *     window = the source window for this drag
578 	 *     device = the device that controls this drag
579 	 *     targets = the offered targets,
580 	 *         as list of #GdkAtoms
581 	 *
582 	 * Returns: a newly created #GdkDragContext
583 	 */
584 	public static DragContext dragBeginForDevice(Window window, Device device, ListG targets)
585 	{
586 		auto p = gdk_drag_begin_for_device((window is null) ? null : window.getWindowStruct(), (device is null) ? null : device.getDeviceStruct(), (targets is null) ? null : targets.getListGStruct());
587 		
588 		if(p is null)
589 		{
590 			return null;
591 		}
592 		
593 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p, true);
594 	}
595 
596 	/**
597 	 * Starts a drag and creates a new drag context for it.
598 	 *
599 	 * This function is called by the drag source.
600 	 *
601 	 * Params:
602 	 *     window = the source window for this drag
603 	 *     device = the device that controls this drag
604 	 *     targets = the offered targets,
605 	 *         as list of #GdkAtoms
606 	 *     xRoot = the x coordinate where the drag nominally started
607 	 *     yRoot = the y coordinate where the drag nominally started
608 	 *
609 	 * Returns: a newly created #GdkDragContext
610 	 *
611 	 * Since: 3.20
612 	 */
613 	public static DragContext dragBeginFromPoint(Window window, Device device, ListG targets, int xRoot, int yRoot)
614 	{
615 		auto p = gdk_drag_begin_from_point((window is null) ? null : window.getWindowStruct(), (device is null) ? null : device.getDeviceStruct(), (targets is null) ? null : targets.getListGStruct(), xRoot, yRoot);
616 		
617 		if(p is null)
618 		{
619 			return null;
620 		}
621 		
622 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p, true);
623 	}
624 
625 	/**
626 	 * Drops on the current destination.
627 	 *
628 	 * This function is called by the drag source.
629 	 *
630 	 * This function does not need to be called in managed drag and drop
631 	 * operations. See gdk_drag_context_manage_dnd() for more information.
632 	 *
633 	 * Params:
634 	 *     context = a #GdkDragContext
635 	 *     time = the timestamp for this operation
636 	 */
637 	public static void dragDrop(DragContext context, uint time)
638 	{
639 		gdk_drag_drop((context is null) ? null : context.getDragContextStruct(), time);
640 	}
641 
642 	/**
643 	 * Inform GDK if the drop ended successfully. Passing %FALSE
644 	 * for @success may trigger a drag cancellation animation.
645 	 *
646 	 * This function is called by the drag source, and should
647 	 * be the last call before dropping the reference to the
648 	 * @context.
649 	 *
650 	 * The #GdkDragContext will only take the first gdk_drag_drop_done()
651 	 * call as effective, if this function is called multiple times,
652 	 * all subsequent calls will be ignored.
653 	 *
654 	 * Params:
655 	 *     context = a #GdkDragContext
656 	 *     success = whether the drag was ultimatively successful
657 	 *
658 	 * Since: 3.20
659 	 */
660 	public static void dragDropDone(DragContext context, bool success)
661 	{
662 		gdk_drag_drop_done((context is null) ? null : context.getDragContextStruct(), success);
663 	}
664 
665 	/**
666 	 * Returns whether the dropped data has been successfully
667 	 * transferred. This function is intended to be used while
668 	 * handling a %GDK_DROP_FINISHED event, its return value is
669 	 * meaningless at other times.
670 	 *
671 	 * Params:
672 	 *     context = a #GdkDragContext
673 	 *
674 	 * Returns: %TRUE if the drop was successful.
675 	 *
676 	 * Since: 2.6
677 	 */
678 	public static bool dragDropSucceeded(DragContext context)
679 	{
680 		return gdk_drag_drop_succeeded((context is null) ? null : context.getDragContextStruct()) != 0;
681 	}
682 
683 	/**
684 	 * Finds the destination window and DND protocol to use at the
685 	 * given pointer position.
686 	 *
687 	 * This function is called by the drag source to obtain the
688 	 * @dest_window and @protocol parameters for gdk_drag_motion().
689 	 *
690 	 * Params:
691 	 *     context = a #GdkDragContext
692 	 *     dragWindow = a window which may be at the pointer position, but
693 	 *         should be ignored, since it is put up by the drag source as an icon
694 	 *     screen = the screen where the destination window is sought
695 	 *     xRoot = the x position of the pointer in root coordinates
696 	 *     yRoot = the y position of the pointer in root coordinates
697 	 *     destWindow = location to store the destination window in
698 	 *     protocol = location to store the DND protocol in
699 	 *
700 	 * Since: 2.2
701 	 */
702 	public static void dragFindWindowForScreen(DragContext context, Window dragWindow, Screen screen, int xRoot, int yRoot, out Window destWindow, out GdkDragProtocol protocol)
703 	{
704 		GdkWindow* outdestWindow = null;
705 		
706 		gdk_drag_find_window_for_screen((context is null) ? null : context.getDragContextStruct(), (dragWindow is null) ? null : dragWindow.getWindowStruct(), (screen is null) ? null : screen.getScreenStruct(), xRoot, yRoot, &outdestWindow, &protocol);
707 		
708 		destWindow = ObjectG.getDObject!(Window)(outdestWindow);
709 	}
710 
711 	/**
712 	 * Returns the selection atom for the current source window.
713 	 *
714 	 * Params:
715 	 *     context = a #GdkDragContext.
716 	 *
717 	 * Returns: the selection atom, or %GDK_NONE
718 	 */
719 	public static GdkAtom dragGetSelection(DragContext context)
720 	{
721 		return gdk_drag_get_selection((context is null) ? null : context.getDragContextStruct());
722 	}
723 
724 	/**
725 	 * Updates the drag context when the pointer moves or the
726 	 * set of actions changes.
727 	 *
728 	 * This function is called by the drag source.
729 	 *
730 	 * This function does not need to be called in managed drag and drop
731 	 * operations. See gdk_drag_context_manage_dnd() for more information.
732 	 *
733 	 * Params:
734 	 *     context = a #GdkDragContext
735 	 *     destWindow = the new destination window, obtained by
736 	 *         gdk_drag_find_window()
737 	 *     protocol = the DND protocol in use, obtained by gdk_drag_find_window()
738 	 *     xRoot = the x position of the pointer in root coordinates
739 	 *     yRoot = the y position of the pointer in root coordinates
740 	 *     suggestedAction = the suggested action
741 	 *     possibleActions = the possible actions
742 	 *     time = the timestamp for this operation
743 	 */
744 	public static bool dragMotion(DragContext context, Window destWindow, GdkDragProtocol protocol, int xRoot, int yRoot, GdkDragAction suggestedAction, GdkDragAction possibleActions, uint time)
745 	{
746 		return gdk_drag_motion((context is null) ? null : context.getDragContextStruct(), (destWindow is null) ? null : destWindow.getWindowStruct(), protocol, xRoot, yRoot, suggestedAction, possibleActions, time) != 0;
747 	}
748 
749 	/**
750 	 * Selects one of the actions offered by the drag source.
751 	 *
752 	 * This function is called by the drag destination in response to
753 	 * gdk_drag_motion() called by the drag source.
754 	 *
755 	 * Params:
756 	 *     context = a #GdkDragContext
757 	 *     action = the selected action which will be taken when a drop happens,
758 	 *         or 0 to indicate that a drop will not be accepted
759 	 *     time = the timestamp for this operation
760 	 */
761 	public static void dragStatus(DragContext context, GdkDragAction action, uint time)
762 	{
763 		gdk_drag_status((context is null) ? null : context.getDragContextStruct(), action, time);
764 	}
765 
766 	/**
767 	 * Ends the drag operation after a drop.
768 	 *
769 	 * This function is called by the drag destination.
770 	 *
771 	 * Params:
772 	 *     context = a #GdkDragContext
773 	 *     success = %TRUE if the data was successfully received
774 	 *     time = the timestamp for this operation
775 	 */
776 	public static void dropFinish(DragContext context, bool success, uint time)
777 	{
778 		gdk_drop_finish((context is null) ? null : context.getDragContextStruct(), success, time);
779 	}
780 
781 	/**
782 	 * Accepts or rejects a drop.
783 	 *
784 	 * This function is called by the drag destination in response
785 	 * to a drop initiated by the drag source.
786 	 *
787 	 * Params:
788 	 *     context = a #GdkDragContext
789 	 *     accepted = %TRUE if the drop is accepted
790 	 *     time = the timestamp for this operation
791 	 */
792 	public static void dropReply(DragContext context, bool accepted, uint time)
793 	{
794 		gdk_drop_reply((context is null) ? null : context.getDragContextStruct(), accepted, time);
795 	}
796 }