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