]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkdnd.sgml
Add GTK_TARGET_OTHER_{APP,WIDGET} to restrict drags within an
[~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 <!-- ##### SECTION Stability_Level ##### -->
28
29
30 <!-- ##### ENUM GtkDestDefaults ##### -->
31 <para>
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.
35 </para>
36
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
55    to gtk_drag_finish().
56 @GTK_DEST_DEFAULT_ALL: 
57    If set, specifies that all default actions should
58    be taken.
59
60 <!-- ##### ENUM GtkTargetFlags ##### -->
61 <para>
62 The #GtkTargetFlags enumeration is used to specify
63 constraints on an entry in a #GtkTargetTable. 
64 </para>
65
66 @GTK_TARGET_SAME_APP: 
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
78
79 <!-- ##### FUNCTION gtk_drag_dest_set ##### -->
80 <para>
81 Sets a widget as a potential drop destination.
82 </para>
83
84 @widget: a #GtkWidget
85 @flags: the flags that specify what actions GTK+ should take
86  on behalf of a widget for drops onto that widget. The @targets
87  and @actions fields only are used if %GTK_DEST_DEFAULT_MOTION
88  or %GTK_DEST_DEFAULT_DROP are given.
89 @targets: a pointer to an array of #GtkTargetEntry<!-- -->s indicating
90  the drop types that this widget will accept.
91 @n_targets: the number of entries in @targets.
92 @actions: a bitmask of possible actions for a drop onto this
93  widget.
94
95
96 <!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
97 <para>
98 Sets this widget as a proxy for drops to another window.
99 </para>
100
101 @widget: a #GtkWidget
102 @proxy_window: the window to which to forward drag events
103 @protocol: the drag protocol which the @proxy_window accepts
104            (You can use gdk_drag_get_protocol() to determine this)
105 @use_coordinates: If %TRUE, send the same coordinates to the
106                   destination, because it is an embedded 
107                   subwindow.
108
109
110 <!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
111 <para>
112 Clears information about a drop destination set with
113 gtk_drag_dest_set(). The widget will no longer receive
114 notification of drags.
115 </para>
116
117 @widget: a #GtkWidget
118
119
120 <!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
121 <para>
122
123 </para>
124
125 @widget: 
126 @context: 
127 @target_list: 
128 @Returns: 
129
130
131 <!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
132 <para>
133
134 </para>
135
136 @widget: 
137 @Returns: 
138
139
140 <!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
141 <para>
142
143 </para>
144
145 @widget: 
146 @target_list: 
147
148
149 <!-- ##### FUNCTION gtk_drag_dest_add_text_targets ##### -->
150 <para>
151
152 </para>
153
154 @widget: 
155
156
157 <!-- ##### FUNCTION gtk_drag_dest_add_image_targets ##### -->
158 <para>
159
160 </para>
161
162 @widget: 
163
164
165 <!-- ##### FUNCTION gtk_drag_dest_add_uri_targets ##### -->
166 <para>
167
168 </para>
169
170 @widget: 
171
172
173 <!-- ##### FUNCTION gtk_drag_dest_set_track_motion ##### -->
174 <para>
175
176 </para>
177
178 @widget: 
179 @track_motion: 
180
181
182 <!-- ##### FUNCTION gtk_drag_dest_get_track_motion ##### -->
183 <para>
184
185 </para>
186
187 @widget: 
188 @Returns: 
189
190
191 <!-- ##### FUNCTION gtk_drag_finish ##### -->
192 <para>
193 Informs the drag source that the drop is finished, and
194 that the data of the drag will no longer be required.
195 </para>
196
197 @context: the drag context.
198 @success: a flag indicating whether the drop was successful
199 @del: a flag indicating whether the source should delete the
200       original data. (This should be %TRUE for a move)
201 @time_: the timestamp from the "drag_data_drop" signal.
202
203
204 <!-- ##### FUNCTION gtk_drag_get_data ##### -->
205 <para>
206 Gets the data associated with a drag. When the data
207 is received or the retrieval fails, GTK+ will emit a 
208 "drag_data_received" signal. Failure of the retrieval
209 is indicated by the length field of the @selection_data
210 signal parameter being negative. However, when gtk_drag_get_data() 
211 is called implicitely because the %GTK_DEST_DEFAULT_DROP was set, 
212 then the widget will not receive notification of failed
213 drops.
214 </para>
215
216 @widget: the widget that will receive the "drag_data_received"
217  signal.
218 @context: the drag context
219 @target: the target (form of the data) to retrieve.
220 @time_: a timestamp for retrieving the data. This will
221        generally be the time received in a "drag_data_motion"
222        or "drag_data_drop" signal.
223
224
225 <!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
226 <para>
227 Determines the source widget for a drag.
228 </para>
229
230 @context: a (destination side) drag context.
231 @Returns: if the drag is occurring within a single application,
232           a pointer to the source widget. Otherwise, %NULL.
233
234
235 <!-- ##### FUNCTION gtk_drag_highlight ##### -->
236 <para>
237 Draws a highlight around a widget. This will attach
238 handlers to  "expose_event" and "draw", so the highlight
239 will continue to be displayed until gtk_drag_unhighlight()
240 is called.
241 </para>
242
243 @widget: a widget to highlight
244
245
246 <!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
247 <para>
248 Removes a highlight set by gtk_drag_highlight() from
249 a widget.
250 </para>
251
252 @widget: a widget to remove the highlight from.
253
254
255 <!-- ##### FUNCTION gtk_drag_begin ##### -->
256 <para>
257
258 </para>
259
260 @widget: 
261 @targets: 
262 @actions: 
263 @button: 
264 @event: 
265 @Returns: 
266
267
268 <!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
269 <para>
270 </para>
271
272 @context: 
273 @widget: 
274 @hot_x: 
275 @hot_y: 
276
277
278 <!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
279 <para>
280 </para>
281
282 @context: 
283 @colormap: 
284 @pixmap: 
285 @mask: 
286 @hot_x: 
287 @hot_y: 
288
289
290 <!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
291 <para>
292
293 </para>
294
295 @context: 
296 @pixbuf: 
297 @hot_x: 
298 @hot_y: 
299
300
301 <!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
302 <para>
303
304 </para>
305
306 @context: 
307 @stock_id: 
308 @hot_x: 
309 @hot_y: 
310
311
312 <!-- ##### FUNCTION gtk_drag_set_icon_name ##### -->
313 <para>
314
315 </para>
316
317 @context: 
318 @icon_name: 
319 @hot_x: 
320 @hot_y: 
321
322
323 <!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
324 <para>
325 </para>
326
327 @context: 
328
329
330 <!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
331 <para>
332
333 </para>
334
335 @colormap: 
336 @pixmap: 
337 @mask: 
338 @hot_x: 
339 @hot_y: 
340
341
342 <!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
343 <para>
344
345 </para>
346
347 @widget: 
348 @start_x: 
349 @start_y: 
350 @current_x: 
351 @current_y: 
352 @Returns: 
353
354
355 <!-- ##### FUNCTION gtk_drag_source_set ##### -->
356 <para>
357 Sets up a widget so that GTK+ will start a drag
358 operation when the user clicks and drags on the
359 widget. The widget must have a window.
360 </para>
361
362 @widget: a #GtkWidget
363 @start_button_mask: the bitmask of buttons that can start the drag
364 @targets: the table of targets that the drag will support
365 @n_targets: the number of items in @targets
366 @actions: the bitmask of possible actions for a drag from this
367  widget.
368
369
370 <!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
371 <para>
372 </para>
373
374 @widget: 
375 @colormap: 
376 @pixmap: 
377 @mask: 
378
379
380 <!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
381 <para>
382
383 </para>
384
385 @widget: 
386 @pixbuf: 
387
388
389 <!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
390 <para>
391
392 </para>
393
394 @widget: 
395 @stock_id: 
396
397
398 <!-- ##### FUNCTION gtk_drag_source_set_icon_name ##### -->
399 <para>
400
401 </para>
402
403 @widget: 
404 @icon_name: 
405
406
407 <!-- ##### FUNCTION gtk_drag_source_unset ##### -->
408 <para>
409 Undoes the effects of gtk_drag_source_set().
410 </para>
411
412 @widget: a #GtkWidget
413
414
415 <!-- ##### FUNCTION gtk_drag_source_set_target_list ##### -->
416 <para>
417
418 </para>
419
420 @widget: 
421 @target_list: 
422
423
424 <!-- ##### FUNCTION gtk_drag_source_get_target_list ##### -->
425 <para>
426
427 </para>
428
429 @widget: 
430 @Returns: 
431
432
433 <!-- ##### FUNCTION gtk_drag_source_add_text_targets ##### -->
434 <para>
435
436 </para>
437
438 @widget: 
439
440
441 <!-- ##### FUNCTION gtk_drag_source_add_image_targets ##### -->
442 <para>
443
444 </para>
445
446 @widget: 
447
448
449 <!-- ##### FUNCTION gtk_drag_source_add_uri_targets ##### -->
450 <para>
451
452 </para>
453
454 @widget: 
455
456