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 gtk.DragAndDrop; 26 27 private import cairo.Context; 28 private import cairo.Surface; 29 private import gdk.DragContext; 30 private import gdkpixbuf.Pixbuf; 31 private import gio.IconIF; 32 private import glib.Str; 33 private import gobject.ObjectG; 34 private import gtk.Widget; 35 private import gtkc.gtk; 36 public import gtkc.gtktypes; 37 38 39 public struct DragAndDrop 40 { 41 /** 42 */ 43 44 /** 45 * Informs the drag source that the drop is finished, and 46 * that the data of the drag will no longer be required. 47 * 48 * Params: 49 * context = the drag context 50 * success = a flag indicating whether the drop was successful 51 * del = a flag indicating whether the source should delete the 52 * original data. (This should be %TRUE for a move) 53 * time = the timestamp from the #GtkWidget::drag-drop signal 54 */ 55 public static void dragFinish(DragContext context, bool success, bool del, uint time) 56 { 57 gtk_drag_finish((context is null) ? null : context.getDragContextStruct(), success, del, time); 58 } 59 60 /** 61 * Determines the source widget for a drag. 62 * 63 * Params: 64 * context = a (destination side) drag context 65 * 66 * Return: if the drag is occurring 67 * within a single application, a pointer to the source widget. 68 * Otherwise, %NULL. 69 */ 70 public static Widget dragGetSourceWidget(DragContext context) 71 { 72 auto p = gtk_drag_get_source_widget((context is null) ? null : context.getDragContextStruct()); 73 74 if(p is null) 75 { 76 return null; 77 } 78 79 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 80 } 81 82 /** 83 * Sets the icon for a particular drag to the default 84 * icon. 85 * 86 * Params: 87 * context = the context for a drag (This must be called 88 * with a context for the source side of a drag) 89 */ 90 public static void dragSetIconDefault(DragContext context) 91 { 92 gtk_drag_set_icon_default((context is null) ? null : context.getDragContextStruct()); 93 } 94 95 /** 96 * Sets the icon for a given drag from the given @icon. 97 * See the documentation for gtk_drag_set_icon_name() 98 * for more details about using icons in drag and drop. 99 * 100 * Params: 101 * context = the context for a drag (This must be called 102 * with a context for the source side of a drag) 103 * icon = a #GIcon 104 * hotX = the X offset of the hotspot within the icon 105 * hotY = the Y offset of the hotspot within the icon 106 * 107 * Since: 3.2 108 */ 109 public static void dragSetIconGicon(DragContext context, IconIF icon, int hotX, int hotY) 110 { 111 gtk_drag_set_icon_gicon((context is null) ? null : context.getDragContextStruct(), (icon is null) ? null : icon.getIconStruct(), hotX, hotY); 112 } 113 114 /** 115 * Sets the icon for a given drag from a named themed icon. See 116 * the docs for #GtkIconTheme for more details. Note that the 117 * size of the icon depends on the icon theme (the icon is 118 * loaded at the symbolic size #GTK_ICON_SIZE_DND), thus 119 * @hot_x and @hot_y have to be used with care. 120 * 121 * Params: 122 * context = the context for a drag (This must be called 123 * with a context for the source side of a drag) 124 * iconName = name of icon to use 125 * hotX = the X offset of the hotspot within the icon 126 * hotY = the Y offset of the hotspot within the icon 127 * 128 * Since: 2.8 129 */ 130 public static void dragSetIconName(DragContext context, string iconName, int hotX, int hotY) 131 { 132 gtk_drag_set_icon_name((context is null) ? null : context.getDragContextStruct(), Str.toStringz(iconName), hotX, hotY); 133 } 134 135 /** 136 * Sets @pixbuf as the icon for a given drag. 137 * 138 * Params: 139 * context = the context for a drag (This must be called 140 * with a context for the source side of a drag) 141 * pixbuf = the #GdkPixbuf to use as the drag icon 142 * hotX = the X offset within @widget of the hotspot 143 * hotY = the Y offset within @widget of the hotspot 144 */ 145 public static void dragSetIconPixbuf(DragContext context, Pixbuf pixbuf, int hotX, int hotY) 146 { 147 gtk_drag_set_icon_pixbuf((context is null) ? null : context.getDragContextStruct(), (pixbuf is null) ? null : pixbuf.getPixbufStruct(), hotX, hotY); 148 } 149 150 /** 151 * Sets the icon for a given drag from a stock ID. 152 * 153 * Deprecated: Use gtk_drag_set_icon_name() instead. 154 * 155 * Params: 156 * context = the context for a drag (This must be called 157 * with a context for the source side of a drag) 158 * stockId = the ID of the stock icon to use for the drag 159 * hotX = the X offset within the icon of the hotspot 160 * hotY = the Y offset within the icon of the hotspot 161 */ 162 public static void dragSetIconStock(DragContext context, string stockId, int hotX, int hotY) 163 { 164 gtk_drag_set_icon_stock((context is null) ? null : context.getDragContextStruct(), Str.toStringz(stockId), hotX, hotY); 165 } 166 167 /** 168 * Sets @surface as the icon for a given drag. GTK+ retains 169 * references for the arguments, and will release them when 170 * they are no longer needed. 171 * 172 * To position the surface relative to the mouse, use 173 * cairo_surface_set_device_offset() on @surface. The mouse 174 * cursor will be positioned at the (0,0) coordinate of the 175 * surface. 176 * 177 * Params: 178 * context = the context for a drag (This must be called 179 * with a context for the source side of a drag) 180 * surface = the surface to use as icon 181 */ 182 public static void dragSetIconSurface(DragContext context, Surface surface) 183 { 184 gtk_drag_set_icon_surface((context is null) ? null : context.getDragContextStruct(), (surface is null) ? null : surface.getSurfaceStruct()); 185 } 186 187 /** 188 * Changes the icon for a widget to a given widget. 189 * GTK+ will not destroy the icon, so if you don’t want 190 * it to persist, you should connect to the “drag-end” 191 * signal and destroy it yourself. 192 * 193 * GTK+ will, however, change the opacity and position of 194 * the window as part of the drag animation. If you want 195 * to reuse the window, you have to restore these to 196 * the values you need after each drag operation. 197 * 198 * Params: 199 * context = the context for a drag. (This must be called 200 * with a context for the source side of a drag) 201 * widget = a toplevel window to use as an icon 202 * hotX = the X offset within @widget of the hotspot 203 * hotY = the Y offset within @widget of the hotspot 204 */ 205 public static void dragSetIconWidget(DragContext context, Widget widget, int hotX, int hotY) 206 { 207 gtk_drag_set_icon_widget((context is null) ? null : context.getDragContextStruct(), (widget is null) ? null : widget.getWidgetStruct(), hotX, hotY); 208 } 209 210 /** 211 * Draws a text caret on @cr at @location. This is not a style function 212 * but merely a convenience function for drawing the standard cursor shape. 213 * 214 * Deprecated: Use gtk_render_insertion_cursor() instead. 215 * 216 * Params: 217 * widget = a #GtkWidget 218 * cr = cairo context to draw to 219 * location = location where to draw the cursor (@location->width is ignored) 220 * isPrimary = if the cursor should be the primary cursor color. 221 * direction = whether the cursor is left-to-right or 222 * right-to-left. Should never be #GTK_TEXT_DIR_NONE 223 * drawArrow = %TRUE to draw a directional arrow on the 224 * cursor. Should be %FALSE unless the cursor is split. 225 * 226 * Since: 3.0 227 */ 228 public static void drawInsertionCursor(Widget widget, Context cr, GdkRectangle* location, bool isPrimary, GtkTextDirection direction, bool drawArrow) 229 { 230 gtk_draw_insertion_cursor((widget is null) ? null : widget.getWidgetStruct(), (cr is null) ? null : cr.getContextStruct(), location, isPrimary, direction, drawArrow); 231 } 232 }