2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gdk-Drag-and-Drop.html
27 * outFile = DragContext
28 * strct = GdkDragContext
51 * - GdkDisplay* -> Display
52 * - GdkDragContext* -> DragContext
53 * - GdkScreen* -> Screen
54 * - GdkWindow* -> Window
59 module gdk
.DragContext
;
65 import tango
.io
.Stdout
; // use the tango loging?
69 private import gtkc
.gdktypes
;
71 private import gtkc
.gdk
;
74 private import gdk
.DragContext
;
75 private import gdk
.Window
;
76 private import gdk
.Screen
;
77 private import glib
.ListG
;
78 private import gdk
.Display
;
85 * These functions provide a low level interface for drag and drop.
86 * The X backend of GDK supports both the Xdnd and Motif drag and drop protocols
87 * transparently, the Win32 backend supports the WM_DROPFILES protocol.
88 * GTK+ provides a higher level abstraction based on top of these functions,
89 * and so they are not normally needed in GTK+ applications.
90 * See the Drag and Drop section of
91 * the GTK+ documentation for more information.
93 public class DragContext
96 /** the main Gtk struct */
97 protected GdkDragContext
* gdkDragContext
;
100 public GdkDragContext
* getDragContextStruct()
102 return gdkDragContext
;
106 /** the main Gtk struct as a void* */
107 protected void* getStruct()
109 return cast(void*)gdkDragContext
;
113 * Sets our main struct and passes it to the parent class
115 public this (GdkDragContext
* gdkDragContext
)
119 if ( gdkDragContext
is null )
124 Stdout("struct gdkDragContext is null on constructor").newline
;
128 printf("struct gdkDragContext is null on constructor");
135 assert(gdkDragContext
!is null, "struct gdkDragContext is null on constructor");
137 this.gdkDragContext
= gdkDragContext
;
144 * Returns the selection atom for the current source window.
148 * the selection atom.
150 public GdkAtom
gdkDragGetSelection()
152 // GdkAtom gdk_drag_get_selection (GdkDragContext *context);
153 return gdk_drag_get_selection(gdkDragContext
);
157 * Aborts a drag without dropping.
158 * This function is called by the drag source.
162 * the timestamp for this operation.
164 public void gdkDragAbort(uint time
)
166 // void gdk_drag_abort (GdkDragContext *context, guint32 time_);
167 gdk_drag_abort(gdkDragContext
, time
);
171 * Accepts or rejects a drop.
172 * This function is called by the drag destination in response
173 * to a drop initiated by the drag source.
177 * TRUE if the drop is accepted.
179 * the timestamp for this operation.
181 public void gdkDropReply(int ok
, uint time
)
183 // void gdk_drop_reply (GdkDragContext *context, gboolean ok, guint32 time_);
184 gdk_drop_reply(gdkDragContext
, ok
, time
);
188 * Creates a new GdkDragContext.
190 * the newly created GdkDragContext.
192 public static DragContext
gdkDragContextNew()
194 // GdkDragContext* gdk_drag_context_new (void);
195 return new DragContext( gdk_drag_context_new() );
199 * Drops on the current destination.
200 * This function is called by the drag source.
204 * the timestamp for this operation.
206 public void gdkDragDrop(uint time
)
208 // void gdk_drag_drop (GdkDragContext *context, guint32 time_);
209 gdk_drag_drop(gdkDragContext
, time
);
213 * Finds the destination window and DND protocol to use at the
214 * given pointer position.
215 * This function is called by the drag source to obtain the
216 * dest_window and protocol parameters for gdk_drag_motion().
220 * a window which may be at the pointer position, but
221 * should be ignored, since it is put up by the drag source as an icon.
223 * the x position of the pointer in root coordinates.
225 * the y position of the pointer in root coordinates.
227 * location to store the destination window in.
229 * location to store the DND protocol in.
231 public void gdkDragFindWindow(Window dragWindow
, int xRoot
, int yRoot
, GdkWindow
** destWindow
, GdkDragProtocol
* protocol
)
233 // void gdk_drag_find_window (GdkDragContext *context, GdkWindow *drag_window, gint x_root, gint y_root, GdkWindow **dest_window, GdkDragProtocol *protocol);
234 gdk_drag_find_window(gdkDragContext
, (dragWindow
is null) ?
null : dragWindow
.getWindowStruct(), xRoot
, yRoot
, destWindow
, protocol
);
238 * Finds the destination window and DND protocol to use at the
239 * given pointer position.
240 * This function is called by the drag source to obtain the
241 * dest_window and protocol parameters for gdk_drag_motion().
245 * a window which may be at the pointer position, but
246 * should be ignored, since it is put up by the drag source as an icon.
248 * the screen where the destination window is sought.
250 * the x position of the pointer in root coordinates.
252 * the y position of the pointer in root coordinates.
254 * location to store the destination window in.
256 * location to store the DND protocol in.
259 public void gdkDragFindWindowForScreen(Window dragWindow
, Screen screen
, int xRoot
, int yRoot
, GdkWindow
** destWindow
, GdkDragProtocol
* protocol
)
261 // void gdk_drag_find_window_for_screen (GdkDragContext *context, GdkWindow *drag_window, GdkScreen *screen, gint x_root, gint y_root, GdkWindow **dest_window, GdkDragProtocol *protocol);
262 gdk_drag_find_window_for_screen(gdkDragContext
, (dragWindow
is null) ?
null : dragWindow
.getWindowStruct(), (screen
is null) ?
null : screen
.getScreenStruct(), xRoot
, yRoot
, destWindow
, protocol
);
267 * gdk_drag_context_ref is deprecated and should not be used in newly-written code.
268 * Deprecated function; use g_object_ref() instead.
272 public void gdkDragContextRef()
274 // void gdk_drag_context_ref (GdkDragContext *context);
275 gdk_drag_context_ref(gdkDragContext
);
279 * Starts a drag and creates a new drag context for it.
280 * This function is called by the drag source.
282 * the source window for this drag.
284 * the list of offered targets.
286 * a newly created GdkDragContext.
288 public static DragContext
gdkDragBegin(Window window
, ListG targets
)
290 // GdkDragContext* gdk_drag_begin (GdkWindow *window, GList *targets);
291 return new DragContext( gdk_drag_begin((window
is null) ?
null : window
.getWindowStruct(), (targets
is null) ?
null : targets
.getListGStruct()) );
295 * Updates the drag context when the pointer moves or the
296 * set of actions changes.
297 * This function is called by the drag source.
301 * the new destination window, obtained by
302 * gdk_drag_find_window().
304 * the DND protocol in use, obtained by gdk_drag_find_window().
306 * the x position of the pointer in root coordinates.
308 * the y position of the pointer in root coordinates.
310 * the suggested action.
312 * the possible actions.
314 * the timestamp for this operation.
318 public int gdkDragMotion(Window destWindow
, GdkDragProtocol protocol
, int xRoot
, int yRoot
, GdkDragAction suggestedAction
, GdkDragAction possibleActions
, uint time
)
320 // gboolean gdk_drag_motion (GdkDragContext *context, GdkWindow *dest_window, GdkDragProtocol protocol, gint x_root, gint y_root, GdkDragAction suggested_action, GdkDragAction possible_actions, guint32 time_);
321 return gdk_drag_motion(gdkDragContext
, (destWindow
is null) ?
null : destWindow
.getWindowStruct(), protocol
, xRoot
, yRoot
, suggestedAction
, possibleActions
, time
);
325 * Ends the drag operation after a drop.
326 * This function is called by the drag destination.
330 * TRUE if the data was successfully received.
332 * the timestamp for this operation.
334 public void gdkDropFinish(int success
, uint time
)
336 // void gdk_drop_finish (GdkDragContext *context, gboolean success, guint32 time_);
337 gdk_drop_finish(gdkDragContext
, success
, time
);
341 * Finds out the DND protocol supported by a window.
343 * the X id of the destination window.
345 * location where the supported DND protocol is returned.
347 * the X id of the window where the drop should happen. This
348 * may be xid or the X id of a proxy window, or None if xid doesn't
349 * support Drag and Drop.
351 public static uint gdkDragGetProtocol(uint xid
, GdkDragProtocol
* protocol
)
353 // guint32 gdk_drag_get_protocol (guint32 xid, GdkDragProtocol *protocol);
354 return gdk_drag_get_protocol(xid
, protocol
);
358 * Finds out the DND protocol supported by a window.
360 * the GdkDisplay where the destination window resides
362 * the X id of the destination window.
364 * location where the supported DND protocol is returned.
366 * the X id of the window where the drop should happen. This
367 * may be xid or the X id of a proxy window, or None if xid doesn't
368 * support Drag and Drop.
371 public static uint gdkDragGetProtocolForDisplay(Display display
, uint xid
, GdkDragProtocol
* protocol
)
373 // guint32 gdk_drag_get_protocol_for_display (GdkDisplay *display, guint32 xid, GdkDragProtocol *protocol);
374 return gdk_drag_get_protocol_for_display((display
is null) ?
null : display
.getDisplayStruct(), xid
, protocol
);
380 * gdk_drag_context_unref is deprecated and should not be used in newly-written code.
381 * Deprecated function; use g_object_unref() instead.
385 public void gdkDragContextUnref()
387 // void gdk_drag_context_unref (GdkDragContext *context);
388 gdk_drag_context_unref(gdkDragContext
);
394 * Selects one of the actions offered by the drag source.
395 * This function is called by the drag destination in response to
396 * gdk_drag_motion() called by the drag source.
400 * the selected action which will be taken when a drop happens,
401 * or 0 to indicate that a drop will not be accepted.
403 * the timestamp for this operation.
405 public void gdkDragStatus(GdkDragAction action
, uint time
)
407 // void gdk_drag_status (GdkDragContext *context, GdkDragAction action, guint32 time_);
408 gdk_drag_status(gdkDragContext
, action
, time
);
412 * Returns wether the dropped data has been successfully
413 * transferred. This function is intended to be used while
414 * handling a GDK_DROP_FINISHED event, its return value is
415 * meaningless at other times.
419 * TRUE if the drop was successful.
422 public int gdkDragDropSucceeded()
424 // gboolean gdk_drag_drop_succeeded (GdkDragContext *context);
425 return gdk_drag_drop_succeeded(gdkDragContext
);