summaryrefslogtreecommitdiff
path: root/docs/reference/gtk/tmpl/gtkselection.sgml
blob: 0074a40d10995cdfbcb737b5997abb5d9d32d551 (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
344
345
<!-- ##### SECTION Title ##### -->
Selections

<!-- ##### SECTION Short_Description ##### -->
Functions for handling inter-process communication via selections.

<!-- ##### SECTION Long_Description ##### -->

<para>
The selection mechanism provides the basis for different types
of IPC between processes. In particular, drag and drop and
#GtkClipboard work via selections. You will very seldom or
never need to use most of the functions in this section directly;
#GtkClipboard provides a nicer interface to the same functionality.
</para>
<para>
Some of the datatypes defined this section are used in
the #GtkClipboard and drag-and-drop API's as well. The
#GtkTargetEntry structure and #GtkTargetList objects represent
lists of data types that are supported when sending or
receiving data. The #GtkSelectionData object is used to
store a chunk of data along with the data type and other
associated information.
</para>

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

<varlistentry>
<term>#GtkWidget</term>
<listitem><para>Much of the operation of selections happens via
             signals for #GtkWidget. In particular, if you are
             using the functions in this section, you may need
             to pay attention to ::selection_get,
             ::selection_received,  and :selection_clear_event
             signals.</para></listitem>
</varlistentry>

</variablelist>

</para>

<!-- ##### STRUCT GtkTargetEntry ##### -->
<para>
A #GtkTargetEntry structure represents a single type of
data than can be supplied for by a widget for a selection
or for supplied or received during drag-and-drop. It 
contains a string representing the drag type, a flags
field (used only for drag and drop - see #GtkTargetFlags),
and an application assigned integer ID. The integer
ID will later be passed as a signal parameter for signals
like "selection_get". It allows the application to identify
the target type without extensive string compares.
</para>

@target: 
@flags: 
@info: 

<!-- ##### STRUCT GtkTargetList ##### -->
<para>
A #GtkTargetList structure is a reference counted list
of #GtkTargetPair. It is used to represent the same
information as a table of #GtkTargetEntry, but in
an efficient form. This structure should be treated as
opaque.
</para>

@list: 
@ref_count: 

<!-- ##### STRUCT GtkTargetPair ##### -->
<para>
Internally used structure in the drag-and-drop and 
selection handling code.
</para>

@target: 
@flags: 
@info: 

<!-- ##### FUNCTION gtk_target_list_new ##### -->
<para>
Create a new #GtkTargetList from an array of #GtkTargetEntry.
</para>

@targets: Pointer to an array of #GtkTargetEntry
@ntargets: number of entries in @targets.
@Returns: the new #GtkTargetList.


<!-- ##### FUNCTION gtk_target_list_ref ##### -->
<para>
Increase the reference count of a #GtkTargetList by one.
</para>

@list: a #GtkTargetList


<!-- ##### FUNCTION gtk_target_list_unref ##### -->
<para>
Decrease the reference count of a #GtkTargetList by one.
If the resulting reference count is zero, free the list.
</para>

@list: a #GtkTargetList


<!-- ##### FUNCTION gtk_target_list_add ##### -->
<para>
Add another target to a #GtkTargetList
</para>

@list: a #GtkTargetList
@target: the interned atom representing the target
@flags: the flags for this target
@info: an ID that will be passed back to the application


<!-- ##### FUNCTION gtk_target_list_add_table ##### -->
<para>
Add a table of #GtkTargetEntry into a target list
</para>

@list: a #GtkTargetList
@targets: the table of #GtkTargetEntry
@ntargets: number of targets in the table


<!-- ##### FUNCTION gtk_target_list_remove ##### -->
<para>
Remove a target from a target list
</para>

@list: a #GtkTargetList
@target: the interned atom representing the target


<!-- ##### FUNCTION gtk_target_list_find ##### -->
<para>
Look up a given target in a #GtkTargetList
</para>

@list: a #GtkTargetList
@target: an interned atom representing the target to search for
@info: a pointer to the location to store application info for target
@Returns: %TRUE if the target was found, otherwise %FALSE


<!-- ##### FUNCTION gtk_selection_owner_set ##### -->
<para>
Claim ownership of a given selection for a particular widget,
or, if @widget is %NULL, release ownership of the selection.
</para>

@widget: a #GtkWidget, or %NULL.
@selection: an interned atom representing the selection to claim
@time: the time stamp for claiming the selection
@Returns: %TRUE if the operation succeeded


<!-- ##### FUNCTION gtk_selection_add_target ##### -->
<para>
Add specified target to the list of supported targets for a 
given widget and selection.
</para>

@widget: a #GtkTarget
@selection: the selection
@target: target to add.
@info: A unsigned integer which will be passed back to the application.


<!-- ##### FUNCTION gtk_selection_add_targets ##### -->
<para>
Add a table of targets to the list of supported targets
for a given widget and selection.
</para>

@widget: a #GtkWidget
@selection: the selection
@targets: a table of targets to add
@ntargets: number of entries in @targets


<!-- ##### FUNCTION gtk_selection_clear_targets ##### -->
<para>

</para>

@widget: 
@selection: 


<!-- ##### FUNCTION gtk_selection_convert ##### -->
<para>
Request the contents of a selection. When received, 
a "selection_received" signal will be generated.
</para>

@widget: The widget which acts as requestor
@selection: Which selection to get
@target: Form of information desired (e.g., STRING)
@time: Time of request (usually of triggering event)
       In emergency, you could use GDK_CURRENT_TIME
@Returns: TRUE if requested succeeded. FALSE if we could not process
          request. (e.g., there was already a request in process for
          this widget).


<!-- ##### FUNCTION gtk_selection_data_set ##### -->
<para>
Store new data into a GtkSelectionData object. Should
_only_ by called from a selection handler callback.
Null terminates the stored data.
</para>

@selection_data: 
@type: the type of selection data
@format: format (number of bits in a unit)
@data: pointer to the data (will be copied)
@length: length of the data


<!-- ##### FUNCTION gtk_selection_data_set_text ##### -->
<para>

</para>

@selection_data: 
@str: 
@len: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_data_get_text ##### -->
<para>

</para>

@selection_data: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_data_get_targets ##### -->
<para>

</para>

@selection_data: 
@targets: 
@n_atoms: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_data_targets_include_text ##### -->
<para>

</para>

@selection_data: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_remove_all ##### -->
<para>
Removes all handlers and unsets ownership of all 
selections for a widget. Called when widget is being
destroyed. This function will not generally be
called by applications.
</para>

@widget: a #GtkWidget


<!-- ##### FUNCTION gtk_selection_data_copy ##### -->
<para>
Make a copy of a #GtkSelection data structure and its
data.
</para>

@data: a pointer to a #GtkSelectionData structure.
@Returns: a pointer to a copy of @data.


<!-- ##### FUNCTION gtk_selection_data_free ##### -->
<para>
Free a #GtkSelectionData structure returned from
gtk_selection_data_copy().
</para>

@data: a pointer to a #GtkSelectionData structure.


<!-- ##### FUNCTION gtk_selection_clear ##### -->
<para>
Internal function.
</para>

@widget: 
@event: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_incr_event ##### -->
<para>
Internal function.
</para>

@window: 
@event: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_notify ##### -->
<para>
Internal function.
</para>

@widget: 
@event: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_property_notify ##### -->
<para>
Internal function.
</para>

@widget: 
@event: 
@Returns: 


<!-- ##### FUNCTION gtk_selection_request ##### -->
<para>
Internal function.
</para>

@widget: 
@event: 
@Returns: