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