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 #GtkDestDefaults enumeration specifies the various
30 types of action that will be taken on behalf
31 of the user for a drag destination site.
34 @GTK_DEST_DEFAULT_MOTION:
35 If set for a widget, GTK+, during a drag over this
36 widget will check if the drag matches this widget's
37 list of possible targets and actions.
38 GTK+ will then call gdk_drag_status() as appropriate.
39 @GTK_DEST_DEFAULT_HIGHLIGHT:
40 If set for a widget, GTK+ will draw a highlight on
41 this widget as long as a drag is over this widget
42 and the widget drag format and action are acceptable.
43 @GTK_DEST_DEFAULT_DROP:
44 If set for a widget, when a drop occurs, GTK+ will
45 will check if the drag matches this widget's
46 list of possible targets and actions. If so,
47 GTK+ will call gtk_drag_get_data() on behalf
48 of the widget. Whether or not the drop is successful,
49 GTK+ will call gtk_drag_finish(). If the action
50 was a move, then if the drag was successful, then
51 %TRUE will be passed for the @delete parameter
53 @GTK_DEST_DEFAULT_ALL:
54 If set, specifies that all default actions should
57 <!-- ##### ENUM GtkTargetFlags ##### -->
59 The #GtkTargetFlags enumeration is used to specify
60 constraints on an entry in a #GtkTargetTable.
64 If this is set, the target will only be selected
65 for drags within a single application.
66 @GTK_TARGET_SAME_WIDGET:
67 If this is set, the target will only be selected
68 for drags within a single widget.
70 <!-- ##### FUNCTION gtk_drag_dest_set ##### -->
72 Sets a widget as a potential drop destination.
76 @flags: the flags that specify what actions GTK+ should take
77 on behalf of a widget for drops onto that widget. The @targets
78 and @actions fields only are used if %GTK_DEST_DEFAULT_MOTION
79 or %GTK_DEST_DEFAULT_DROP are given.
80 @targets: a pointer to an array of #GtkTargetEntry<!-- -->s indicating
81 the drop types that this widget will accept.
82 @n_targets: the number of entries in @targets.
83 @actions: a bitmask of possible actions for a drop onto this
87 <!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
89 Sets this widget as a proxy for drops to another window.
93 @proxy_window: the window to which to forward drag events
94 @protocol: the drag protocol which the @proxy_window accepts
95 (You can use gdk_drag_get_protocol() to determine this)
96 @use_coordinates: If %TRUE, send the same coordinates to the
97 destination, because it is an embedded
101 <!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
103 Clears information about a drop destination set with
104 gtk_drag_dest_set(). The widget will no longer receive
105 notification of drags.
108 @widget: a #GtkWidget
111 <!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
122 <!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
131 <!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
140 <!-- ##### FUNCTION gtk_drag_dest_add_text_targets ##### -->
148 <!-- ##### FUNCTION gtk_drag_finish ##### -->
150 Informs the drag source that the drop is finished, and
151 that the data of the drag will no longer be required.
154 @context: the drag context.
155 @success: a flag indicating whether the drop was successful
156 @del: a flag indicating whether the source should delete the
157 original data. (This should be %TRUE for a move)
158 @time_: the timestamp from the "drag_data_drop" signal.
161 <!-- ##### FUNCTION gtk_drag_get_data ##### -->
163 Gets the data associated with a drag. When the data
164 is received or the retrieval fails, GTK+ will emit a
165 "drag_data_received" signal. Failure of the retrieval
166 is indicated by the length field of the @selection_data
167 signal parameter being negative. However, when gtk_drag_get_data()
168 is called implicitely because the %GTK_DEST_DEFAULT_DROP was set,
169 then the widget will not receive notification of failed
173 @widget: the widget that will receive the "drag_data_received"
175 @context: the drag context
176 @target: the target (form of the data) to retrieve.
177 @time_: a timestamp for retrieving the data. This will
178 generally be the time received in a "drag_data_motion"
179 or "drag_data_drop" signal.
182 <!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
184 Determines the source widget for a drag.
187 @context: a (destination side) drag context.
188 @Returns: if the drag is occurring within a single application,
189 a pointer to the source widget. Otherwise, %NULL.
192 <!-- ##### FUNCTION gtk_drag_highlight ##### -->
194 Draws a highlight around a widget. This will attach
195 handlers to "expose_event" and "draw", so the highlight
196 will continue to be displayed until gtk_drag_unhighlight()
200 @widget: a widget to highlight
203 <!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
205 Removes a highlight set by gtk_drag_highlight() from
209 @widget: a widget to remove the highlight from.
212 <!-- ##### FUNCTION gtk_drag_begin ##### -->
225 <!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
235 <!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
247 <!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
258 <!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
269 <!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
276 <!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
288 <!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
301 <!-- ##### FUNCTION gtk_drag_source_set ##### -->
303 Sets up a widget so that GTK+ will start a drag
304 operation when the user clicks and drags on the
305 widget. The widget must have a window.
308 @widget: a #GtkWidget
309 @start_button_mask: the bitmask of buttons that can start the drag
310 @targets: the table of targets that the drag will support
311 @n_targets: the number of items in @targets
312 @actions: the bitmask of possible actions for a drag from this
316 <!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
326 <!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
335 <!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
344 <!-- ##### FUNCTION gtk_drag_source_unset ##### -->
346 Undoes the effects of gtk_drag_source_set().
349 @widget: a #GtkWidget
352 <!-- ##### FUNCTION gtk_drag_source_set_target_list ##### -->
361 <!-- ##### FUNCTION gtk_drag_source_get_target_list ##### -->
370 <!-- ##### FUNCTION gtk_drag_source_add_text_targets ##### -->