]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkdnd.sgml
It is GTK_DEST_DEFAULT_DROP, not GTK_DRAG_DEFAULT_DROP. (#117917,
[~andy/gtk] / docs / reference / gtk / tmpl / gtkdnd.sgml
1 <!-- ##### SECTION Title ##### -->
2 Drag and Drop
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Functions for controlling drag and drop handling
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
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
13 Motif protocols.
14
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.
20 </para>
21
22 <!-- ##### SECTION See_Also ##### -->
23 <para>
24
25 </para>
26
27 <!-- ##### ENUM GtkDestDefaults ##### -->
28 <para>
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.
32 </para>
33
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
52    to gtk_drag_finish().
53 @GTK_DEST_DEFAULT_ALL: 
54    If set, specifies that all default actions should
55    be taken.
56
57 <!-- ##### ENUM GtkTargetFlags ##### -->
58 <para>
59 The #GtkTargetFlags enumeration is used to specify
60 constraints on an entry in a #GtkTargetTable. 
61 </para>
62
63 @GTK_TARGET_SAME_APP: 
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.
69
70 <!-- ##### FUNCTION gtk_drag_dest_set ##### -->
71 <para>
72 Sets a widget as a potential drop destination.
73 </para>
74
75 @widget: a #GtkWidget
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
84  widget.
85
86
87 <!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
88 <para>
89 Sets this widget as a proxy for drops to another window.
90 </para>
91
92 @widget: a #GtkWidget
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 
98                   subwindow.
99
100
101 <!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
102 <para>
103 Clears information about a drop destination set with
104 gtk_drag_dest_set(). The widget will no longer receive
105 notification of drags.
106 </para>
107
108 @widget: a #GtkWidget
109
110
111 <!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
112 <para>
113
114 </para>
115
116 @widget: 
117 @context: 
118 @target_list: 
119 @Returns: 
120
121
122 <!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
123 <para>
124
125 </para>
126
127 @widget: 
128 @Returns: 
129
130
131 <!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
132 <para>
133
134 </para>
135
136 @widget: 
137 @target_list: 
138
139
140 <!-- ##### FUNCTION gtk_drag_finish ##### -->
141 <para>
142 Informs the drag source that the drop is finished, and
143 that the data of the drag will no longer be required.
144 </para>
145
146 @context: the drag context.
147 @success: a flag indicating whether the drop was successful
148 @del: a flag indicating whether the source should delete the
149       original data. (This should be %TRUE for a move)
150 @time_: the timestamp from the "drag_data_drop" signal.
151
152
153 <!-- ##### FUNCTION gtk_drag_get_data ##### -->
154 <para>
155 Gets the data associated with a drag. When the data
156 is received or the retrieval fails, GTK+ will emit a 
157 "drag_data_received" signal. Failure of the retrieval
158 is indicated by the length field of the @selection_data
159 signal parameter being negative. However, when gtk_drag_get_data() 
160 is called implicitely because the %GTK_DEST_DEFAULT_DROP was set, 
161 then the widget will not receive notification of failed
162 drops.
163 </para>
164
165 @widget: the widget that will receive the "drag_data_received"
166  signal.
167 @context: the drag context
168 @target: the target (form of the data) to retrieve.
169 @time_: a timestamp for retrieving the data. This will
170        generally be the time received in a "drag_data_motion"
171        or "drag_data_drop" signal.
172
173
174 <!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
175 <para>
176 Determines the source widget for a drag.
177 </para>
178
179 @context: a (destination side) drag context.
180 @Returns: if the drag is occurring within a single application,
181           a pointer to the source widget. Otherwise, %NULL.
182
183
184 <!-- ##### FUNCTION gtk_drag_highlight ##### -->
185 <para>
186 Draws a highlight around a widget. This will attach
187 handlers to  "expose_event" and "draw", so the highlight
188 will continue to be displayed until gtk_drag_unhighlight()
189 is called.
190 </para>
191
192 @widget: a widget to highlight
193
194
195 <!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
196 <para>
197 Removes a highlight set by gtk_drag_highlight() from
198 a widget.
199 </para>
200
201 @widget: a widget to remove the highlight from.
202
203
204 <!-- ##### FUNCTION gtk_drag_begin ##### -->
205 <para>
206
207 </para>
208
209 @widget: 
210 @targets: 
211 @actions: 
212 @button: 
213 @event: 
214 @Returns: 
215
216
217 <!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
218 <para>
219 </para>
220
221 @context: 
222 @widget: 
223 @hot_x: 
224 @hot_y: 
225
226
227 <!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
228 <para>
229 </para>
230
231 @context: 
232 @colormap: 
233 @pixmap: 
234 @mask: 
235 @hot_x: 
236 @hot_y: 
237
238
239 <!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
240 <para>
241
242 </para>
243
244 @context: 
245 @pixbuf: 
246 @hot_x: 
247 @hot_y: 
248
249
250 <!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
251 <para>
252
253 </para>
254
255 @context: 
256 @stock_id: 
257 @hot_x: 
258 @hot_y: 
259
260
261 <!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
262 <para>
263 </para>
264
265 @context: 
266
267
268 <!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
269 <para>
270
271 </para>
272
273 @colormap: 
274 @pixmap: 
275 @mask: 
276 @hot_x: 
277 @hot_y: 
278
279
280 <!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
281 <para>
282
283 </para>
284
285 @widget: 
286 @start_x: 
287 @start_y: 
288 @current_x: 
289 @current_y: 
290 @Returns: 
291
292
293 <!-- ##### FUNCTION gtk_drag_source_set ##### -->
294 <para>
295 Sets up a widget so that GTK+ will start a drag
296 operation when the user clicks and drags on the
297 widget. The widget must have a window.
298 </para>
299
300 @widget: a #GtkWidget
301 @start_button_mask: the bitmask of buttons that can start the drag
302 @targets: the table of targets that the drag will support
303 @n_targets: the number of items in @targets
304 @actions: the bitmask of possible actions for a drag from this
305  widget.
306
307
308 <!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
309 <para>
310 </para>
311
312 @widget: 
313 @colormap: 
314 @pixmap: 
315 @mask: 
316
317
318 <!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
319 <para>
320
321 </para>
322
323 @widget: 
324 @pixbuf: 
325
326
327 <!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
328 <para>
329
330 </para>
331
332 @widget: 
333 @stock_id: 
334
335
336 <!-- ##### FUNCTION gtk_drag_source_unset ##### -->
337 <para>
338 Undoes the effects of gtk_drag_source_set().
339 </para>
340
341 @widget: a #GtkWidget
342
343