1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 Functions for controlling drag and drop handling
7 <!-- ##### SECTION Long_Description ##### -->
9 GTK+ has a rich set of functions for doing inter-process
10 communication via the drag-and-drop metaphor. GTK+
11 can do drag-and-drop (DND) via multiple protocols.
12 The currently supported protocols are the Xdnd and
15 As well as the functions listed here, applications
16 may need to use some facilities provided for
17 <link linkend="gtk-Selections">Selections</link>.
18 Also, the Drag and Drop API makes use of signals
19 in the #GtkWidget class.
22 <!-- ##### SECTION See_Also ##### -->
27 <!-- ##### SECTION Stability_Level ##### -->
30 <!-- ##### ENUM GtkDestDefaults ##### -->
32 The #GtkDestDefaults enumeration specifies the various
33 types of action that will be taken on behalf
34 of the user for a drag destination site.
37 @GTK_DEST_DEFAULT_MOTION:
38 If set for a widget, GTK+, during a drag over this
39 widget will check if the drag matches this widget's
40 list of possible targets and actions.
41 GTK+ will then call gdk_drag_status() as appropriate.
42 @GTK_DEST_DEFAULT_HIGHLIGHT:
43 If set for a widget, GTK+ will draw a highlight on
44 this widget as long as a drag is over this widget
45 and the widget drag format and action are acceptable.
46 @GTK_DEST_DEFAULT_DROP:
47 If set for a widget, when a drop occurs, GTK+ will
48 will check if the drag matches this widget's
49 list of possible targets and actions. If so,
50 GTK+ will call gtk_drag_get_data() on behalf
51 of the widget. Whether or not the drop is successful,
52 GTK+ will call gtk_drag_finish(). If the action
53 was a move, then if the drag was successful, then
54 %TRUE will be passed for the @delete parameter
56 @GTK_DEST_DEFAULT_ALL:
57 If set, specifies that all default actions should
60 <!-- ##### ENUM GtkTargetFlags ##### -->
62 The #GtkTargetFlags enumeration is used to specify
63 constraints on an entry in a #GtkTargetTable.
67 If this is set, the target will only be selected
68 for drags within a single application.
69 @GTK_TARGET_SAME_WIDGET:
70 If this is set, the target will only be selected
71 for drags within a single widget.
72 @GTK_TARGET_OTHER_APP:
73 If this is set, the target will not be selected
74 for drags within a single application. Since 2.12
75 @GTK_TARGET_OTHER_WIDGET:
76 If this is set, the target will not be selected
77 for drags withing a single widget. Since 2.12
79 <!-- ##### FUNCTION gtk_drag_dest_set ##### -->
90 <!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
92 Sets this widget as a proxy for drops to another window.
96 @proxy_window: the window to which to forward drag events
97 @protocol: the drag protocol which the @proxy_window accepts
98 (You can use gdk_drag_get_protocol() to determine this)
99 @use_coordinates: If %TRUE, send the same coordinates to the
100 destination, because it is an embedded
104 <!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
106 Clears information about a drop destination set with
107 gtk_drag_dest_set(). The widget will no longer receive
108 notification of drags.
111 @widget: a #GtkWidget
114 <!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
125 <!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
134 <!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
143 <!-- ##### FUNCTION gtk_drag_dest_add_text_targets ##### -->
151 <!-- ##### FUNCTION gtk_drag_dest_add_image_targets ##### -->
159 <!-- ##### FUNCTION gtk_drag_dest_add_uri_targets ##### -->
167 <!-- ##### FUNCTION gtk_drag_dest_set_track_motion ##### -->
176 <!-- ##### FUNCTION gtk_drag_dest_get_track_motion ##### -->
185 <!-- ##### FUNCTION gtk_drag_finish ##### -->
187 Informs the drag source that the drop is finished, and
188 that the data of the drag will no longer be required.
191 @context: the drag context.
192 @success: a flag indicating whether the drop was successful
193 @del: a flag indicating whether the source should delete the
194 original data. (This should be %TRUE for a move)
195 @time_: the timestamp from the "drag_data_drop" signal.
198 <!-- ##### FUNCTION gtk_drag_get_data ##### -->
200 Gets the data associated with a drag. When the data
201 is received or the retrieval fails, GTK+ will emit a
202 "drag_data_received" signal. Failure of the retrieval
203 is indicated by the length field of the @selection_data
204 signal parameter being negative. However, when gtk_drag_get_data()
205 is called implicitely because the %GTK_DEST_DEFAULT_DROP was set,
206 then the widget will not receive notification of failed
210 @widget: the widget that will receive the "drag_data_received"
212 @context: the drag context
213 @target: the target (form of the data) to retrieve.
214 @time_: a timestamp for retrieving the data. This will
215 generally be the time received in a "drag_data_motion"
216 or "drag_data_drop" signal.
219 <!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
221 Determines the source widget for a drag.
224 @context: a (destination side) drag context.
225 @Returns: if the drag is occurring within a single application,
226 a pointer to the source widget. Otherwise, %NULL.
229 <!-- ##### FUNCTION gtk_drag_highlight ##### -->
231 Draws a highlight around a widget. This will attach
232 handlers to "expose_event" and "draw", so the highlight
233 will continue to be displayed until gtk_drag_unhighlight()
237 @widget: a widget to highlight
240 <!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
242 Removes a highlight set by gtk_drag_highlight() from
246 @widget: a widget to remove the highlight from.
249 <!-- ##### FUNCTION gtk_drag_begin ##### -->
262 <!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
272 <!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
284 <!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
295 <!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
306 <!-- ##### FUNCTION gtk_drag_set_icon_name ##### -->
317 <!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
324 <!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
336 <!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
349 <!-- ##### FUNCTION gtk_drag_source_set ##### -->
361 <!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
371 <!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
380 <!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
389 <!-- ##### FUNCTION gtk_drag_source_set_icon_name ##### -->
398 <!-- ##### FUNCTION gtk_drag_source_unset ##### -->
400 Undoes the effects of gtk_drag_source_set().
403 @widget: a #GtkWidget
406 <!-- ##### FUNCTION gtk_drag_source_set_target_list ##### -->
415 <!-- ##### FUNCTION gtk_drag_source_get_target_list ##### -->
424 <!-- ##### FUNCTION gtk_drag_source_add_text_targets ##### -->
432 <!-- ##### FUNCTION gtk_drag_source_add_image_targets ##### -->
440 <!-- ##### FUNCTION gtk_drag_source_add_uri_targets ##### -->