summaryrefslogtreecommitdiff
path: root/docs/reference/gtk/tmpl/gtkdnd.sgml
blob: 528000022caac8daef8527ef5755caeac7fc46ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
<!-- ##### SECTION Title ##### -->
Drag and Drop

<!-- ##### SECTION Short_Description ##### -->
Functions for controlling drag and drop handling

<!-- ##### SECTION Long_Description ##### -->
<para>
GTK+ has a rich set of functions for doing inter-process
communication via the drag-and-drop metaphor. GTK+
can do drag-and-drop (DND) via multiple protocols.
The currently supported protocols are the Xdnd and
Motif protocols.

As well as the functions listed here, applications
may need to use some facilities provided for
<link linkend="gtk-Selections">Selections</link>.
Also, the Drag and Drop API makes use of signals
in the #GtkWidget class.
</para>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### ENUM GtkDestDefaults ##### -->
<para>
The #GtkDestDefaults enumeration specifies the various
types of action that will be taken on behalf
of the user for a drag destination site.
</para>

@GTK_DEST_DEFAULT_MOTION: 
   If set for a widget, GTK+, during a drag over this
   widget will check if the drag matches this widget's
   list of possible targets and actions.
   GTK+ will then call gdk_drag_status() as appropriate.
@GTK_DEST_DEFAULT_HIGHLIGHT: 
   If set for a widget, GTK+ will draw a highlight on
   this widget as long as a drag is over this widget
   and the widget drag format and action are acceptable.
@GTK_DEST_DEFAULT_DROP: 
   If set for a widget, when a drop occurs, GTK+ will
   will check if the drag matches this widget's
   list of possible targets and actions. If so, 
   GTK+ will call gtk_drag_get_data() on behalf 
   of the widget. Whether or not the drop is successful,
   GTK+ will call gtk_drag_finish(). If the action
   was a move, then if the drag was successful, then
   %TRUE will be passed for the @delete parameter
   to gtk_drag_finish().
@GTK_DEST_DEFAULT_ALL: 
   If set, specifies that all default actions should
   be taken.

<!-- ##### ENUM GtkTargetFlags ##### -->
<para>
The #GtkTargetFlags enumeration is used to specify
constraints on an entry in a #GtkTargetTable. 
</para>

@GTK_TARGET_SAME_APP: 
   If this is set, the target will only be selected
   for drags within a single application.
@GTK_TARGET_SAME_WIDGET: 
   If this is set, the target will only be selected
   for drags within a single widget.

<!-- ##### FUNCTION gtk_drag_dest_set ##### -->
<para>
Sets a widget as a potential drop destination.
</para>

@widget: a #GtkWidget
@flags: the flags that specify what actions GTK+ should take
 on behalf of a widget for drops onto that widget. The @targets
 and @actions fields only are used if %GTK_DEST_DEFAULT_MOTION
 or %GTK_DEST_DEFAULT_DROP are given.
@targets: a pointer to an array of #GtkTargetEntry<!-- -->s indicating
 the drop types that this widget will accept.
@n_targets: the number of entries in @targets.
@actions: a bitmask of possible actions for a drop onto this
 widget.


<!-- ##### FUNCTION gtk_drag_dest_set_proxy ##### -->
<para>
Sets this widget as a proxy for drops to another window.
</para>

@widget: a #GtkWidget
@proxy_window: the window to which to forward drag events
@protocol: the drag protocol which the @proxy_window accepts
           (You can use gdk_drag_get_protocol() to determine this)
@use_coordinates: If %TRUE, send the same coordinates to the
                  destination, because it is an embedded 
                  subwindow.


<!-- ##### FUNCTION gtk_drag_dest_unset ##### -->
<para>
Clears information about a drop destination set with
gtk_drag_dest_set(). The widget will no longer receive
notification of drags.
</para>

@widget: a #GtkWidget


<!-- ##### FUNCTION gtk_drag_dest_find_target ##### -->
<para>

</para>

@widget: 
@context: 
@target_list: 
@Returns: 


<!-- ##### FUNCTION gtk_drag_dest_get_target_list ##### -->
<para>

</para>

@widget: 
@Returns: 


<!-- ##### FUNCTION gtk_drag_dest_set_target_list ##### -->
<para>

</para>

@widget: 
@target_list: 


