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