]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkdnd.sgml
7d127408d21dd3eb2dd139e78e9c0aa1493ef9d1
[~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 </para>
82
83 @widget: 
84 @flags: 
85 @targets: 
86 @n_targets: 
87 @actions: 
88
89
90 <!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
91 <para>
92 Sets this widget as a proxy for drops to another window.
93 </para>
94
95 @widget: a #GtkWidget
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 
101                   subwindow.
102
103
104 <!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
105 <para>
106 Clears information about a drop destination set with
107 gtk_drag_dest_set(). The widget will no longer receive
108 notification of drags.
109 </para>
110
111 @widget: a #GtkWidget
112
113
114 <!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
115 <para>
116
117 </para>
118
119 @widget: 
120 @context: 
121 @target_list: 
122 @Returns: 
123
124
125 <!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
126 <para>
127
128 </para>
129
130 @widget: 
131 @Returns: 
132
133
134 <!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
135 <para>
136
137 </para>
138
139 @widget: 
140 @target_list: 
141
142
143 <!-- ##### FUNCTION gtk_drag_dest_add_text_targets ##### -->
144 <para>
145
146 </para>
147
148 @widget: 
149
150
151 <!-- ##### FUNCTION gtk_drag_dest_add_image_targets ##### -->
152 <para>
153
154 </para>
155
156 @widget: 
157
158
159 <!-- ##### FUNCTION gtk_drag_dest_add_uri_targets ##### -->
160 <para>
161
162 </para>
163
164 @widget: 
165
166
167 <!-- ##### FUNCTION gtk_drag_dest_set_track_motion ##### -->
168 <para>
169
170 </para>
171
172 @widget: 
173 @track_motion: 
174
175
176 <!-- ##### FUNCTION gtk_drag_dest_get_track_motion ##### -->
177 <para>
178
179 </para>
180
181 @widget: 
182 @Returns: 
183
184
185 <!-- ##### FUNCTION gtk_drag_finish ##### -->
186 <para>
187 Informs the drag source that the drop is finished, and
188 that the data of the drag will no longer be required.
189 </para>
190
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.
196
197
198 <!-- ##### FUNCTION gtk_drag_get_data ##### -->
199 <para>
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
207 drops.
208 </para>
209
210 @widget: the widget that will receive the "drag_data_received"
211  signal.
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.
217
218
219 <!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
220 <para>
221 Determines the source widget for a drag.
222 </para>
223
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.
227
228
229 <!-- ##### FUNCTION gtk_drag_highlight ##### -->
230 <para>
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()
234 is called.
235 </para>
236
237 @widget: a widget to highlight
238
239
240 <!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
241 <para>
242 Removes a highlight set by gtk_drag_highlight() from
243 a widget.
244 </para>
245
246 @widget: a widget to remove the highlight from.
247
248
249 <!-- ##### FUNCTION gtk_drag_begin ##### -->
250 <para>
251
252 </para>
253
254 @widget: 
255 @targets: 
256 @actions: 
257 @button: 
258 @event: 
259 @Returns: 
260
261
262 <!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
263 <para>
264 </para>
265
266 @context: 
267 @widget: 
268 @hot_x: 
269 @hot_y: 
270
271
272 <!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
273 <para>
274 </para>
275
276 @context: 
277 @colormap: 
278 @pixmap: 
279 @mask: 
280 @hot_x: 
281 @hot_y: 
282
283
284 <!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
285 <para>
286
287 </para>
288
289 @context: 
290 @pixbuf: 
291 @hot_x: 
292 @hot_y: 
293
294
295 <!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
296 <para>
297
298 </para>
299
300 @context: 
301 @stock_id: 
302 @hot_x: 
303 @hot_y: 
304
305
306 <!-- ##### FUNCTION gtk_drag_set_icon_name ##### -->
307 <para>
308
309 </para>
310
311 @context: 
312 @icon_name: 
313 @hot_x: 
314 @hot_y: 
315
316
317 <!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
318 <para>
319 </para>
320
321 @context: 
322
323
324 <!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
325 <para>
326
327 </para>
328
329 @colormap: 
330 @pixmap: 
331 @mask: 
332 @hot_x: 
333 @hot_y: 
334
335
336 <!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
337 <para>
338
339 </para>
340
341 @widget: 
342 @start_x: 
343 @start_y: 
344 @current_x: 
345 @current_y: 
346 @Returns: 
347
348
349 <!-- ##### FUNCTION gtk_drag_source_set ##### -->
350 <para>
351
352 </para>
353
354 @widget:
355 @start_button_mask:
356 @targets:
357 @n_targets:
358 @actions:
359
360
361 <!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
362 <para>
363 </para>
364
365 @widget: 
366 @colormap: 
367 @pixmap: 
368 @mask: 
369
370
371 <!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
372 <para>
373
374 </para>
375
376 @widget: 
377 @pixbuf: 
378
379
380 <!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
381 <para>
382
383 </para>
384
385 @widget: 
386 @stock_id: 
387
388
389 <!-- ##### FUNCTION gtk_drag_source_set_icon_name ##### -->
390 <para>
391
392 </para>
393
394 @widget: 
395 @icon_name: 
396
397
398 <!-- ##### FUNCTION gtk_drag_source_unset ##### -->
399 <para>
400 Undoes the effects of gtk_drag_source_set().
401 </para>
402
403 @widget: a #GtkWidget
404
405
406 <!-- ##### FUNCTION gtk_drag_source_set_target_list ##### -->
407 <para>
408
409 </para>
410
411 @widget: 
412 @target_list: 
413
414
415 <!-- ##### FUNCTION gtk_drag_source_get_target_list ##### -->
416 <para>
417
418 </para>
419
420 @widget: 
421 @Returns: 
422
423
424 <!-- ##### FUNCTION gtk_drag_source_add_text_targets ##### -->
425 <para>
426
427 </para>
428
429 @widget: 
430
431
432 <!-- ##### FUNCTION gtk_drag_source_add_image_targets ##### -->
433 <para>
434
435 </para>
436
437 @widget: 
438
439
440 <!-- ##### FUNCTION gtk_drag_source_add_uri_targets ##### -->
441 <para>
442
443 </para>
444
445 @widget: 
446
447