1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gtk-Clipboards.html
27  * outPack = gtk
28  * outFile = Clipboard
29  * strct   = GtkClipboard
30  * realStrct=
31  * ctorStrct=
32  * clss    = Clipboard
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_clipboard_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gdk.Display
49  * 	- gtk.TextBuffer
50  * 	- gobject.ObjectG
51  * 	- gdk.Pixbuf
52  * structWrap:
53  * 	- GObject* -> ObjectG
54  * 	- GdkDisplay* -> Display
55  * 	- GdkPixbuf* -> Pixbuf
56  * 	- GtkClipboard* -> Clipboard
57  * 	- GtkTextBuffer* -> TextBuffer
58  * module aliases:
59  * local aliases:
60  * overrides:
61  */
62 
63 module gtk.Clipboard;
64 
65 public  import gtkc.gtktypes;
66 
67 private import gtkc.gtk;
68 private import glib.ConstructionException;
69 private import gobject.ObjectG;
70 
71 private import gobject.Signals;
72 public  import gtkc.gdktypes;
73 
74 private import glib.Str;
75 private import gdk.Display;
76 private import gtk.TextBuffer;
77 private import gobject.ObjectG;
78 private import gdk.Pixbuf;
79 
80 
81 
82 private import gobject.ObjectG;
83 
84 /**
85  * Description
86  *  The GtkClipboard object represents a clipboard of data shared
87  *  between different processes or between different widgets in
88  *  the same process. Each clipboard is identified by a name encoded as a
89  *  GdkAtom. (Conversion to and from strings can be done with
90  *  gdk_atom_intern() and gdk_atom_name().) The default clipboard
91  *  corresponds to the "CLIPBOARD" atom; another commonly used clipboard
92  *  is the "PRIMARY" clipboard, which, in X, traditionally contains
93  *  the currently selected text.
94  *  To support having a number of different formats on the clipboard
95  *  at the same time, the clipboard mechanism allows providing
96  *  callbacks instead of the actual data. When you set the contents
97  *  of the clipboard, you can either supply the data directly (via
98  *  functions like gtk_clipboard_set_text()), or you can supply a
99  *  callback to be called at a later time when the data is needed (via
100  *  gtk_clipboard_set_with_data() or gtk_clipboard_set_with_owner().)
101  *  Providing a callback also avoids having to make copies of the data
102  *  when it is not needed.
103  *  gtk_clipboard_set_with_data() and gtk_clipboard_set_with_owner()
104  *  are quite similar; the choice between the two depends mostly on
105  *  which is more convenient in a particular situation.
106  *  The former is most useful when you want to have a blob of data
107  *  with callbacks to convert it into the various data types that you
108  *  advertise. When the clear_func you provided is called, you
109  *  simply free the data blob. The latter is more useful when the
110  *  contents of clipboard reflect the internal state of a GObject
111  *  (As an example, for the PRIMARY clipboard, when an entry widget
112  *  provides the clipboard's contents the contents are simply the
113  *  text within the selected region.) If the contents change, the
114  *  entry widget can call gtk_clipboard_set_with_owner() to update
115  *  the timestamp for clipboard ownership, without having to worry
116  *  about clear_func being called.
117  *  Requesting the data from the clipboard is essentially
118  *  asynchronous. If the contents of the clipboard are provided within
119  *  the same process, then a direct function call will be made to
120  *  retrieve the data, but if they are provided by another process,
121  *  then the data needs to be retrieved from the other process, which
122  *  may take some time. To avoid blocking the user interface, the call
123  *  to request the selection, gtk_clipboard_request_contents() takes a
124  *  callback that will be called when the contents are received (or
125  *  when the request fails.) If you don't want to deal with providing
126  *  a separate callback, you can also use gtk_clipboard_wait_for_contents().
127  *  What this does is run the GLib main loop recursively waiting for
128  *  the contents. This can simplify the code flow, but you still have
129  *  to be aware that other callbacks in your program can be called
130  *  while this recursive mainloop is running.
131  *  Along with the functions to get the clipboard contents as an
132  *  arbitrary data chunk, there are also functions to retrieve
133  *  it as text, gtk_clipboard_request_text() and
134  *  gtk_clipboard_wait_for_text(). These functions take care of
135  *  determining which formats are advertised by the clipboard
136  *  provider, asking for the clipboard in the best available format
137  *  and converting the results into the UTF-8 encoding. (The standard
138  *  form for representing strings in GTK+.)
139  */
140 public class Clipboard : ObjectG
141 {
142 	
143 	/** the main Gtk struct */
144 	protected GtkClipboard* gtkClipboard;
145 	
146 	
147 	public GtkClipboard* getClipboardStruct()
148 	{
149 		return gtkClipboard;
150 	}
151 	
152 	
153 	/** the main Gtk struct as a void* */
154 	protected override void* getStruct()
155 	{
156 		return cast(void*)gtkClipboard;
157 	}
158 	
159 	/**
160 	 * Sets our main struct and passes it to the parent class
161 	 */
162 	public this (GtkClipboard* gtkClipboard)
163 	{
164 		super(cast(GObject*)gtkClipboard);
165 		this.gtkClipboard = gtkClipboard;
166 	}
167 	
168 	protected override void setStruct(GObject* obj)
169 	{
170 		super.setStruct(obj);
171 		gtkClipboard = cast(GtkClipboard*)obj;
172 	}
173 	
174 	/**
175 	 */
176 	int[string] connectedSignals;
177 	
178 	void delegate(GdkEvent*, Clipboard)[] onOwnerChangeListeners;
179 	/**
180 	 * The ::owner-change signal is emitted when GTK+ receives an
181 	 * event that indicates that the ownership of the selection
182 	 * associated with clipboard has changed.
183 	 * Since 2.6
184 	 * See Also
185 	 * GtkSelection
186 	 * GtkClipboard provides a high-level wrapper around the
187 	 * 	 lower level routines that deal with X selections. It is
188 	 * 	 also possibly to directly manipulate the X selections,
189 	 * 	 though it is seldom necessary to do so.
190 	 */
191 	void addOnOwnerChange(void delegate(GdkEvent*, Clipboard) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
192 	{
193 		if ( !("owner-change" in connectedSignals) )
194 		{
195 			Signals.connectData(
196 			getStruct(),
197 			"owner-change",
198 			cast(GCallback)&callBackOwnerChange,
199 			cast(void*)this,
200 			null,
201 			connectFlags);
202 			connectedSignals["owner-change"] = 1;
203 		}
204 		onOwnerChangeListeners ~= dlg;
205 	}
206 	extern(C) static void callBackOwnerChange(GtkClipboard* clipboardStruct, GdkEvent* event, Clipboard _clipboard)
207 	{
208 		foreach ( void delegate(GdkEvent*, Clipboard) dlg ; _clipboard.onOwnerChangeListeners )
209 		{
210 			dlg(event, _clipboard);
211 		}
212 	}
213 	
214 	
215 	/**
216 	 * Returns the clipboard object for the given selection.
217 	 * See gtk_clipboard_get_for_display() for complete details.
218 	 * Params:
219 	 * selection = a GdkAtom which identifies the clipboard to use
220 	 * Returns: the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent and, since it is owned by GTK+, must not be freed or unreffed. [transfer none]
221 	 */
222 	public static Clipboard get(GdkAtom selection)
223 	{
224 		// GtkClipboard * gtk_clipboard_get (GdkAtom selection);
225 		auto p = gtk_clipboard_get(selection);
226 		
227 		if(p is null)
228 		{
229 			return null;
230 		}
231 		
232 		return ObjectG.getDObject!(Clipboard)(cast(GtkClipboard*) p);
233 	}
234 	
235 	/**
236 	 * Returns the clipboard object for the given selection.
237 	 * Cut/copy/paste menu items and keyboard shortcuts should use
238 	 * the default clipboard, returned by passing GDK_SELECTION_CLIPBOARD for selection.
239 	 * (GDK_NONE is supported as a synonym for GDK_SELECTION_CLIPBOARD
240 	 * for backwards compatibility reasons.)
241 	 * The currently-selected object or text should be provided on the clipboard
242 	 * identified by GDK_SELECTION_PRIMARY. Cut/copy/paste menu items
243 	 * conceptually copy the contents of the GDK_SELECTION_PRIMARY clipboard
244 	 * to the default clipboard, i.e. they copy the selection to what the
245 	 * user sees as the clipboard.
246 	 * (Passing GDK_NONE is the same as using gdk_atom_intern
247 	 * ("CLIPBOARD", FALSE). See
248 	 * http://www.freedesktop.org/Standards/clipboards-spec
249 	 * for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY"
250 	 * selections under the X window system. On Win32 the
251 	 * GDK_SELECTION_PRIMARY clipboard is essentially ignored.)
252 	 * It's possible to have arbitrary named clipboards; if you do invent
253 	 * new clipboards, you should prefix the selection name with an
254 	 * underscore (because the ICCCM requires that nonstandard atoms are
255 	 * underscore-prefixed), and namespace it as well. For example,
256 	 * if your application called "Foo" has a special-purpose
257 	 * clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD".
258 	 * Since 2.2
259 	 * Params:
260 	 * display = the display for which the clipboard is to be retrieved or created
261 	 * selection = a GdkAtom which identifies the clipboard
262 	 * to use.
263 	 * Returns: the appropriate clipboard object. If no clipboard already exists, a new one will be created. Once a clipboard object has been created, it is persistent and, since it is owned by GTK+, must not be freed or unrefd. [transfer none]
264 	 */
265 	public static Clipboard getForDisplay(Display display, GdkAtom selection)
266 	{
267 		// GtkClipboard * gtk_clipboard_get_for_display (GdkDisplay *display,  GdkAtom selection);
268 		auto p = gtk_clipboard_get_for_display((display is null) ? null : display.getDisplayStruct(), selection);
269 		
270 		if(p is null)
271 		{
272 			return null;
273 		}
274 		
275 		return ObjectG.getDObject!(Clipboard)(cast(GtkClipboard*) p);
276 	}
277 	
278 	/**
279 	 * Gets the GdkDisplay associated with clipboard
280 	 * Since 2.2
281 	 * Returns: the GdkDisplay associated with clipboard. [transfer none]
282 	 */
283 	public Display getDisplay()
284 	{
285 		// GdkDisplay * gtk_clipboard_get_display (GtkClipboard *clipboard);
286 		auto p = gtk_clipboard_get_display(gtkClipboard);
287 		
288 		if(p is null)
289 		{
290 			return null;
291 		}
292 		
293 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) p);
294 	}
295 	
296 	/**
297 	 * Virtually sets the contents of the specified clipboard by providing
298 	 * a list of supported formats for the clipboard data and a function
299 	 * to call to get the actual data when it is requested.
300 	 * Params:
301 	 * targets = array containing information about the available forms for the
302 	 * clipboard data
303 	 * getFunc = function to call to get the actual clipboard data
304 	 * clearFunc = when the clipboard contents are set again, this function will
305 	 * be called, and get_func will not be subsequently called.
306 	 * userData = user data to pass to get_func and clear_func.
307 	 * Returns: TRUE if setting the clipboard data succeeded. If setting the clipboard data failed the provided callback functions will be ignored.
308 	 */
309 	public int setWithData(GtkTargetEntry[] targets, GtkClipboardGetFunc getFunc, GtkClipboardClearFunc clearFunc, void* userData)
310 	{
311 		// gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard,  const GtkTargetEntry *targets,  guint n_targets,  GtkClipboardGetFunc get_func,  GtkClipboardClearFunc clear_func,  gpointer user_data);
312 		return gtk_clipboard_set_with_data(gtkClipboard, targets.ptr, cast(int) targets.length, getFunc, clearFunc, userData);
313 	}
314 	
315 	/**
316 	 * Virtually sets the contents of the specified clipboard by providing
317 	 * a list of supported formats for the clipboard data and a function
318 	 * to call to get the actual data when it is requested.
319 	 * The difference between this function and gtk_clipboard_set_with_data()
320 	 * is that instead of an generic user_data pointer, a GObject is passed
321 	 * in.
322 	 * Params:
323 	 * targets = array containing information about the available forms for the
324 	 * clipboard data
325 	 * getFunc = function to call to get the actual clipboard data
326 	 * clearFunc = when the clipboard contents are set again, this function will
327 	 * be called, and get_func will not be subsequently called.
328 	 * owner = an object that "owns" the data. This object will be passed
329 	 * to the callbacks when called.
330 	 * Returns: TRUE if setting the clipboard data succeeded. If setting the clipboard data failed the provided callback functions will be ignored.
331 	 */
332 	public int setWithOwner(GtkTargetEntry[] targets, GtkClipboardGetFunc getFunc, GtkClipboardClearFunc clearFunc, ObjectG owner)
333 	{
334 		// gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard,  const GtkTargetEntry *targets,  guint n_targets,  GtkClipboardGetFunc get_func,  GtkClipboardClearFunc clear_func,  GObject *owner);
335 		return gtk_clipboard_set_with_owner(gtkClipboard, targets.ptr, cast(int) targets.length, getFunc, clearFunc, (owner is null) ? null : owner.getObjectGStruct());
336 	}
337 	
338 	/**
339 	 * If the clipboard contents callbacks were set with
340 	 * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
341 	 * gtk_clipboard_clear() has not subsequently called, returns the owner set
342 	 * by gtk_clipboard_set_with_owner().
343 	 * Returns: the owner of the clipboard, if any; otherwise NULL. [transfer none]
344 	 */
345 	public ObjectG getOwner()
346 	{
347 		// GObject * gtk_clipboard_get_owner (GtkClipboard *clipboard);
348 		auto p = gtk_clipboard_get_owner(gtkClipboard);
349 		
350 		if(p is null)
351 		{
352 			return null;
353 		}
354 		
355 		return ObjectG.getDObject!(ObjectG)(cast(GObject*) p);
356 	}
357 	
358 	/**
359 	 * Clears the contents of the clipboard. Generally this should only
360 	 * be called between the time you call gtk_clipboard_set_with_owner()
361 	 * or gtk_clipboard_set_with_data(),
362 	 * and when the clear_func you supplied is called. Otherwise, the
363 	 * clipboard may be owned by someone else.
364 	 */
365 	public void clear()
366 	{
367 		// void gtk_clipboard_clear (GtkClipboard *clipboard);
368 		gtk_clipboard_clear(gtkClipboard);
369 	}
370 	
371 	/**
372 	 * Sets the contents of the clipboard to the given UTF-8 string. GTK+ will
373 	 * make a copy of the text and take responsibility for responding
374 	 * for requests for the text, and for converting the text into
375 	 * the requested format.
376 	 * Params:
377 	 * text = a UTF-8 string.
378 	 * len = length of text, in bytes, or -1, in which case
379 	 * the length will be determined with strlen().
380 	 */
381 	public void setText(string text, int len)
382 	{
383 		// void gtk_clipboard_set_text (GtkClipboard *clipboard,  const gchar *text,  gint len);
384 		gtk_clipboard_set_text(gtkClipboard, Str.toStringz(text), len);
385 	}
386 	
387 	/**
388 	 * Sets the contents of the clipboard to the given GdkPixbuf.
389 	 * GTK+ will take responsibility for responding for requests
390 	 * for the image, and for converting the image into the
391 	 * requested format.
392 	 * Since 2.6
393 	 * Params:
394 	 * pixbuf = a GdkPixbuf
395 	 */
396 	public void setImage(Pixbuf pixbuf)
397 	{
398 		// void gtk_clipboard_set_image (GtkClipboard *clipboard,  GdkPixbuf *pixbuf);
399 		gtk_clipboard_set_image(gtkClipboard, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
400 	}
401 	
402 	/**
403 	 * Requests the contents of clipboard as the given target.
404 	 * When the results of the result are later received the supplied callback
405 	 * will be called.
406 	 * Params:
407 	 * target = an atom representing the form into which the clipboard
408 	 * owner should convert the selection.
409 	 * callback = A function to call when the results are received
410 	 * (or the retrieval fails). If the retrieval fails
411 	 * the length field of selection_data will be
412 	 * negative.
413 	 * userData = user data to pass to callback
414 	 */
415 	public void requestContents(GdkAtom target, GtkClipboardReceivedFunc callback, void* userData)
416 	{
417 		// void gtk_clipboard_request_contents (GtkClipboard *clipboard,  GdkAtom target,  GtkClipboardReceivedFunc callback,  gpointer user_data);
418 		gtk_clipboard_request_contents(gtkClipboard, target, callback, userData);
419 	}
420 	
421 	/**
422 	 * Requests the contents of the clipboard as text. When the text is
423 	 * later received, it will be converted to UTF-8 if necessary, and
424 	 * callback will be called.
425 	 * The text parameter to callback will contain the resulting text if
426 	 * the request succeeded, or NULL if it failed. This could happen for
427 	 * various reasons, in particular if the clipboard was empty or if the
428 	 * contents of the clipboard could not be converted into text form.
429 	 * Params:
430 	 * callback = a function to call when the text is received,
431 	 * or the retrieval fails. (It will always be called
432 	 * one way or the other.)
433 	 * userData = user data to pass to callback.
434 	 */
435 	public void requestText(GtkClipboardTextReceivedFunc callback, void* userData)
436 	{
437 		// void gtk_clipboard_request_text (GtkClipboard *clipboard,  GtkClipboardTextReceivedFunc callback,  gpointer user_data);
438 		gtk_clipboard_request_text(gtkClipboard, callback, userData);
439 	}
440 	
441 	/**
442 	 * Requests the contents of the clipboard as image. When the image is
443 	 * later received, it will be converted to a GdkPixbuf, and
444 	 * callback will be called.
445 	 * The pixbuf parameter to callback will contain the resulting
446 	 * GdkPixbuf if the request succeeded, or NULL if it failed. This
447 	 * could happen for various reasons, in particular if the clipboard
448 	 * was empty or if the contents of the clipboard could not be
449 	 * converted into an image.
450 	 * Since 2.6
451 	 * Params:
452 	 * callback = a function to call when the image is received,
453 	 * or the retrieval fails. (It will always be called
454 	 * one way or the other.)
455 	 * userData = user data to pass to callback.
456 	 */
457 	public void requestImage(GtkClipboardImageReceivedFunc callback, void* userData)
458 	{
459 		// void gtk_clipboard_request_image (GtkClipboard *clipboard,  GtkClipboardImageReceivedFunc callback,  gpointer user_data);
460 		gtk_clipboard_request_image(gtkClipboard, callback, userData);
461 	}
462 	
463 	/**
464 	 * Requests the contents of the clipboard as list of supported targets.
465 	 * When the list is later received, callback will be called.
466 	 * The targets parameter to callback will contain the resulting targets if
467 	 * the request succeeded, or NULL if it failed.
468 	 * Since 2.4
469 	 * Params:
470 	 * callback = a function to call when the targets are received,
471 	 * or the retrieval fails. (It will always be called
472 	 * one way or the other.)
473 	 * userData = user data to pass to callback.
474 	 */
475 	public void requestTargets(GtkClipboardTargetsReceivedFunc callback, void* userData)
476 	{
477 		// void gtk_clipboard_request_targets (GtkClipboard *clipboard,  GtkClipboardTargetsReceivedFunc callback,  gpointer user_data);
478 		gtk_clipboard_request_targets(gtkClipboard, callback, userData);
479 	}
480 	
481 	/**
482 	 * Requests the contents of the clipboard as rich text. When the rich
483 	 * text is later received, callback will be called.
484 	 * The text parameter to callback will contain the resulting rich
485 	 * text if the request succeeded, or NULL if it failed. The length
486 	 * parameter will contain text's length. This function can fail for
487 	 * various reasons, in particular if the clipboard was empty or if the
488 	 * contents of the clipboard could not be converted into rich text form.
489 	 * Since 2.10
490 	 * Params:
491 	 * buffer = a GtkTextBuffer
492 	 * callback = a function to call when the text is received,
493 	 * or the retrieval fails. (It will always be called
494 	 * one way or the other.)
495 	 * userData = user data to pass to callback.
496 	 */
497 	public void requestRichText(TextBuffer buffer, GtkClipboardRichTextReceivedFunc callback, void* userData)
498 	{
499 		// void gtk_clipboard_request_rich_text (GtkClipboard *clipboard,  GtkTextBuffer *buffer,  GtkClipboardRichTextReceivedFunc callback,  gpointer user_data);
500 		gtk_clipboard_request_rich_text(gtkClipboard, (buffer is null) ? null : buffer.getTextBufferStruct(), callback, userData);
501 	}
502 	
503 	/**
504 	 * Requests the contents of the clipboard as URIs. When the URIs are
505 	 * later received callback will be called.
506 	 * The uris parameter to callback will contain the resulting array of
507 	 * URIs if the request succeeded, or NULL if it failed. This could happen
508 	 * for various reasons, in particular if the clipboard was empty or if the
509 	 * contents of the clipboard could not be converted into URI form.
510 	 * Since 2.14
511 	 * Params:
512 	 * callback = a function to call when the URIs are received,
513 	 * or the retrieval fails. (It will always be called
514 	 * one way or the other.)
515 	 * userData = user data to pass to callback.
516 	 */
517 	public void requestUris(GtkClipboardURIReceivedFunc callback, void* userData)
518 	{
519 		// void gtk_clipboard_request_uris (GtkClipboard *clipboard,  GtkClipboardURIReceivedFunc callback,  gpointer user_data);
520 		gtk_clipboard_request_uris(gtkClipboard, callback, userData);
521 	}
522 	
523 	/**
524 	 * Requests the contents of the clipboard using the given target.
525 	 * This function waits for the data to be received using the main
526 	 * loop, so events, timeouts, etc, may be dispatched during the wait.
527 	 * Params:
528 	 * target = an atom representing the form into which the clipboard
529 	 * owner should convert the selection.
530 	 * Returns: a newly-allocated GtkSelectionData object or NULL if retrieving the given target failed. If non-NULL, this value must be freed with gtk_selection_data_free() when you are finished with it.
531 	 */
532 	public GtkSelectionData* waitForContents(GdkAtom target)
533 	{
534 		// GtkSelectionData * gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,  GdkAtom target);
535 		return gtk_clipboard_wait_for_contents(gtkClipboard, target);
536 	}
537 	
538 	/**
539 	 * Requests the contents of the clipboard as text and converts
540 	 * the result to UTF-8 if necessary. This function waits for
541 	 * the data to be received using the main loop, so events,
542 	 * timeouts, etc, may be dispatched during the wait.
543 	 * Returns: a newly-allocated UTF-8 string which must be freed with g_free(), or NULL if retrieving the selection data failed. (This could happen for various reasons, in particular if the clipboard was empty or if the contents of the clipboard could not be converted into text form.)
544 	 */
545 	public string waitForText()
546 	{
547 		// gchar * gtk_clipboard_wait_for_text (GtkClipboard *clipboard);
548 		return Str.toString(gtk_clipboard_wait_for_text(gtkClipboard));
549 	}
550 	
551 	/**
552 	 * Requests the contents of the clipboard as image and converts
553 	 * the result to a GdkPixbuf. This function waits for
554 	 * the data to be received using the main loop, so events,
555 	 * timeouts, etc, may be dispatched during the wait.
556 	 * Since 2.6
557 	 * Returns: a newly-allocated GdkPixbuf object which must be disposed with g_object_unref(), or NULL if retrieving the selection data failed. (This could happen for various reasons, in particular if the clipboard was empty or if the contents of the clipboard could not be converted into an image.). [transfer full]
558 	 */
559 	public Pixbuf waitForImage()
560 	{
561 		// GdkPixbuf * gtk_clipboard_wait_for_image (GtkClipboard *clipboard);
562 		auto p = gtk_clipboard_wait_for_image(gtkClipboard);
563 		
564 		if(p is null)
565 		{
566 			return null;
567 		}
568 		
569 		return ObjectG.getDObject!(Pixbuf)(cast(GdkPixbuf*) p);
570 	}
571 	
572 	/**
573 	 * Requests the contents of the clipboard as rich text. This function
574 	 * waits for the data to be received using the main loop, so events,
575 	 * timeouts, etc, may be dispatched during the wait.
576 	 * Since 2.10
577 	 * Params:
578 	 * buffer = a GtkTextBuffer
579 	 * format = return location for the format of the returned data
580 	 * Returns: a newly-allocated binary block of data which must be freed with g_free(), or NULL if retrieving the selection data failed. (This could happen for various reasons, in particular if the clipboard was empty or if the contents of the clipboard could not be converted into text form.). [array length=length][transfer full]
581 	 */
582 	public ubyte[] waitForRichText(TextBuffer buffer, out GdkAtom format)
583 	{
584 		// guint8 * gtk_clipboard_wait_for_rich_text (GtkClipboard *clipboard,  GtkTextBuffer *buffer,  GdkAtom *format,  gsize *length);
585 		gsize length;
586 		auto p = gtk_clipboard_wait_for_rich_text(gtkClipboard, (buffer is null) ? null : buffer.getTextBufferStruct(), &format, &length);
587 		
588 		if(p is null)
589 		{
590 			return null;
591 		}
592 		
593 		return p[0 .. length];
594 	}
595 	
596 	/**
597 	 * Requests the contents of the clipboard as URIs. This function waits
598 	 * for the data to be received using the main loop, so events,
599 	 * timeouts, etc, may be dispatched during the wait.
600 	 * Since 2.14
601 	 * Returns: a newly-allocated NULL-terminated array of strings which must be freed with g_strfreev(), or NULL if retrieving the selection data failed. (This could happen for various reasons, in particular if the clipboard was empty or if the contents of the clipboard could not be converted into URI form.). [array zero-terminated=1][element-type utf8][transfer full]
602 	 */
603 	public string[] waitForUris()
604 	{
605 		// gchar ** gtk_clipboard_wait_for_uris (GtkClipboard *clipboard);
606 		return Str.toStringArray(gtk_clipboard_wait_for_uris(gtkClipboard));
607 	}
608 	
609 	/**
610 	 * Test to see if there is text available to be pasted
611 	 * This is done by requesting the TARGETS atom and checking
612 	 * if it contains any of the supported text targets. This function
613 	 * waits for the data to be received using the main loop, so events,
614 	 * timeouts, etc, may be dispatched during the wait.
615 	 * This function is a little faster than calling
616 	 * gtk_clipboard_wait_for_text() since it doesn't need to retrieve
617 	 * the actual text.
618 	 * Returns: TRUE is there is text available, FALSE otherwise.
619 	 */
620 	public int waitIsTextAvailable()
621 	{
622 		// gboolean gtk_clipboard_wait_is_text_available  (GtkClipboard *clipboard);
623 		return gtk_clipboard_wait_is_text_available(gtkClipboard);
624 	}
625 	
626 	/**
627 	 * Test to see if there is an image available to be pasted
628 	 * This is done by requesting the TARGETS atom and checking
629 	 * if it contains any of the supported image targets. This function
630 	 * waits for the data to be received using the main loop, so events,
631 	 * timeouts, etc, may be dispatched during the wait.
632 	 * This function is a little faster than calling
633 	 * gtk_clipboard_wait_for_image() since it doesn't need to retrieve
634 	 * the actual image data.
635 	 * Since 2.6
636 	 * Returns: TRUE is there is an image available, FALSE otherwise.
637 	 */
638 	public int waitIsImageAvailable()
639 	{
640 		// gboolean gtk_clipboard_wait_is_image_available  (GtkClipboard *clipboard);
641 		return gtk_clipboard_wait_is_image_available(gtkClipboard);
642 	}
643 	
644 	/**
645 	 * Test to see if there is rich text available to be pasted
646 	 * This is done by requesting the TARGETS atom and checking
647 	 * if it contains any of the supported rich text targets. This function
648 	 * waits for the data to be received using the main loop, so events,
649 	 * timeouts, etc, may be dispatched during the wait.
650 	 * This function is a little faster than calling
651 	 * gtk_clipboard_wait_for_rich_text() since it doesn't need to retrieve
652 	 * the actual text.
653 	 * Since 2.10
654 	 * Params:
655 	 * buffer = a GtkTextBuffer
656 	 * Returns: TRUE is there is rich text available, FALSE otherwise.
657 	 */
658 	public int waitIsRichTextAvailable(TextBuffer buffer)
659 	{
660 		// gboolean gtk_clipboard_wait_is_rich_text_available  (GtkClipboard *clipboard,  GtkTextBuffer *buffer);
661 		return gtk_clipboard_wait_is_rich_text_available(gtkClipboard, (buffer is null) ? null : buffer.getTextBufferStruct());
662 	}
663 	
664 	/**
665 	 * Test to see if there is a list of URIs available to be pasted
666 	 * This is done by requesting the TARGETS atom and checking
667 	 * if it contains the URI targets. This function
668 	 * waits for the data to be received using the main loop, so events,
669 	 * timeouts, etc, may be dispatched during the wait.
670 	 * This function is a little faster than calling
671 	 * gtk_clipboard_wait_for_uris() since it doesn't need to retrieve
672 	 * the actual URI data.
673 	 * Since 2.14
674 	 * Returns: TRUE is there is an URI list available, FALSE otherwise.
675 	 */
676 	public int waitIsUrisAvailable()
677 	{
678 		// gboolean gtk_clipboard_wait_is_uris_available  (GtkClipboard *clipboard);
679 		return gtk_clipboard_wait_is_uris_available(gtkClipboard);
680 	}
681 	
682 	/**
683 	 * Returns a list of targets that are present on the clipboard, or NULL
684 	 * if there aren't any targets available. The returned list must be
685 	 * freed with g_free().
686 	 * This function waits for the data to be received using the main
687 	 * loop, so events, timeouts, etc, may be dispatched during the wait.
688 	 * Since 2.4
689 	 * Params:
690 	 * targets = location to store an array of targets. The result
691 	 * stored here must be freed with g_free(). [out][array length=n_targets][transfer container]
692 	 * Returns: TRUE if any targets are present on the clipboard, otherwise FALSE.
693 	 */
694 	public int waitForTargets(out GdkAtom[] targets)
695 	{
696 		// gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard,  GdkAtom **targets,  gint *n_targets);
697 		GdkAtom* outtargets = null;
698 		int nTargets;
699 		
700 		auto p = gtk_clipboard_wait_for_targets(gtkClipboard, &outtargets, &nTargets);
701 		
702 		targets = outtargets[0 .. nTargets];
703 		return p;
704 	}
705 	
706 	/**
707 	 * Checks if a clipboard supports pasting data of a given type. This
708 	 * function can be used to determine if a "Paste" menu item should be
709 	 * insensitive or not.
710 	 * If you want to see if there's text available on the clipboard, use
711 	 * gtk_clipboard_wait_is_text_available() instead.
712 	 * Since 2.6
713 	 * Params:
714 	 * target = A GdkAtom indicating which target to look for.
715 	 * Returns: TRUE if the target is available, FALSE otherwise.
716 	 */
717 	public int waitIsTargetAvailable(GdkAtom target)
718 	{
719 		// gboolean gtk_clipboard_wait_is_target_available  (GtkClipboard *clipboard,  GdkAtom target);
720 		return gtk_clipboard_wait_is_target_available(gtkClipboard, target);
721 	}
722 	
723 	/**
724 	 * Hints that the clipboard data should be stored somewhere when the
725 	 * application exits or when gtk_clipboard_store() is called.
726 	 * This value is reset when the clipboard owner changes.
727 	 * Where the clipboard data is stored is platform dependent,
728 	 * see gdk_display_store_clipboard() for more information.
729 	 * Since 2.6
730 	 * Params:
731 	 * targets = array containing
732 	 * information about which forms should be stored or NULL
733 	 * to indicate that all forms should be stored. [allow-none][array length=n_targets]
734 	 */
735 	public void setCanStore(GtkTargetEntry[] targets)
736 	{
737 		// void gtk_clipboard_set_can_store (GtkClipboard *clipboard,  const GtkTargetEntry *targets,  gint n_targets);
738 		gtk_clipboard_set_can_store(gtkClipboard, targets.ptr, cast(int) targets.length);
739 	}
740 	
741 	/**
742 	 * Stores the current clipboard data somewhere so that it will stay
743 	 * around after the application has quit.
744 	 * Since 2.6
745 	 * Signal Details
746 	 * The "owner-change" signal
747 	 * void user_function (GtkClipboard *clipboard,
748 	 *  GdkEvent *event,
749 	 *  gpointer user_data) : Run First
750 	 * The ::owner-change signal is emitted when GTK+ receives an
751 	 * event that indicates that the ownership of the selection
752 	 * associated with clipboard has changed.
753 	 * Since 2.6
754 	 */
755 	public void store()
756 	{
757 		// void gtk_clipboard_store (GtkClipboard *clipboard);
758 		gtk_clipboard_store(gtkClipboard);
759 	}
760 }