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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: 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 	 * Return: #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 		void delegate(GdkDragAction, DragContext) dlg;
287 		gulong handlerId;
288 		ConnectFlags flags;
289 		this(void delegate(GdkDragAction, DragContext) dlg, gulong handlerId, ConnectFlags flags)
290 		{
291 			this.dlg = dlg;
292 			this.handlerId = handlerId;
293 			this.flags = flags;
294 		}
295 	}
296 	protected OnActionChangedDelegateWrapper[] onActionChangedListeners;
297 
298 	/**
299 	 * A new action is being chosen for the drag and drop operation.
300 	 *
301 	 * This signal will only be emitted if the #GdkDragContext manages
302 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
303 	 * for more information.
304 	 *
305 	 * Params:
306 	 *     action = The action currently chosen
307 	 *
308 	 * Since: 3.20
309 	 */
310 	gulong addOnActionChanged(void delegate(GdkDragAction, DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
311 	{
312 		onActionChangedListeners ~= new OnActionChangedDelegateWrapper(dlg, 0, connectFlags);
313 		onActionChangedListeners[onActionChangedListeners.length - 1].handlerId = Signals.connectData(
314 			this,
315 			"action-changed",
316 			cast(GCallback)&callBackActionChanged,
317 			cast(void*)onActionChangedListeners[onActionChangedListeners.length - 1],
318 			cast(GClosureNotify)&callBackActionChangedDestroy,
319 			connectFlags);
320 		return onActionChangedListeners[onActionChangedListeners.length - 1].handlerId;
321 	}
322 	
323 	extern(C) static void callBackActionChanged(GdkDragContext* dragcontextStruct, GdkDragAction action,OnActionChangedDelegateWrapper wrapper)
324 	{
325 		wrapper.dlg(action, wrapper.outer);
326 	}
327 	
328 	extern(C) static void callBackActionChangedDestroy(OnActionChangedDelegateWrapper wrapper, GClosure* closure)
329 	{
330 		wrapper.outer.internalRemoveOnActionChanged(wrapper);
331 	}
332 
333 	protected void internalRemoveOnActionChanged(OnActionChangedDelegateWrapper source)
334 	{
335 		foreach(index, wrapper; onActionChangedListeners)
336 		{
337 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
338 			{
339 				onActionChangedListeners[index] = null;
340 				onActionChangedListeners = std.algorithm.remove(onActionChangedListeners, index);
341 				break;
342 			}
343 		}
344 	}
345 	
346 
347 	protected class OnCancelDelegateWrapper
348 	{
349 		void delegate(GdkDragCancelReason, DragContext) dlg;
350 		gulong handlerId;
351 		ConnectFlags flags;
352 		this(void delegate(GdkDragCancelReason, DragContext) dlg, gulong handlerId, ConnectFlags flags)
353 		{
354 			this.dlg = dlg;
355 			this.handlerId = handlerId;
356 			this.flags = flags;
357 		}
358 	}
359 	protected OnCancelDelegateWrapper[] onCancelListeners;
360 
361 	/**
362 	 * The drag and drop operation was cancelled.
363 	 *
364 	 * This signal will only be emitted if the #GdkDragContext manages
365 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
366 	 * for more information.
367 	 *
368 	 * Params:
369 	 *     reason = The reason the context was cancelled
370 	 *
371 	 * Since: 3.20
372 	 */
373 	gulong addOnCancel(void delegate(GdkDragCancelReason, DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
374 	{
375 		onCancelListeners ~= new OnCancelDelegateWrapper(dlg, 0, connectFlags);
376 		onCancelListeners[onCancelListeners.length - 1].handlerId = Signals.connectData(
377 			this,
378 			"cancel",
379 			cast(GCallback)&callBackCancel,
380 			cast(void*)onCancelListeners[onCancelListeners.length - 1],
381 			cast(GClosureNotify)&callBackCancelDestroy,
382 			connectFlags);
383 		return onCancelListeners[onCancelListeners.length - 1].handlerId;
384 	}
385 	
386 	extern(C) static void callBackCancel(GdkDragContext* dragcontextStruct, GdkDragCancelReason reason,OnCancelDelegateWrapper wrapper)
387 	{
388 		wrapper.dlg(reason, wrapper.outer);
389 	}
390 	
391 	extern(C) static void callBackCancelDestroy(OnCancelDelegateWrapper wrapper, GClosure* closure)
392 	{
393 		wrapper.outer.internalRemoveOnCancel(wrapper);
394 	}
395 
396 	protected void internalRemoveOnCancel(OnCancelDelegateWrapper source)
397 	{
398 		foreach(index, wrapper; onCancelListeners)
399 		{
400 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
401 			{
402 				onCancelListeners[index] = null;
403 				onCancelListeners = std.algorithm.remove(onCancelListeners, index);
404 				break;
405 			}
406 		}
407 	}
408 	
409 
410 	protected class OnDndFinishedDelegateWrapper
411 	{
412 		void delegate(DragContext) dlg;
413 		gulong handlerId;
414 		ConnectFlags flags;
415 		this(void delegate(DragContext) dlg, gulong handlerId, ConnectFlags flags)
416 		{
417 			this.dlg = dlg;
418 			this.handlerId = handlerId;
419 			this.flags = flags;
420 		}
421 	}
422 	protected OnDndFinishedDelegateWrapper[] onDndFinishedListeners;
423 
424 	/**
425 	 * The drag and drop operation was finished, the drag destination
426 	 * finished reading all data. The drag source can now free all
427 	 * miscellaneous data.
428 	 *
429 	 * This signal will only be emitted if the #GdkDragContext manages
430 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
431 	 * for more information.
432 	 *
433 	 * Since: 3.20
434 	 */
435 	gulong addOnDndFinished(void delegate(DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
436 	{
437 		onDndFinishedListeners ~= new OnDndFinishedDelegateWrapper(dlg, 0, connectFlags);
438 		onDndFinishedListeners[onDndFinishedListeners.length - 1].handlerId = Signals.connectData(
439 			this,
440 			"dnd-finished",
441 			cast(GCallback)&callBackDndFinished,
442 			cast(void*)onDndFinishedListeners[onDndFinishedListeners.length - 1],
443 			cast(GClosureNotify)&callBackDndFinishedDestroy,
444 			connectFlags);
445 		return onDndFinishedListeners[onDndFinishedListeners.length - 1].handlerId;
446 	}
447 	
448 	extern(C) static void callBackDndFinished(GdkDragContext* dragcontextStruct,OnDndFinishedDelegateWrapper wrapper)
449 	{
450 		wrapper.dlg(wrapper.outer);
451 	}
452 	
453 	extern(C) static void callBackDndFinishedDestroy(OnDndFinishedDelegateWrapper wrapper, GClosure* closure)
454 	{
455 		wrapper.outer.internalRemoveOnDndFinished(wrapper);
456 	}
457 
458 	protected void internalRemoveOnDndFinished(OnDndFinishedDelegateWrapper source)
459 	{
460 		foreach(index, wrapper; onDndFinishedListeners)
461 		{
462 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
463 			{
464 				onDndFinishedListeners[index] = null;
465 				onDndFinishedListeners = std.algorithm.remove(onDndFinishedListeners, index);
466 				break;
467 			}
468 		}
469 	}
470 	
471 
472 	protected class OnDropPerformedDelegateWrapper
473 	{
474 		void delegate(int, DragContext) dlg;
475 		gulong handlerId;
476 		ConnectFlags flags;
477 		this(void delegate(int, DragContext) dlg, gulong handlerId, ConnectFlags flags)
478 		{
479 			this.dlg = dlg;
480 			this.handlerId = handlerId;
481 			this.flags = flags;
482 		}
483 	}
484 	protected OnDropPerformedDelegateWrapper[] onDropPerformedListeners;
485 
486 	/**
487 	 * The drag and drop operation was performed on an accepting client.
488 	 *
489 	 * This signal will only be emitted if the #GdkDragContext manages
490 	 * the drag and drop operation. See gdk_drag_context_manage_dnd()
491 	 * for more information.
492 	 *
493 	 * Params:
494 	 *     time = the time at which the drop happened.
495 	 *
496 	 * Since: 3.20
497 	 */
498 	gulong addOnDropPerformed(void delegate(int, DragContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
499 	{
500 		onDropPerformedListeners ~= new OnDropPerformedDelegateWrapper(dlg, 0, connectFlags);
501 		onDropPerformedListeners[onDropPerformedListeners.length - 1].handlerId = Signals.connectData(
502 			this,
503 			"drop-performed",
504 			cast(GCallback)&callBackDropPerformed,
505 			cast(void*)onDropPerformedListeners[onDropPerformedListeners.length - 1],
506 			cast(GClosureNotify)&callBackDropPerformedDestroy,
507 			connectFlags);
508 		return onDropPerformedListeners[onDropPerformedListeners.length - 1].handlerId;
509 	}
510 	
511 	extern(C) static void callBackDropPerformed(GdkDragContext* dragcontextStruct, int time,OnDropPerformedDelegateWrapper wrapper)
512 	{
513 		wrapper.dlg(time, wrapper.outer);
514 	}
515 	
516 	extern(C) static void callBackDropPerformedDestroy(OnDropPerformedDelegateWrapper wrapper, GClosure* closure)
517 	{
518 		wrapper.outer.internalRemoveOnDropPerformed(wrapper);
519 	}
520 
521 	protected void internalRemoveOnDropPerformed(OnDropPerformedDelegateWrapper source)
522 	{
523 		foreach(index, wrapper; onDropPerformedListeners)
524 		{
525 			if (wrapper.dlg == source.dlg && wrapper.flags == source.flags && wrapper.handlerId == source.handlerId)
526 			{
527 				onDropPerformedListeners[index] = null;
528 				onDropPerformedListeners = std.algorithm.remove(onDropPerformedListeners, index);
529 				break;
530 			}
531 		}
532 	}
533 	
534 
535 	/**
536 	 * Aborts a drag without dropping.
537 	 *
538 	 * This function is called by the drag source.
539 	 *
540 	 * This function does not need to be called in managed drag and drop
541 	 * operations. See gdk_drag_context_manage_dnd() for more information.
542 	 *
543 	 * Params:
544 	 *     context = a #GdkDragContext
545 	 *     time = the timestamp for this operation
546 	 */
547 	public static void dragAbort(DragContext context, uint time)
548 	{
549 		gdk_drag_abort((context is null) ? null : context.getDragContextStruct(), time);
550 	}
551 
552 	/**
553 	 * Starts a drag and creates a new drag context for it.
554 	 * This function assumes that the drag is controlled by the
555 	 * client pointer device, use gdk_drag_begin_for_device() to
556 	 * begin a drag with a different device.
557 	 *
558 	 * This function is called by the drag source.
559 	 *
560 	 * Params:
561 	 *     window = the source window for this drag.
562 	 *     targets = the offered targets,
563 	 *         as list of #GdkAtoms
564 	 *
565 	 * Return: a newly created #GdkDragContext
566 	 */
567 	public static DragContext dragBegin(Window window, ListG targets)
568 	{
569 		auto p = gdk_drag_begin((window is null) ? null : window.getWindowStruct(), (targets is null) ? null : targets.getListGStruct());
570 		
571 		if(p is null)
572 		{
573 			return null;
574 		}
575 		
576 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p, true);
577 	}
578 
579 	/**
580 	 * Starts a drag and creates a new drag context for it.
581 	 *
582 	 * This function is called by the drag source.
583 	 *
584 	 * Params:
585 	 *     window = the source window for this drag
586 	 *     device = the device that controls this drag
587 	 *     targets = the offered targets,
588 	 *         as list of #GdkAtoms
589 	 *
590 	 * Return: a newly created #GdkDragContext
591 	 */
592 	public static DragContext dragBeginForDevice(Window window, Device device, ListG targets)
593 	{
594 		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());
595 		
596 		if(p is null)
597 		{
598 			return null;
599 		}
600 		
601 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p, true);
602 	}
603 
604 	/**
605 	 * Starts a drag and creates a new drag context for it.
606 	 *
607 	 * This function is called by the drag source.
608 	 *
609 	 * Params:
610 	 *     window = the source window for this drag
611 	 *     device = the device that controls this drag
612 	 *     targets = the offered targets,
613 	 *         as list of #GdkAtoms
614 	 *     xRoot = the x coordinate where the drag nominally started
615 	 *     yRoot = the y coordinate where the drag nominally started
616 	 *
617 	 * Return: a newly created #GdkDragContext
618 	 *
619 	 * Since: 3.20
620 	 */
621 	public static DragContext dragBeginFromPoint(Window window, Device device, ListG targets, int xRoot, int yRoot)
622 	{
623 		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);
624 		
625 		if(p is null)
626 		{
627 			return null;
628 		}
629 		
630 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p, true);
631 	}
632 
633 	/**
634 	 * Drops on the current destination.
635 	 *
636 	 * This function is called by the drag source.
637 	 *
638 	 * This function does not need to be called in managed drag and drop
639 	 * operations. See gdk_drag_context_manage_dnd() for more information.
640 	 *
641 	 * Params:
642 	 *     context = a #GdkDragContext
643 	 *     time = the timestamp for this operation
644 	 */
645 	public static void dragDrop(DragContext context, uint time)
646 	{
647 		gdk_drag_drop((context is null) ? null : context.getDragContextStruct(), time);
648 	}
649 
650 	/**
651 	 * Inform GDK if the drop ended successfully. Passing %FALSE
652 	 * for @success may trigger a drag cancellation animation.
653 	 *
654 	 * This function is called by the drag source, and should
655 	 * be the last call before dropping the reference to the
656 	 * @context.
657 	 *
658 	 * The #GdkDragContext will only take the first gdk_drag_drop_done()
659 	 * call as effective, if this function is called multiple times,
660 	 * all subsequent calls will be ignored.
661 	 *
662 	 * Params:
663 	 *     context = a #GdkDragContext
664 	 *     success = whether the drag was ultimatively successful
665 	 *
666 	 * Since: 3.20
667 	 */
668 	public static void dragDropDone(DragContext context, bool success)
669 	{
670 		gdk_drag_drop_done((context is null) ? null : context.getDragContextStruct(), success);
671 	}
672 
673 	/**
674 	 * Returns whether the dropped data has been successfully
675 	 * transferred. This function is intended to be used while
676 	 * handling a %GDK_DROP_FINISHED event, its return value is
677 	 * meaningless at other times.
678 	 *
679 	 * Params:
680 	 *     context = a #GdkDragContext
681 	 *
682 	 * Return: %TRUE if the drop was successful.
683 	 *
684 	 * Since: 2.6
685 	 */
686 	public static bool dragDropSucceeded(DragContext context)
687 	{
688 		return gdk_drag_drop_succeeded((context is null) ? null : context.getDragContextStruct()) != 0;
689 	}
690 
691 	/**
692 	 * Finds the destination window and DND protocol to use at the
693 	 * given pointer position.
694 	 *
695 	 * This function is called by the drag source to obtain the
696 	 * @dest_window and @protocol parameters for gdk_drag_motion().
697 	 *
698 	 * Params:
699 	 *     context = a #GdkDragContext
700 	 *     dragWindow = a window which may be at the pointer position, but
701 	 *         should be ignored, since it is put up by the drag source as an icon
702 	 *     screen = the screen where the destination window is sought
703 	 *     xRoot = the x position of the pointer in root coordinates
704 	 *     yRoot = the y position of the pointer in root coordinates
705 	 *     destWindow = location to store the destination window in
706 	 *     protocol = location to store the DND protocol in
707 	 *
708 	 * Since: 2.2
709 	 */
710 	public static void dragFindWindowForScreen(DragContext context, Window dragWindow, Screen screen, int xRoot, int yRoot, out Window destWindow, out GdkDragProtocol protocol)
711 	{
712 		GdkWindow* outdestWindow = null;
713 		
714 		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);
715 		
716 		destWindow = ObjectG.getDObject!(Window)(outdestWindow);
717 	}
718 
719 	/**
720 	 * Returns the selection atom for the current source window.
721 	 *
722 	 * Params:
723 	 *     context = a #GdkDragContext.
724 	 *
725 	 * Return: the selection atom, or %GDK_NONE
726 	 */
727 	public static GdkAtom dragGetSelection(DragContext context)
728 	{
729 		return gdk_drag_get_selection((context is null) ? null : context.getDragContextStruct());
730 	}
731 
732 	/**
733 	 * Updates the drag context when the pointer moves or the
734 	 * set of actions changes.
735 	 *
736 	 * This function is called by the drag source.
737 	 *
738 	 * This function does not need to be called in managed drag and drop
739 	 * operations. See gdk_drag_context_manage_dnd() for more information.
740 	 *
741 	 * Params:
742 	 *     context = a #GdkDragContext
743 	 *     destWindow = the new destination window, obtained by
744 	 *         gdk_drag_find_window()
745 	 *     protocol = the DND protocol in use, obtained by gdk_drag_find_window()
746 	 *     xRoot = the x position of the pointer in root coordinates
747 	 *     yRoot = the y position of the pointer in root coordinates
748 	 *     suggestedAction = the suggested action
749 	 *     possibleActions = the possible actions
750 	 *     time = the timestamp for this operation
751 	 */
752 	public static bool dragMotion(DragContext context, Window destWindow, GdkDragProtocol protocol, int xRoot, int yRoot, GdkDragAction suggestedAction, GdkDragAction possibleActions, uint time)
753 	{
754 		return gdk_drag_motion((context is null) ? null : context.getDragContextStruct(), (destWindow is null) ? null : destWindow.getWindowStruct(), protocol, xRoot, yRoot, suggestedAction, possibleActions, time) != 0;
755 	}
756 
757 	/**
758 	 * Selects one of the actions offered by the drag source.
759 	 *
760 	 * This function is called by the drag destination in response to
761 	 * gdk_drag_motion() called by the drag source.
762 	 *
763 	 * Params:
764 	 *     context = a #GdkDragContext
765 	 *     action = the selected action which will be taken when a drop happens,
766 	 *         or 0 to indicate that a drop will not be accepted
767 	 *     time = the timestamp for this operation
768 	 */
769 	public static void dragStatus(DragContext context, GdkDragAction action, uint time)
770 	{
771 		gdk_drag_status((context is null) ? null : context.getDragContextStruct(), action, time);
772 	}
773 
774 	/**
775 	 * Ends the drag operation after a drop.
776 	 *
777 	 * This function is called by the drag destination.
778 	 *
779 	 * Params:
780 	 *     context = a #GdkDragContext
781 	 *     success = %TRUE if the data was successfully received
782 	 *     time = the timestamp for this operation
783 	 */
784 	public static void dropFinish(DragContext context, bool success, uint time)
785 	{
786 		gdk_drop_finish((context is null) ? null : context.getDragContextStruct(), success, time);
787 	}
788 
789 	/**
790 	 * Accepts or rejects a drop.
791 	 *
792 	 * This function is called by the drag destination in response
793 	 * to a drop initiated by the drag source.
794 	 *
795 	 * Params:
796 	 *     context = a #GdkDragContext
797 	 *     accepted = %TRUE if the drop is accepted
798 	 *     time = the timestamp for this operation
799 	 */
800 	public static void dropReply(DragContext context, bool accepted, uint time)
801 	{
802 		gdk_drop_reply((context is null) ? null : context.getDragContextStruct(), accepted, time);
803 	}
804 }