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