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