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  * Conversion parameters:
26  * inFile  = gtk3-Drag-and-Drop.html
27  * outPack = gtk
28  * outFile = DragAndDrop
29  * strct   = GdkDragContext
30  * realStrct=
31  * ctorStrct=
32  * clss    = DragAndDrop
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_drag_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- cairo.Surface
49  * 	- gdk.DragContext
50  * 	- gdk.Event
51  * 	- gdk.Pixbuf
52  * 	- gdk.Window
53  * 	- gio.IconIF
54  * 	- gtk.TargetList
55  * 	- gtk.Widget
56  * structWrap:
57  * 	- GIcon* -> IconIF
58  * 	- GdkDragContext* -> DragContext
59  * 	- GdkEvent* -> Event
60  * 	- GdkPixbuf* -> Pixbuf
61  * 	- GdkWindow* -> Window
62  * 	- GtkTargetList* -> TargetList
63  * 	- GtkWidget* -> Widget
64  * 	- cairo_surface_t* -> Surface
65  * module aliases:
66  * local aliases:
67  * overrides:
68  */
69 
70 module gtk.DragAndDrop;
71 
72 public  import gtkc.gtktypes;
73 
74 private import gtkc.gtk;
75 private import glib.ConstructionException;
76 private import gobject.ObjectG;
77 
78 private import glib.Str;
79 private import cairo.Surface;
80 private import gdk.DragContext;
81 private import gdk.Event;
82 private import gdk.Pixbuf;
83 private import gdk.Window;
84 private import gio.IconIF;
85 private import gtk.TargetList;
86 private import gtk.Widget;
87 
88 
89 
90 /**
91  * GTK+ has a rich set of functions for doing inter-process
92  * communication via the drag-and-drop metaphor.
93  *
94  * As well as the functions listed here, applications
95  * may need to use some facilities provided for
96  * Selections.
97  * Also, the Drag and Drop API makes use of signals
98  * in the GtkWidget class.
99  */
100 public class DragAndDrop
101 {
102 	
103 	/** the main Gtk struct */
104 	protected GdkDragContext* gdkDragContext;
105 	
106 	
107 	/** Get the main Gtk struct */
108 	public GdkDragContext* getDragAndDropStruct()
109 	{
110 		return gdkDragContext;
111 	}
112 	
113 	
114 	/** the main Gtk struct as a void* */
115 	protected void* getStruct()
116 	{
117 		return cast(void*)gdkDragContext;
118 	}
119 	
120 	/**
121 	 * Sets our main struct and passes it to the parent class
122 	 */
123 	public this (GdkDragContext* gdkDragContext)
124 	{
125 		this.gdkDragContext = gdkDragContext;
126 	}
127 	
128 	/**
129 	 */
130 	
131 	/**
132 	 * Sets a widget as a potential drop destination, and adds default behaviors.
133 	 * The default behaviors listed in flags have an effect similar
134 	 * to installing default handlers for the widget's drag-and-drop signals
135 	 * ("drag-motion", "drag-drop", ...). They all exist
136 	 * for convenience. When passing GTK_DEST_DEFAULT_ALL for instance it is
137 	 * sufficient to connect to the widget's "drag-data-received"
138 	 * signal to get primitive, but consistent drag-and-drop support.
139 	 * Things become more complicated when you try to preview the dragged data,
140 	 * as described in the documentation for "drag-motion". The default
141 	 * behaviors described by flags make some assumptions, that can conflict
142 	 * with your own signal handlers. For instance GTK_DEST_DEFAULT_DROP causes
143 	 * invokations of gdk_drag_status() in the context of "drag-motion",
144 	 * and invokations of gtk_drag_finish() in "drag-data-received".
145 	 * Especially the later is dramatic, when your own "drag-motion"
146 	 * handler calls gtk_drag_get_data() to inspect the dragged data.
147 	 * There's no way to set a default action here, you can use the
148 	 * "drag-motion" callback for that. Here's an example which selects
149 	 * Params:
150 	 * widget = a GtkWidget
151 	 * flags = which types of default drag behavior to use
152 	 * targets = a pointer to an array of GtkTargetEntrys
153 	 * indicating the drop types that this widget will accept, or NULL.
154 	 * Later you can access the list with gtk_drag_dest_get_target_list()
155 	 * and gtk_drag_dest_find_target(). [allow-none][array length=n_targets]
156 	 * actions = a bitmask of possible actions for a drop onto this widget.
157 	 */
158 	public static void destSet(Widget widget, GtkDestDefaults flags, GtkTargetEntry[] targets, GdkDragAction actions)
159 	{
160 		// void gtk_drag_dest_set (GtkWidget *widget,  GtkDestDefaults flags,  const GtkTargetEntry *targets,  gint n_targets,  GdkDragAction actions);
161 		gtk_drag_dest_set((widget is null) ? null : widget.getWidgetStruct(), flags, targets.ptr, cast(int) targets.length, actions);
162 	}
163 	
164 	/**
165 	 * Sets this widget as a proxy for drops to another window.
166 	 * Params:
167 	 * widget = a GtkWidget
168 	 * proxyWindow = the window to which to forward drag events
169 	 * protocol = the drag protocol which the proxy_window accepts
170 	 * (You can use gdk_drag_get_protocol() to determine this)
171 	 * useCoordinates = If TRUE, send the same coordinates to the
172 	 * destination, because it is an embedded
173 	 * subwindow.
174 	 */
175 	public static void destSetProxy(Widget widget, Window proxyWindow, GdkDragProtocol protocol, int useCoordinates)
176 	{
177 		// void gtk_drag_dest_set_proxy (GtkWidget *widget,  GdkWindow *proxy_window,  GdkDragProtocol protocol,  gboolean use_coordinates);
178 		gtk_drag_dest_set_proxy((widget is null) ? null : widget.getWidgetStruct(), (proxyWindow is null) ? null : proxyWindow.getWindowStruct(), protocol, useCoordinates);
179 	}
180 	
181 	/**
182 	 * Clears information about a drop destination set with
183 	 * gtk_drag_dest_set(). The widget will no longer receive
184 	 * notification of drags.
185 	 * Params:
186 	 * widget = a GtkWidget
187 	 */
188 	public static void destUnset(Widget widget)
189 	{
190 		// void gtk_drag_dest_unset (GtkWidget *widget);
191 		gtk_drag_dest_unset((widget is null) ? null : widget.getWidgetStruct());
192 	}
193 	
194 	/**
195 	 * Looks for a match between the supported targets of context and the
196 	 * dest_target_list, returning the first matching target, otherwise
197 	 * returning GDK_NONE. dest_target_list should usually be the return
198 	 * value from gtk_drag_dest_get_target_list(), but some widgets may
199 	 * have different valid targets for different parts of the widget; in
200 	 * that case, they will have to implement a drag_motion handler that
201 	 * passes the correct target list to this function.
202 	 * Params:
203 	 * widget = drag destination widget
204 	 * context = drag context
205 	 * targetList = list of droppable targets, or NULL to use
206 	 * gtk_drag_dest_get_target_list (widget). [allow-none]
207 	 * Returns: first target that the source offers and the dest can accept, or GDK_NONE. [transfer none]
208 	 */
209 	public static GdkAtom destFindTarget(Widget widget, DragContext context, TargetList targetList)
210 	{
211 		// GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,  GdkDragContext *context,  GtkTargetList *target_list);
212 		return gtk_drag_dest_find_target((widget is null) ? null : widget.getWidgetStruct(), (context is null) ? null : context.getDragContextStruct(), (targetList is null) ? null : targetList.getTargetListStruct());
213 	}
214 	
215 	/**
216 	 * Returns the list of targets this widget can accept from
217 	 * drag-and-drop.
218 	 * Params:
219 	 * widget = a GtkWidget
220 	 * Returns: the GtkTargetList, or NULL if none. [transfer none]
221 	 */
222 	public static TargetList destGetTargetList(Widget widget)
223 	{
224 		// GtkTargetList * gtk_drag_dest_get_target_list (GtkWidget *widget);
225 		auto p = gtk_drag_dest_get_target_list((widget is null) ? null : widget.getWidgetStruct());
226 		
227 		if(p is null)
228 		{
229 			return null;
230 		}
231 		
232 		return ObjectG.getDObject!(TargetList)(cast(GtkTargetList*) p);
233 	}
234 	
235 	/**
236 	 * Sets the target types that this widget can accept from drag-and-drop.
237 	 * The widget must first be made into a drag destination with
238 	 * gtk_drag_dest_set().
239 	 * Params:
240 	 * widget = a GtkWidget that's a drag destination
241 	 * targetList = list of droppable targets, or NULL for none. [allow-none]
242 	 */
243 	public static void destSetTargetList(Widget widget, TargetList targetList)
244 	{
245 		// void gtk_drag_dest_set_target_list (GtkWidget *widget,  GtkTargetList *target_list);
246 		gtk_drag_dest_set_target_list((widget is null) ? null : widget.getWidgetStruct(), (targetList is null) ? null : targetList.getTargetListStruct());
247 	}
248 	
249 	/**
250 	 * Add the text targets supported by GtkSelection to
251 	 * the target list of the drag destination. The targets
252 	 * are added with info = 0. If you need another value,
253 	 * use gtk_target_list_add_text_targets() and
254 	 * gtk_drag_dest_set_target_list().
255 	 * Since 2.6
256 	 * Params:
257 	 * widget = a GtkWidget that's a drag destination
258 	 */
259 	public static void destAddTextTargets(Widget widget)
260 	{
261 		// void gtk_drag_dest_add_text_targets (GtkWidget *widget);
262 		gtk_drag_dest_add_text_targets((widget is null) ? null : widget.getWidgetStruct());
263 	}
264 	
265 	/**
266 	 * Add the image targets supported by GtkSelection to
267 	 * the target list of the drag destination. The targets
268 	 * are added with info = 0. If you need another value,
269 	 * use gtk_target_list_add_image_targets() and
270 	 * gtk_drag_dest_set_target_list().
271 	 * Since 2.6
272 	 * Params:
273 	 * widget = a GtkWidget that's a drag destination
274 	 */
275 	public static void destAddImageTargets(Widget widget)
276 	{
277 		// void gtk_drag_dest_add_image_targets (GtkWidget *widget);
278 		gtk_drag_dest_add_image_targets((widget is null) ? null : widget.getWidgetStruct());
279 	}
280 	
281 	/**
282 	 * Add the URI targets supported by GtkSelection to
283 	 * the target list of the drag destination. The targets
284 	 * are added with info = 0. If you need another value,
285 	 * use gtk_target_list_add_uri_targets() and
286 	 * gtk_drag_dest_set_target_list().
287 	 * Since 2.6
288 	 * Params:
289 	 * widget = a GtkWidget that's a drag destination
290 	 */
291 	public static void destAddUriTargets(Widget widget)
292 	{
293 		// void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
294 		gtk_drag_dest_add_uri_targets((widget is null) ? null : widget.getWidgetStruct());
295 	}
296 	
297 	/**
298 	 * Tells the widget to emit "drag-motion" and
299 	 * "drag-leave" events regardless of the targets and the
300 	 * GTK_DEST_DEFAULT_MOTION flag.
301 	 * This may be used when a widget wants to do generic
302 	 * actions regardless of the targets that the source offers.
303 	 * Since 2.10
304 	 * Params:
305 	 * widget = a GtkWidget that's a drag destination
306 	 * trackMotion = whether to accept all targets
307 	 */
308 	public static void destSetTrackMotion(Widget widget, int trackMotion)
309 	{
310 		// void gtk_drag_dest_set_track_motion (GtkWidget *widget,  gboolean track_motion);
311 		gtk_drag_dest_set_track_motion((widget is null) ? null : widget.getWidgetStruct(), trackMotion);
312 	}
313 	
314 	/**
315 	 * Returns whether the widget has been configured to always
316 	 * emit "drag-motion" signals.
317 	 * Since 2.10
318 	 * Params:
319 	 * widget = a GtkWidget that's a drag destination
320 	 * Returns: TRUE if the widget always emits "drag-motion" events
321 	 */
322 	public static int destGetTrackMotion(Widget widget)
323 	{
324 		// gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget);
325 		return gtk_drag_dest_get_track_motion((widget is null) ? null : widget.getWidgetStruct());
326 	}
327 	
328 	/**
329 	 * Informs the drag source that the drop is finished, and
330 	 * that the data of the drag will no longer be required.
331 	 * Params:
332 	 * success = a flag indicating whether the drop was successful
333 	 * del = a flag indicating whether the source should delete the
334 	 * original data. (This should be TRUE for a move)
335 	 * time = the timestamp from the "drag-drop" signal.
336 	 */
337 	public void finish(int success, int del, uint time)
338 	{
339 		// void gtk_drag_finish (GdkDragContext *context,  gboolean success,  gboolean del,  guint32 time_);
340 		gtk_drag_finish(gdkDragContext, success, del, time);
341 	}
342 	
343 	/**
344 	 * Gets the data associated with a drag. When the data
345 	 * is received or the retrieval fails, GTK+ will emit a
346 	 * "drag-data-received" signal. Failure of the retrieval
347 	 * is indicated by the length field of the selection_data
348 	 * signal parameter being negative. However, when gtk_drag_get_data()
349 	 * is called implicitely because the GTK_DEST_DEFAULT_DROP was set,
350 	 * then the widget will not receive notification of failed
351 	 * drops.
352 	 * Params:
353 	 * widget = the widget that will receive the
354 	 * "drag-data-received" signal.
355 	 * context = the drag context
356 	 * target = the target (form of the data) to retrieve.
357 	 * time = a timestamp for retrieving the data. This will
358 	 * generally be the time received in a "drag-motion""
359 	 * or "drag-drop"" signal.
360 	 */
361 	public static void getData(Widget widget, DragContext context, GdkAtom target, uint time)
362 	{
363 		// void gtk_drag_get_data (GtkWidget *widget,  GdkDragContext *context,  GdkAtom target,  guint32 time_);
364 		gtk_drag_get_data((widget is null) ? null : widget.getWidgetStruct(), (context is null) ? null : context.getDragContextStruct(), target, time);
365 	}
366 	
367 	/**
368 	 * Determines the source widget for a drag.
369 	 * Returns: if the drag is occurring within a single application, a pointer to the source widget. Otherwise, NULL. [transfer none]
370 	 */
371 	public Widget getSourceWidget()
372 	{
373 		// GtkWidget * gtk_drag_get_source_widget (GdkDragContext *context);
374 		auto p = gtk_drag_get_source_widget(gdkDragContext);
375 		
376 		if(p is null)
377 		{
378 			return null;
379 		}
380 		
381 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
382 	}
383 	
384 	/**
385 	 * Draws a highlight around a widget. This will attach
386 	 * handlers to "draw", so the highlight
387 	 * will continue to be displayed until gtk_drag_unhighlight()
388 	 * is called.
389 	 * Params:
390 	 * widget = a widget to highlight
391 	 */
392 	public static void highlight(Widget widget)
393 	{
394 		// void gtk_drag_highlight (GtkWidget *widget);
395 		gtk_drag_highlight((widget is null) ? null : widget.getWidgetStruct());
396 	}
397 	
398 	/**
399 	 * Removes a highlight set by gtk_drag_highlight() from
400 	 * a widget.
401 	 * Params:
402 	 * widget = a widget to remove the highlight from.
403 	 */
404 	public static void unhighlight(Widget widget)
405 	{
406 		// void gtk_drag_unhighlight (GtkWidget *widget);
407 		gtk_drag_unhighlight((widget is null) ? null : widget.getWidgetStruct());
408 	}
409 	
410 	/**
411 	 * Warning
412 	 * gtk_drag_begin has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_drag_begin_with_coordinates() instead.
413 	 * This is equivalent to gtk_drag_begin_with_coordinates(), passing -1, -1
414 	 * as coordinates.
415 	 * Params:
416 	 * widget = the source widget.
417 	 * targets = The targets (data formats) in which the
418 	 * source can provide the data.
419 	 * actions = A bitmask of the allowed drag actions for this drag.
420 	 * button = The button the user clicked to start the drag.
421 	 * event = The event that triggered the start of the drag.
422 	 * Returns: the context for this drag. [transfer none]
423 	 */
424 	public static DragContext begin(Widget widget, TargetList targets, GdkDragAction actions, int button, Event event)
425 	{
426 		// GdkDragContext * gtk_drag_begin (GtkWidget *widget,  GtkTargetList *targets,  GdkDragAction actions,  gint button,  GdkEvent *event);
427 		auto p = gtk_drag_begin((widget is null) ? null : widget.getWidgetStruct(), (targets is null) ? null : targets.getTargetListStruct(), actions, button, (event is null) ? null : event.getEventStruct());
428 		
429 		if(p is null)
430 		{
431 			return null;
432 		}
433 		
434 		return ObjectG.getDObject!(DragContext)(cast(GdkDragContext*) p);
435 	}
436 	
437 	/**
438 	 * Changes the icon for a widget to a given widget. GTK+
439 	 * will not destroy the icon, so if you don't want
440 	 * it to persist, you should connect to the "drag-end"
441 	 * signal and destroy it yourself.
442 	 * Params:
443 	 * widget = a toplevel window to use as an icon.
444 	 * hotX = the X offset within widget of the hotspot.
445 	 * hotY = the Y offset within widget of the hotspot.
446 	 */
447 	public void setIconWidget(Widget widget, int hotX, int hotY)
448 	{
449 		// void gtk_drag_set_icon_widget (GdkDragContext *context,  GtkWidget *widget,  gint hot_x,  gint hot_y);
450 		gtk_drag_set_icon_widget(gdkDragContext, (widget is null) ? null : widget.getWidgetStruct(), hotX, hotY);
451 	}
452 	
453 	/**
454 	 * Sets pixbuf as the icon for a given drag.
455 	 * Params:
456 	 * pixbuf = the GdkPixbuf to use as the drag icon.
457 	 * hotX = the X offset within widget of the hotspot.
458 	 * hotY = the Y offset within widget of the hotspot.
459 	 */
460 	public void setIconPixbuf(Pixbuf pixbuf, int hotX, int hotY)
461 	{
462 		// void gtk_drag_set_icon_pixbuf (GdkDragContext *context,  GdkPixbuf *pixbuf,  gint hot_x,  gint hot_y);
463 		gtk_drag_set_icon_pixbuf(gdkDragContext, (pixbuf is null) ? null : pixbuf.getPixbufStruct(), hotX, hotY);
464 	}
465 	
466 	/**
467 	 * Warning
468 	 * gtk_drag_set_icon_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_drag_set_icon_name() instead.
469 	 * Sets the icon for a given drag from a stock ID.
470 	 * Params:
471 	 * stockId = the ID of the stock icon to use for the drag.
472 	 * hotX = the X offset within the icon of the hotspot.
473 	 * hotY = the Y offset within the icon of the hotspot.
474 	 */
475 	public void setIconStock(string stockId, int hotX, int hotY)
476 	{
477 		// void gtk_drag_set_icon_stock (GdkDragContext *context,  const gchar *stock_id,  gint hot_x,  gint hot_y);
478 		gtk_drag_set_icon_stock(gdkDragContext, Str.toStringz(stockId), hotX, hotY);
479 	}
480 	
481 	/**
482 	 * Sets surface as the icon for a given drag. GTK+ retains
483 	 * references for the arguments, and will release them when
484 	 * they are no longer needed.
485 	 * To position the surface relative to the mouse, use
486 	 * cairo_surface_set_device_offset() on surface. The mouse
487 	 * cursor will be positioned at the (0,0) coordinate of the
488 	 * surface.
489 	 * Params:
490 	 * surface = the surface to use as icon
491 	 */
492 	public void setIconSurface(Surface surface)
493 	{
494 		// void gtk_drag_set_icon_surface (GdkDragContext *context,  cairo_surface_t *surface);
495 		gtk_drag_set_icon_surface(gdkDragContext, (surface is null) ? null : surface.getSurfaceStruct());
496 	}
497 	
498 	/**
499 	 * Sets the icon for a given drag from a named themed icon. See
500 	 * the docs for GtkIconTheme for more details. Note that the
501 	 * size of the icon depends on the icon theme (the icon is
502 	 * loaded at the symbolic size GTK_ICON_SIZE_DND), thus
503 	 * hot_x and hot_y have to be used with care.
504 	 * Since 2.8
505 	 * Params:
506 	 * iconName = name of icon to use
507 	 * hotX = the X offset of the hotspot within the icon
508 	 * hotY = the Y offset of the hotspot within the icon
509 	 */
510 	public void setIconName(string iconName, int hotX, int hotY)
511 	{
512 		// void gtk_drag_set_icon_name (GdkDragContext *context,  const gchar *icon_name,  gint hot_x,  gint hot_y);
513 		gtk_drag_set_icon_name(gdkDragContext, Str.toStringz(iconName), hotX, hotY);
514 	}
515 	
516 	/**
517 	 * Sets the icon for a given drag from the given icon. See the
518 	 * documentation for gtk_drag_set_icon_name() for more details about
519 	 * using icons in drag and drop.
520 	 * Params:
521 	 * icon = a GIcon
522 	 * hotX = the X offset of the hotspot within the icon
523 	 * hotY = the Y offset of the hotspot within the icon
524 	 * Since 3.2
525 	 */
526 	public void setIconGicon(IconIF icon, int hotX, int hotY)
527 	{
528 		// void gtk_drag_set_icon_gicon (GdkDragContext *context,  GIcon *icon,  gint hot_x,  gint hot_y);
529 		gtk_drag_set_icon_gicon(gdkDragContext, (icon is null) ? null : icon.getIconTStruct(), hotX, hotY);
530 	}
531 	
532 	/**
533 	 * Sets the icon for a particular drag to the default
534 	 * icon.
535 	 */
536 	public void setIconDefault()
537 	{
538 		// void gtk_drag_set_icon_default (GdkDragContext *context);
539 		gtk_drag_set_icon_default(gdkDragContext);
540 	}
541 	
542 	/**
543 	 * Checks to see if a mouse drag starting at (start_x, start_y) and ending
544 	 * at (current_x, current_y) has passed the GTK+ drag threshold, and thus
545 	 * should trigger the beginning of a drag-and-drop operation.
546 	 * Params:
547 	 * widget = a GtkWidget
548 	 * startX = X coordinate of start of drag
549 	 * startY = Y coordinate of start of drag
550 	 * currentX = current X coordinate
551 	 * currentY = current Y coordinate
552 	 * Returns: TRUE if the drag threshold has been passed.
553 	 */
554 	public static int checkThreshold(Widget widget, int startX, int startY, int currentX, int currentY)
555 	{
556 		// gboolean gtk_drag_check_threshold (GtkWidget *widget,  gint start_x,  gint start_y,  gint current_x,  gint current_y);
557 		return gtk_drag_check_threshold((widget is null) ? null : widget.getWidgetStruct(), startX, startY, currentX, currentY);
558 	}
559 	
560 	/**
561 	 * Sets up a widget so that GTK+ will start a drag operation when the user
562 	 * clicks and drags on the widget. The widget must have a window.
563 	 * Params:
564 	 * widget = a GtkWidget
565 	 * startButtonMask = the bitmask of buttons that can start the drag
566 	 * targets = the table of targets that the drag will support,
567 	 * may be NULL. [allow-none][array length=n_targets]
568 	 * actions = the bitmask of possible actions for a drag from this widget
569 	 */
570 	public static void sourceSet(Widget widget, GdkModifierType startButtonMask, GtkTargetEntry[] targets, GdkDragAction actions)
571 	{
572 		// void gtk_drag_source_set (GtkWidget *widget,  GdkModifierType start_button_mask,  const GtkTargetEntry *targets,  gint n_targets,  GdkDragAction actions);
573 		gtk_drag_source_set((widget is null) ? null : widget.getWidgetStruct(), startButtonMask, targets.ptr, cast(int) targets.length, actions);
574 	}
575 	
576 	/**
577 	 * Sets the icon that will be used for drags from a particular widget
578 	 * from a GdkPixbuf. GTK+ retains a reference for pixbuf and will
579 	 * release it when it is no longer needed.
580 	 * Params:
581 	 * widget = a GtkWidget
582 	 * pixbuf = the GdkPixbuf for the drag icon
583 	 */
584 	public static void sourceSetIconPixbuf(Widget widget, Pixbuf pixbuf)
585 	{
586 		// void gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,  GdkPixbuf *pixbuf);
587 		gtk_drag_source_set_icon_pixbuf((widget is null) ? null : widget.getWidgetStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct());
588 	}
589 	
590 	/**
591 	 * Warning
592 	 * gtk_drag_source_set_icon_stock has been deprecated since version 3.10 and should not be used in newly-written code. Use gtk_drag_source_set_icon_name() instead.
593 	 * Sets the icon that will be used for drags from a particular source
594 	 * to a stock icon.
595 	 * Params:
596 	 * widget = a GtkWidget
597 	 * stockId = the ID of the stock icon to use
598 	 */
599 	public static void sourceSetIconStock(Widget widget, string stockId)
600 	{
601 		// void gtk_drag_source_set_icon_stock (GtkWidget *widget,  const gchar *stock_id);
602 		gtk_drag_source_set_icon_stock((widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(stockId));
603 	}
604 	
605 	/**
606 	 * Sets the icon that will be used for drags from a particular source
607 	 * to a themed icon. See the docs for GtkIconTheme for more details.
608 	 * Since 2.8
609 	 * Params:
610 	 * widget = a GtkWidget
611 	 * iconName = name of icon to use
612 	 */
613 	public static void sourceSetIconName(Widget widget, string iconName)
614 	{
615 		// void gtk_drag_source_set_icon_name (GtkWidget *widget,  const gchar *icon_name);
616 		gtk_drag_source_set_icon_name((widget is null) ? null : widget.getWidgetStruct(), Str.toStringz(iconName));
617 	}
618 	
619 	/**
620 	 * Sets the icon that will be used for drags from a particular source
621 	 * to icon. See the docs for GtkIconTheme for more details.
622 	 * Params:
623 	 * widget = a GtkWidget
624 	 * icon = A GIcon
625 	 * Since 3.2
626 	 */
627 	public static void sourceSetIconGicon(Widget widget, IconIF icon)
628 	{
629 		// void gtk_drag_source_set_icon_gicon (GtkWidget *widget,  GIcon *icon);
630 		gtk_drag_source_set_icon_gicon((widget is null) ? null : widget.getWidgetStruct(), (icon is null) ? null : icon.getIconTStruct());
631 	}
632 	
633 	/**
634 	 * Undoes the effects of gtk_drag_source_set().
635 	 * Params:
636 	 * widget = a GtkWidget
637 	 */
638 	public static void sourceUnset(Widget widget)
639 	{
640 		// void gtk_drag_source_unset (GtkWidget *widget);
641 		gtk_drag_source_unset((widget is null) ? null : widget.getWidgetStruct());
642 	}
643 	
644 	/**
645 	 * Changes the target types that this widget offers for drag-and-drop.
646 	 * The widget must first be made into a drag source with
647 	 * gtk_drag_source_set().
648 	 * Since 2.4
649 	 * Params:
650 	 * widget = a GtkWidget that's a drag source
651 	 * targetList = list of draggable targets, or NULL for none. [allow-none]
652 	 */
653 	public static void sourceSetTargetList(Widget widget, TargetList targetList)
654 	{
655 		// void gtk_drag_source_set_target_list (GtkWidget *widget,  GtkTargetList *target_list);
656 		gtk_drag_source_set_target_list((widget is null) ? null : widget.getWidgetStruct(), (targetList is null) ? null : targetList.getTargetListStruct());
657 	}
658 	
659 	/**
660 	 * Gets the list of targets this widget can provide for
661 	 * drag-and-drop.
662 	 * Since 2.4
663 	 * Params:
664 	 * widget = a GtkWidget
665 	 * Returns: the GtkTargetList, or NULL if none. [transfer none]
666 	 */
667 	public static TargetList sourceGetTargetList(Widget widget)
668 	{
669 		// GtkTargetList * gtk_drag_source_get_target_list (GtkWidget *widget);
670 		auto p = gtk_drag_source_get_target_list((widget is null) ? null : widget.getWidgetStruct());
671 		
672 		if(p is null)
673 		{
674 			return null;
675 		}
676 		
677 		return ObjectG.getDObject!(TargetList)(cast(GtkTargetList*) p);
678 	}
679 	
680 	/**
681 	 * Add the text targets supported by GtkSelection to
682 	 * the target list of the drag source. The targets
683 	 * are added with info = 0. If you need another value,
684 	 * use gtk_target_list_add_text_targets() and
685 	 * gtk_drag_source_set_target_list().
686 	 * Since 2.6
687 	 * Params:
688 	 * widget = a GtkWidget that's is a drag source
689 	 */
690 	public static void sourceAddTextTargets(Widget widget)
691 	{
692 		// void gtk_drag_source_add_text_targets (GtkWidget *widget);
693 		gtk_drag_source_add_text_targets((widget is null) ? null : widget.getWidgetStruct());
694 	}
695 	
696 	/**
697 	 * Add the writable image targets supported by GtkSelection to
698 	 * the target list of the drag source. The targets
699 	 * are added with info = 0. If you need another value,
700 	 * use gtk_target_list_add_image_targets() and
701 	 * gtk_drag_source_set_target_list().
702 	 * Since 2.6
703 	 * Params:
704 	 * widget = a GtkWidget that's is a drag source
705 	 */
706 	public static void sourceAddImageTargets(Widget widget)
707 	{
708 		// void gtk_drag_source_add_image_targets (GtkWidget *widget);
709 		gtk_drag_source_add_image_targets((widget is null) ? null : widget.getWidgetStruct());
710 	}
711 	
712 	/**
713 	 * Add the URI targets supported by GtkSelection to
714 	 * the target list of the drag source. The targets
715 	 * are added with info = 0. If you need another value,
716 	 * use gtk_target_list_add_uri_targets() and
717 	 * gtk_drag_source_set_target_list().
718 	 * Since 2.6
719 	 * Params:
720 	 * widget = a GtkWidget that's is a drag source
721 	 */
722 	public static void sourceAddUriTargets(Widget widget)
723 	{
724 		// void gtk_drag_source_add_uri_targets (GtkWidget *widget);
725 		gtk_drag_source_add_uri_targets((widget is null) ? null : widget.getWidgetStruct());
726 	}
727 }