<!-- ##### FUNCTION gtk_drag_finish ##### -->
<para>
Informs the drag source that the drop is finished, and
that the data of the drag will no longer be required.
</para>

@context: the drag context.
@success: a flag indicating whether the drop was successful
@del: a flag indicating whether the source should delete the
      original data. (This should be %TRUE for a move)
@time_: the timestamp from the "drag_data_drop" signal.


<!-- ##### FUNCTION gtk_drag_get_data ##### -->
<para>
Gets the data associated with a drag. When the data
is received or the retrieval fails, GTK+ will emit a 
"drag_data_received" signal. Failure of the retrieval
is indicated by the length field of the @selection_data
signal parameter being negative. However, when gtk_drag_get_data() 
is called implicitely because the %GTK_DEST_DEFAULT_DROP was set, 
then the widget will not receive notification of failed
drops.
</para>

@widget: the widget that will receive the "drag_data_received"
 signal.
@context: the drag context
@target: the target (form of the data) to retrieve.
@time_: a timestamp for retrieving the data. This will
       generally be the time received in a "drag_data_motion"
       or "drag_data_drop" signal.


<!-- ##### FUNCTION gtk_drag_get_source_widget ##### -->
<para>
Determines the source widget for a drag.
</para>

@context: a (destination side) drag context.
@Returns: if the drag is occurring within a single application,
          a pointer to the source widget. Otherwise, %NULL.


<!-- ##### FUNCTION gtk_drag_highlight ##### -->
<para>
Draws a highlight around a widget. This will attach
handlers to  "expose_event" and "draw", so the highlight
will continue to be displayed until gtk_drag_unhighlight()
is called.
</para>

@widget: a widget to highlight


<!-- ##### FUNCTION gtk_drag_unhighlight ##### -->
<para>
Removes a highlight set by gtk_drag_highlight() from
a widget.
</para>

@widget: a widget to remove the highlight from.


<!-- ##### FUNCTION gtk_drag_begin ##### -->
<para>

</para>

@widget: 
@targets: 
@actions: 
@button: 
@event: 
@Returns: 


<!-- ##### FUNCTION gtk_drag_set_icon_widget ##### -->
<para>
</para>

@context: 
@widget: 
@hot_x: 
@hot_y: 


<!-- ##### FUNCTION gtk_drag_set_icon_pixmap ##### -->
<para>
</para>

@context: 
@colormap: 
@pixmap: 
@mask: 
@hot_x: 
@hot_y: 


<!-- ##### FUNCTION gtk_drag_set_icon_pixbuf ##### -->
<para>

</para>

@context: 
@pixbuf: 
@hot_x: 
@hot_y: 


<!-- ##### FUNCTION gtk_drag_set_icon_stock ##### -->
<para>

</para>

@context: 
@stock_id: 
@hot_x: 
@hot_y: 


<!-- ##### FUNCTION gtk_drag_set_icon_default ##### -->
<para>
</para>

@context: 


<!-- ##### FUNCTION gtk_drag_set_default_icon ##### -->
<para>

</para>

@colormap: 
@pixmap: 
@mask: 
@hot_x: 
@hot_y: 


<!-- ##### FUNCTION gtk_drag_check_threshold ##### -->
<para>

</para>

@widget: 
@start_x: 
@start_y: 
@current_x: 
@current_y: 
@Returns: 


<!-- ##### FUNCTION gtk_drag_source_set ##### -->
<para>
Sets up a widget so that GTK+ will start a drag
operation when the user clicks and drags on the
widget. The widget must have a window.
</para>

@widget: a #GtkWidget
@start_button_mask: the bitmask of buttons that can start the drag
@targets: the table of targets that the drag will support
@n_targets: the number of items in @targets
@actions: the bitmask of possible actions for a drag from this
 widget.


<!-- ##### FUNCTION gtk_drag_source_set_icon ##### -->
<para>
</para>

@widget: 
@colormap: 
@pixmap: 
@mask: 


<!-- ##### FUNCTION gtk_drag_source_set_icon_pixbuf ##### -->
<para>

</para>

@widget: 
@pixbuf: 


<!-- ##### FUNCTION gtk_drag_source_set_icon_stock ##### -->
<para>

</para>

@widget: 
@stock_id: 


<!-- ##### FUNCTION gtk_drag_source_unset ##### -->
<para>
Undoes the effects of gtk_drag_source_set().
</para>

@widget: a #GtkWidget