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