alternative to assert
[gtkD.git] / gtkD / src / gdk / Selection.d
blobcf36c8793c9cd81edcec7fc7f3b182816a14a723
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gdk-Selections.html
26 * outPack = gdk
27 * outFile = Selection
28 * strct =
29 * realStrct=
30 * ctorStrct=
31 * clss = Selection
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gdk_selection_
40 * omit structs:
41 * omit prefixes:
42 * omit code:
43 * imports:
44 * - gdk.Window
45 * - gdk.Display
46 * structWrap:
47 * - GdkDisplay* -> Display
48 * - GdkWindow* -> Window
49 * module aliases:
50 * local aliases:
53 module gdk.Selection;
55 version(noAssert)
57 version(Tango)
59 import tango.io.Stdout; // use the tango loging?
63 private import gtkc.gdktypes;
65 private import gtkc.gdk;
68 private import gdk.Window;
69 private import gdk.Display;
74 /**
75 * Description
76 * The X selection mechanism provides a way to transfer
77 * arbitrary chunks of data between programs.
78 * A selection is a essentially
79 * a named clipboard, identified by a string interned
80 * as a GdkAtom. By claiming ownership of a selection,
81 * an application indicates that it will be responsible
82 * for supplying its contents. The most common
83 * selections are PRIMARY and
84 * CLIPBOARD.
85 * The contents of a selection can be represented in
86 * a number of formats, called targets.
87 * Each target is identified by an atom. A list of
88 * all possible targets supported by the selection owner
89 * can be retrieved by requesting the special target
90 * TARGETS. When a selection is
91 * retrieved, the data is accompanied by a type
92 * (an atom), and a format (an integer, representing
93 * the number of bits per item).
94 * See Properties and Atoms
95 * for more information.
96 * The functions in this section only contain the lowlevel
97 * parts of the selection protocol. A considerably more
98 * complicated implementation is needed on top of this.
99 * GTK+ contains such an implementation in the functions
100 * in gtkselection.h and programmers
101 * should use those functions instead of the ones presented
102 * here. If you plan to implement selection handling
103 * directly on top of the functions here, you should refer
104 * to the X Inter-client Communication Conventions Manual
105 * (ICCCM).
107 public class Selection
133 * Sets the owner of the given selection.
134 * owner:
135 * a GdkWindow or NULL to indicate that the
136 * the owner for the given should be unset.
137 * selection:
138 * an atom identifying a selection.
139 * time_:
140 * timestamp to use when setting the selection.
141 * If this is older than the timestamp given last
142 * time the owner was set for the given selection, the
143 * request will be ignored.
144 * send_event:
145 * if TRUE, and the new owner is different
146 * from the current owner, the current owner
147 * will be sent a SelectionClear event.
148 * Returns:
149 * TRUE if the selection owner was successfully
150 * changed to owner, otherwise FALSE.
152 public static int ownerSet(Window owner, GdkAtom selection, uint time, int sendEvent)
154 // gboolean gdk_selection_owner_set (GdkWindow *owner, GdkAtom selection, guint32 time_, gboolean send_event);
155 return gdk_selection_owner_set((owner is null) ? null : owner.getWindowStruct(), selection, time, sendEvent);
159 * Sets the GdkWindow owner as the current owner of the selection selection.
160 * display:
161 * the GdkDisplay.
162 * owner:
163 * a GdkWindow or NULL to indicate that the owner for
164 * the given should be unset.
165 * selection:
166 * an atom identifying a selection.
167 * time_:
168 * timestamp to use when setting the selection.
169 * If this is older than the timestamp given last time the owner was
170 * set for the given selection, the request will be ignored.
171 * send_event:
172 * if TRUE, and the new owner is different from the current
173 * owner, the current owner will be sent a SelectionClear event.
174 * Returns:
175 * TRUE if the selection owner was successfully changed to owner,
176 * otherwise FALSE.
177 * Since 2.2
179 public static int ownerSetForDisplay(Display display, Window owner, GdkAtom selection, uint time, int sendEvent)
181 // gboolean gdk_selection_owner_set_for_display (GdkDisplay *display, GdkWindow *owner, GdkAtom selection, guint32 time_, gboolean send_event);
182 return gdk_selection_owner_set_for_display((display is null) ? null : display.getDisplayStruct(), (owner is null) ? null : owner.getWindowStruct(), selection, time, sendEvent);
186 * Determines the owner of the given selection.
187 * selection:
188 * an atom indentifying a selection.
189 * Returns:
190 * if there is a selection owner for this window,
191 * and it is a window known to the current process,
192 * the GdkWindow that owns the selection, otherwise
193 * NULL. Note that the return value may be owned
194 * by a different process if a foreign window
195 * was previously created for that window, but
196 * a new foreign window will never be created by
197 * this call.
199 public static Window ownerGet(GdkAtom selection)
201 // GdkWindow* gdk_selection_owner_get (GdkAtom selection);
202 return new Window( gdk_selection_owner_get(selection) );
206 * Determine the owner of the given selection.
207 * Note that the return value may be owned by a different
208 * process if a foreign window was previously created for that
209 * window, but a new foreign window will never be created by this call.
210 * display:
211 * a GdkDisplay.
212 * selection:
213 * an atom indentifying a selection.
214 * Returns:
215 * if there is a selection owner for this window, and it is a
216 * window known to the current process, the GdkWindow that owns the
217 * selection, otherwise NULL.
218 * Since 2.2
220 public static Window ownerGetForDisplay(Display display, GdkAtom selection)
222 // GdkWindow* gdk_selection_owner_get_for_display (GdkDisplay *display, GdkAtom selection);
223 return new Window( gdk_selection_owner_get_for_display((display is null) ? null : display.getDisplayStruct(), selection) );
227 * Retrieves the contents of a selection in a given
228 * form.
229 * requestor:
230 * a GdkWindow.
231 * selection:
232 * an atom identifying the selection to get the
233 * contents of.
234 * target:
235 * the form in which to retrieve the selection.
236 * time_:
237 * the timestamp to use when retrieving the
238 * selection. The selection owner may refuse the
239 * request if it did not own the selection at
240 * the time indicated by the timestamp.
242 public static void convert(Window requestor, GdkAtom selection, GdkAtom target, uint time)
244 // void gdk_selection_convert (GdkWindow *requestor, GdkAtom selection, GdkAtom target, guint32 time_);
245 gdk_selection_convert((requestor is null) ? null : requestor.getWindowStruct(), selection, target, time);
249 * Retrieves selection data that was stored by the selection
250 * data in response to a call to gdk_selection_convert(). This function
251 * will not be used by applications, who should use the GtkClipboard
252 * API instead.
253 * requestor:
254 * the window on which the data is stored
255 * data:
256 * location to store a pointer to the retrieved data.
257 * If the retrieval failed, NULL we be stored here, otherwise, it
258 * will be non-NULL and the returned data should be freed with g_free()
259 * when you are finished using it. The length of the
260 * allocated memory is one more than the length
261 * of the returned data, and the final byte will always
262 * be zero, to ensure nul-termination of strings.
263 * prop_type:
264 * location to store the type of the property.
265 * prop_format:
266 * location to store the format of the property.
267 * Returns:
268 * the length of the retrieved data.
270 public static int propertyGet(Window requestor, char** data, GdkAtom* propType, int* propFormat)
272 // gboolean gdk_selection_property_get (GdkWindow *requestor, guchar **data, GdkAtom *prop_type, gint *prop_format);
273 return gdk_selection_property_get((requestor is null) ? null : requestor.getWindowStruct(), data, propType, propFormat);
277 * Sends a response to SelectionRequest event.
278 * requestor:
279 * window to which to deliver response.
280 * selection:
281 * selection that was requested.
282 * target:
283 * target that was selected.
284 * property:
285 * property in which the selection owner stored the
286 * data, or GDK_NONE to indicate that the request
287 * was rejected.
288 * time_:
289 * timestamp.
291 public static void sendNotify(uint requestor, GdkAtom selection, GdkAtom target, GdkAtom property, uint time)
293 // void gdk_selection_send_notify (guint32 requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time_);
294 gdk_selection_send_notify(requestor, selection, target, property, time);
298 * Send a response to SelectionRequest event.
299 * display:
300 * the GdkDisplay where requestor is realized
301 * requestor:
302 * window to which to deliver response.
303 * selection:
304 * selection that was requested.
305 * target:
306 * target that was selected.
307 * property:
308 * property in which the selection owner stored the data,
309 * or GDK_NONE to indicate that the request was rejected.
310 * time_:
311 * timestamp.
312 * Since 2.2
314 public static void sendNotifyForDisplay(Display display, uint requestor, GdkAtom selection, GdkAtom target, GdkAtom property, uint time)
316 // void gdk_selection_send_notify_for_display (GdkDisplay *display, guint32 requestor, GdkAtom selection, GdkAtom target, GdkAtom property, guint32 time_);
317 gdk_selection_send_notify_for_display((display is null) ? null : display.getDisplayStruct(), requestor, selection, target, property, time);