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 <!-- ##### ENUM GtkDestDefaults ##### -->
29 The #GtkDestfaults enumeration specifies the various
30 types of action that will be taken on behalf
31 of the user for a drag destination site.
33 <informaltable pgwide=1 frame="none" role="enum">
34 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
38 <entry><symbol>GTK_DEST_DEFAULT_MOTION</symbol></entry>
40 If set for a widget, GTK+, during a drag over this
41 widget will check if the drag matches this widget's
42 list of possible targets and actions.
43 GTK+ will then call gtk_drag_status() as appropriate.
48 <entry><symbol>GTK_DEST_DEFAULT_HIGHLIGHT</symbol></entry>
50 If set for a widget, GTK+ will draw a highlight on
51 this widget as long as a drag is over this widget
52 and the widget drag format and action are acceptable.</entry>
56 <entry><symbol>GTK_DEST_DEFAULT_DROP</symbol></entry>
58 If set for a widget, when a drop occurs, GTK+ will
59 will check if the drag matches this widget's
60 list of possible targets and actions. If so,
61 GTK+ will call gtk_drag_data_get() on behalf
62 of the widget. Whether or not the drop is successful,
63 GTK+ will call gtk_drag_finish(). If the action
64 was a move, then if the drag was successful, then
65 %TRUE will be passed for the @delete parameter
71 <entry><symbol>GTK_DEST_DEFAULT_ALL</symbol></entry>
73 If set, specifies that all default actions should
78 </tbody></tgroup></informaltable>
80 @GTK_DEST_DEFAULT_MOTION:
81 @GTK_DEST_DEFAULT_HIGHLIGHT:
82 @GTK_DEST_DEFAULT_DROP:
83 @GTK_DEST_DEFAULT_ALL:
85 <!-- ##### ENUM GtkTargetFlags ##### -->
87 The #GtkTargetFlags enumeration is used to specify
88 constraints on an entry in a #GtkTargetTable.
91 <varlistentry><term> %GTK_TARGET_SAME_APP </term>
94 If this is set, the target will only be selected
95 for drags within a single application.
99 <varlistentry><term> %GTK_TARGET_SAME_WIDGET </term>
102 If this is set, the target will only be selected
103 for drags within a single widget.
109 @GTK_TARGET_SAME_APP:
110 @GTK_TARGET_SAME_WIDGET:
112 <!-- ##### FUNCTION gtk_drag_dest_set ##### -->
114 Sets a widget as a potential drop destination.
117 @widget: a #GtkWidget
118 @flags: the flags that specify what actions GTK+ should take
119 on behalf of a widget for drops onto that widget. The @targets
120 and @actions fields only are used if %GTK_DEST_DEFAULT_MOTION
121 or %GTK_DEST_DEFAULT_DROP are given.
122 @targets: a pointer to an array of #GtkTargetEntry indicating
123 the drop types that this widget will accept.
124 @n_targets: the number of entries in @targets.
125 @actions: a bitmask of possible actions for a drop onto this
129 <!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
131 Sets this widget as a proxy for drops to another window.
134 @widget: a #GtkWidget
135 @proxy_window: the window to which to forward drag events
136 @protocol: the drag protocol which the @proxy_window accepts
137 (You can use gdk_drag_get_protocol() to determine this)
138 @use_coordinates: If true, send the same coordinates to the
139 destination, because it is an embedded
143 <!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
145 Clears information about a drop destination set with
146 gtk_drag_dest_set(). The widget will no longer receive
147 notification of drags.
150 @widget: a #GtkWidget
153 <!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
164 <!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
173 <!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
182 <!-- ##### FUNCTION gtk_drag_finish ##### -->
184 Informs the drag source that the drop is finished, and
185 that the data of the drag will no longer be required.
188 @context: the drag context.
189 @success: a flag indicating whether the drop was successful
190 @del: a flag indicating whether the source should delete the
191 original data. (This should be %TRUE for a move)
192 @time: the timestamp from the "drag_data_drop" signal.
195 <!-- ##### FUNCTION gtk_drag_get_data ##### -->
197 Get the data associated with a drag. When the data
198 is received or the retrieval fails, GTK+ will emit a
199 "drag_data_received" signal. Failure of the retrieval
200 is indicated by the length field of the @selection_data
201 signal parameter being negative. However, when gtk_drag_get_data()
202 is called implicitely because the %GTK_DRAG_DEFAULT_DROP was set,
203 then the widget will not receive notification of failed
207 @widget: the widget that will receive the "drag_data_received"
209 @context: the drag context
210 @target: the target (form of the data) to retrieve.
211 @time: a timestamp for retrieving the data. This will
212 generally be the time received in a "drag_data_motion"
213 or "drag_data_drop" signal.
216 <!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
218 Determines the source widget for a drag.
221 @context: a (destination side) drag context.
222 @Returns: if the drag is occurring within a single application,
223 a pointer to the source widget. Otherwise, %NULL.
226 <!-- ##### FUNCTION gtk_drag_highlight ##### -->
228 Draws a highlight around a widget. This will attach
229 handlers to "expose_event" and "draw", so the highlight
230 will continue to be displayed until gtk_drag_unhighlight()
234 @widget: a widget to highlight
237 <!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
239 Removes a highlight set by gtk_drag_highlight() from
243 @widget: a widget to remove the highlight from.
246 <!-- ##### FUNCTION gtk_drag_begin ##### -->
248 Initiates a drag on the source side. The function
249 only needs to be used when the application is
250 starting drags itself, and is not needed when
251 gtk_drag_source_set() is used.
254 @widget: the source widget.
255 @targets: The targets (data formats) in which the
256 source can provide the data.
257 @actions: A bitmask of the allowed drag actions for this
259 @button: The button the user clicked to start the drag.
260 @event: The event that triggered the start of the
262 @Returns: The context for this drag.
265 <!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
275 <!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
287 <!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
298 <!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
309 <!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
316 <!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
328 <!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
341 <!-- ##### FUNCTION gtk_drag_source_set ##### -->
343 Sets up a widget so that GTK+ will start a drag
344 operation when the user clicks and drags on the
345 widget. The widget must have a window.
348 @widget: a #GtkWidget
349 @start_button_mask: the bitmask of buttons that can start the drag
350 @targets: the table of targets that the drag will support
351 @n_targets: the number of items in @targets
352 @actions: the bitmask of possible actions for a drag from this
356 <!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
366 <!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
375 <!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
384 <!-- ##### FUNCTION gtk_drag_source_unset ##### -->
386 Undoes the effects of gtk_drag_source_set().
389 @widget: a #GtkWidget