alternative to assert
[gtkD.git] / gtkD / src / gtk / Clipboard.d
blob29f9ccd196ab39543bf039e27bab1c09986ee1eb
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gtk-Clipboards.html
26 * outPack = gtk
27 * outFile = Clipboard
28 * strct = GtkClipboard
29 * realStrct=
30 * ctorStrct=
31 * clss = Clipboard
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_clipboard_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - glib.Str
46 * - gtk.Clipboard
47 * - gdk.Display
48 * - gobject.ObjectG
49 * - gdk.Pixbuf
50 * structWrap:
51 * - GObject* -> ObjectG
52 * - GdkDisplay* -> Display
53 * - GdkPixbuf* -> Pixbuf
54 * - GtkClipboard* -> Clipboard
55 * module aliases:
56 * local aliases:
59 module gtk.Clipboard;
61 version(noAssert)
63 version(Tango)
65 import tango.io.Stdout; // use the tango loging?
69 private import gtkc.gtktypes;
71 private import gtkc.gtk;
74 private import glib.Str;
75 private import gtk.Clipboard;
76 private import gdk.Display;
77 private import gobject.ObjectG;
78 private import gdk.Pixbuf;
83 /**
84 * Description
85 * The GtkClipboard object represents a clipboard of data shared
86 * between different processes or between different widgets in
87 * the same process. Each clipboard is identified by a name encoded as a
88 * GdkAtom. (Conversion to and from strings can be done with
89 * gdk_atom_intern() and gdk_atom_name().) The default clipboard
90 * corresponds to the "CLIPBOARD" atom; another commonly used clipboard
91 * is the "PRIMARY" clipboard, which, in X, traditionally contains
92 * the currently selected text.
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 * gtk_clipboard_set_with_data() and gtk_clipboard_set_with_owner()
103 * are quite similar; the choice between the two depends mostly on
104 * which is more convenient in a particular situation.
105 * The former is most useful when you want to have a blob of data
106 * with callbacks to convert it into the various data types that you
107 * advertise. When the clear_func you provided is called, you
108 * simply free the data blob. The latter is more useful when the
109 * contents of clipboard reflect the internal state of a GObject
110 * (As an example, for the PRIMARY clipboard, when an entry widget
111 * provides the clipboard's contents the contents are simply the
112 * text within the selected region.) If the contents change, the
113 * entry widget can call gtk_clipboard_set_with_owner() to update
114 * the timestamp for clipboard ownership, without having to worry
115 * about clear_func being called.
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 * Along with the functions to get the clipboard contents as an
131 * arbitrary data chunk, there are also functions to retrieve
132 * it as text, gtk_clipboard_request_text() and
133 * gtk_clipboard_wait_for_text(). These functions take care of
134 * determining which formats are advertised by the clipboard
135 * provider, asking for the clipboard in the best available format
136 * and converting the results into the UTF-8 encoding. (The standard
137 * form for representing strings in GTK+.)
139 private import gobject.ObjectG;
140 public class Clipboard : ObjectG
143 /** the main Gtk struct */
144 protected GtkClipboard* gtkClipboard;
147 public GtkClipboard* getClipboardStruct()
149 return gtkClipboard;
153 /** the main Gtk struct as a void* */
154 protected void* getStruct()
156 return cast(void*)gtkClipboard;
160 * Sets our main struct and passes it to the parent class
162 public this (GtkClipboard* gtkClipboard)
164 version(noAssert)
166 if ( gtkClipboard is null )
168 int zero = 0;
169 version(Tango)
171 Stdout("struct gtkClipboard is null on constructor").newline;
173 else
175 printf("struct gtkClipboard is null on constructor");
177 zero = zero / zero;
180 else
182 assert(gtkClipboard !is null, "struct gtkClipboard is null on constructor");
184 super(cast(GObject*)gtkClipboard);
185 this.gtkClipboard = gtkClipboard;
191 // imports for the signal processing
192 private import gobject.Signals;
193 private import gtkc.gdktypes;
194 int[char[]] connectedSignals;
196 void delegate(GdkEvent*, Clipboard)[] onOwnerChangeListeners;
197 void addOnOwnerChange(void delegate(GdkEvent*, Clipboard) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
199 if ( !("owner-change" in connectedSignals) )
201 Signals.connectData(
202 getStruct(),
203 "owner-change",
204 cast(GCallback)&callBackOwnerChange,
205 cast(void*)this,
206 null,
207 connectFlags);
208 connectedSignals["owner-change"] = 1;
210 onOwnerChangeListeners ~= dlg;
212 extern(C) static void callBackOwnerChange(GtkClipboard* clipboardStruct, GdkEvent* event, Clipboard clipboard)
214 bool consumed = false;
216 foreach ( void delegate(GdkEvent*, Clipboard) dlg ; clipboard.onOwnerChangeListeners )
218 dlg(event, clipboard);
221 return consumed;
234 * Returns the clipboard object for the given selection.
235 * See gtk_clipboard_get_for_display() for complete details.
236 * selection:
237 * a GdkAtom which identifies the clipboard
238 * to use.
239 * Returns:
240 * the appropriate clipboard object. If no
241 * clipboard already exists, a new one will
242 * be created. Once a clipboard object has
243 * been created, it is persistent and, since
244 * it is owned by GTK+, must not be freed or
245 * unrefd.
247 public static Clipboard get(GdkAtom selection)
249 // GtkClipboard* gtk_clipboard_get (GdkAtom selection);
250 return new Clipboard( gtk_clipboard_get(selection) );
254 * Returns the clipboard object for the given selection.
255 * Cut/copy/paste menu items and keyboard shortcuts should use
256 * the default clipboard, returned by passing GDK_SELECTION_CLIPBOARD for selection.
257 * (GDK_NONE is supported as a synonym for GDK_SELECTION_CLIPBOARD
258 * for backwards compatibility reasons.)
259 * The currently-selected object or text should be provided on the clipboard
260 * identified by GDK_SELECTION_PRIMARY. Cut/copy/paste menu items
261 * conceptually copy the contents of the GDK_SELECTION_PRIMARY clipboard
262 * to the default clipboard, i.e. they copy the selection to what the
263 * user sees as the clipboard.
264 * (Passing GDK_NONE is the same as using gdk_atom_intern
265 * ("CLIPBOARD", FALSE). See
266 * http://www.freedesktop.org/Standards/clipboards-spec
267 * for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY"
268 * selections under the X window system. On Win32 the
269 * GDK_SELECTION_PRIMARY clipboard is essentially ignored.)
270 * It's possible to have arbitrary named clipboards; if you do invent
271 * new clipboards, you should prefix the selection name with an
272 * underscore (because the ICCCM requires that nonstandard atoms are
273 * underscore-prefixed), and namespace it as well. For example,
274 * if your application called "Foo" has a special-purpose
275 * clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD".
276 * display:
277 * the display for which the clipboard is to be retrieved or created
278 * selection:
279 * a GdkAtom which identifies the clipboard
280 * to use.
281 * Returns:
282 * the appropriate clipboard object. If no
283 * clipboard already exists, a new one will
284 * be created. Once a clipboard object has
285 * been created, it is persistent and, since
286 * it is owned by GTK+, must not be freed or
287 * unrefd.
288 * Since 2.2
290 public static Clipboard getForDisplay(Display display, GdkAtom selection)
292 // GtkClipboard* gtk_clipboard_get_for_display (GdkDisplay *display, GdkAtom selection);
293 return new Clipboard( gtk_clipboard_get_for_display((display is null) ? null : display.getDisplayStruct(), selection) );
297 * Gets the GdkDisplay associated with clipboard
298 * clipboard:
299 * a GtkClipboard
300 * Returns:
301 * the GdkDisplay associated with clipboard
302 * Since 2.2
304 public Display getDisplay()
306 // GdkDisplay* gtk_clipboard_get_display (GtkClipboard *clipboard);
307 return new Display( gtk_clipboard_get_display(gtkClipboard) );
311 * Virtually sets the contents of the specified clipboard by providing
312 * a list of supported formats for the clipboard data and a function
313 * to call to get the actual data when it is requested.
314 * clipboard:
315 * a GtkClipboard
316 * targets:
317 * array containing information about the available forms for the
318 * clipboard data
319 * n_targets:
320 * number of elements in targets
321 * get_func:
322 * function to call to get the actual clipboard data
323 * clear_func:
324 * when the clipboard contents are set again, this function will
325 * be called, and get_func will not be subsequently called.
326 * user_data:
327 * user data to pass to get_func and clear_func.
328 * Returns:
329 * TRUE if setting the clipboard data succeeded. If setting
330 * the clipboard data failed the provided callback functions
331 * will be ignored.
333 public int setWithData(GtkTargetEntry* targets, uint nTargets, GtkClipboardGetFunc getFunc, GtkClipboardClearFunc clearFunc, void* userData)
335 // gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard, const GtkTargetEntry *targets, guint n_targets, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data);
336 return gtk_clipboard_set_with_data(gtkClipboard, targets, nTargets, getFunc, clearFunc, userData);
340 * Virtually sets the contents of the specified clipboard by providing
341 * a list of supported formats for the clipboard data and a function
342 * to call to get the actual data when it is requested.
343 * The difference between this function and gtk_clipboard_set_with_data()
344 * is that instead of an generic user_data pointer, a GObject is passed
345 * in.
346 * clipboard:
347 * a GtkClipboard
348 * targets:
349 * array containing information about the available forms for the
350 * clipboard data
351 * n_targets:
352 * number of elements in targets
353 * get_func:
354 * function to call to get the actual clipboard data
355 * clear_func:
356 * when the clipboard contents are set again, this function will
357 * be called, and get_func will not be subsequently called.
358 * owner:
359 * an object that "owns" the data. This object will be passed
360 * to the callbacks when called.
361 * Returns:
362 * TRUE if setting the clipboard data succeeded. If setting
363 * the clipboard data failed the provided callback functions
364 * will be ignored.
366 public int setWithOwner(GtkTargetEntry* targets, uint nTargets, GtkClipboardGetFunc getFunc, GtkClipboardClearFunc clearFunc, ObjectG owner)
368 // gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard, const GtkTargetEntry *targets, guint n_targets, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, GObject *owner);
369 return gtk_clipboard_set_with_owner(gtkClipboard, targets, nTargets, getFunc, clearFunc, (owner is null) ? null : owner.getObjectGStruct());
373 * If the clipboard contents callbacks were set with
374 * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
375 * gtk_clipboard_clear() has not subsequently called, returns the owner set
376 * by gtk_clipboard_set_with_owner().
377 * clipboard:
378 * a GtkClipboard
379 * Returns:
380 * the owner of the clipboard, if any; otherwise NULL.
382 public ObjectG getOwner()
384 // GObject* gtk_clipboard_get_owner (GtkClipboard *clipboard);
385 return new ObjectG( gtk_clipboard_get_owner(gtkClipboard) );
389 * Clears the contents of the clipboard. Generally this should only
390 * be called between the time you call gtk_clipboard_set_with_owner()
391 * or gtk_clipboard_set_with_data(),
392 * and when the clear_func you supplied is called. Otherwise, the
393 * clipboard may be owned by someone else.
394 * clipboard:
395 * a GtkClipboard
397 public void clear()
399 // void gtk_clipboard_clear (GtkClipboard *clipboard);
400 gtk_clipboard_clear(gtkClipboard);
404 * Sets the contents of the clipboard to the given UTF-8 string. GTK+ will
405 * make a copy of the text and take responsibility for responding
406 * for requests for the text, and for converting the text into
407 * the requested format.
408 * clipboard:
409 * a GtkClipboard object
410 * text:
411 * a UTF-8 string.
412 * len:
413 * length of text, in bytes, or -1, in which case
414 * the length will be determined with strlen().
416 public void setText(char[] text, int len)
418 // void gtk_clipboard_set_text (GtkClipboard *clipboard, const gchar *text, gint len);
419 gtk_clipboard_set_text(gtkClipboard, Str.toStringz(text), len);
423 * Sets the contents of the clipboard to the given GdkPixbuf.
424 * GTK+ will take responsibility for responding for requests
425 * for the image, and for converting the image into the
426 * requested format.
427 * clipboard:
428 * a GtkClipboard object
429 * pixbuf:
430 * a GdkPixbuf
431 * Since 2.6
433 public void setImage(Pixbuf pixbuf)
435 // void gtk_clipboard_set_image (GtkClipboard *clipboard, GdkPixbuf *pixbuf);
436 gtk_clipboard_set_image(gtkClipboard, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
440 * Requests the contents of clipboard as the given target.
441 * When the results of the result are later received the supplied callback
442 * will be called.
443 * clipboard:
444 * a GtkClipboard
445 * target:
446 * an atom representing the form into which the clipboard
447 * owner should convert the selection.
448 * callback:
449 * A function to call when the results are received
450 * (or the retrieval fails). If the retrieval fails
451 * the length field of selection_data will be
452 * negative.
453 * user_data:
454 * user data to pass to callback
456 public void requestContents(GdkAtom target, GtkClipboardReceivedFunc callback, void* userData)
458 // void gtk_clipboard_request_contents (GtkClipboard *clipboard, GdkAtom target, GtkClipboardReceivedFunc callback, gpointer user_data);
459 gtk_clipboard_request_contents(gtkClipboard, target, callback, userData);
463 * Requests the contents of the clipboard as text. When the text is
464 * later received, it will be converted to UTF-8 if necessary, and
465 * callback will be called.
466 * The text parameter to callback will contain the resulting text if
467 * the request succeeded, or NULL if it failed. This could happen for
468 * various reasons, in particular if the clipboard was empty or if the
469 * contents of the clipboard could not be converted into text form.
470 * clipboard:
471 * a GtkClipboard
472 * callback:
473 * a function to call when the text is received,
474 * or the retrieval fails. (It will always be called
475 * one way or the other.)
476 * user_data:
477 * user data to pass to callback.
479 public void requestText(GtkClipboardTextReceivedFunc callback, void* userData)
481 // void gtk_clipboard_request_text (GtkClipboard *clipboard, GtkClipboardTextReceivedFunc callback, gpointer user_data);
482 gtk_clipboard_request_text(gtkClipboard, callback, userData);
486 * Requests the contents of the clipboard as image. When the image is
487 * later received, it will be converted to a GdkPixbuf, and
488 * callback will be called.
489 * The pixbuf parameter to callback will contain the resulting
490 * GdkPixbuf if the request succeeded, or NULL if it failed. This
491 * could happen for various reasons, in particular if the clipboard
492 * was empty or if the contents of the clipboard could not be
493 * converted into an image.
494 * clipboard:
495 * a GtkClipboard
496 * callback:
497 * a function to call when the image is received,
498 * or the retrieval fails. (It will always be called
499 * one way or the other.)
500 * user_data:
501 * user data to pass to callback.
502 * Since 2.6
504 public void requestImage(GtkClipboardImageReceivedFunc callback, void* userData)
506 // void gtk_clipboard_request_image (GtkClipboard *clipboard, GtkClipboardImageReceivedFunc callback, gpointer user_data);
507 gtk_clipboard_request_image(gtkClipboard, callback, userData);
511 * Requests the contents of the clipboard as list of supported targets.
512 * When the list is later received, callback will be called.
513 * The targets parameter to callback will contain the resulting targets if
514 * the request succeeded, or NULL if it failed.
515 * clipboard:
516 * a GtkClipboard
517 * callback:
518 * a function to call when the targets are received,
519 * or the retrieval fails. (It will always be called
520 * one way or the other.)
521 * user_data:
522 * user data to pass to callback.
523 * Since 2.4
525 public void requestTargets(GtkClipboardTargetsReceivedFunc callback, void* userData)
527 // void gtk_clipboard_request_targets (GtkClipboard *clipboard, GtkClipboardTargetsReceivedFunc callback, gpointer user_data);
528 gtk_clipboard_request_targets(gtkClipboard, callback, userData);
532 * Requests the contents of the clipboard as rich text. When the rich
533 * text is later received, callback will be called.
534 * The text parameter to callback will contain the resulting rich
535 * text if the request succeeded, or NULL if it failed. The length
536 * parameter will contain text's length. This function can fail for
537 * various reasons, in particular if the clipboard was empty or if the
538 * contents of the clipboard could not be converted into rich text form.
539 * clipboard:
540 * a GtkClipboard
541 * buffer:
542 * a GtkTextBuffer
543 * callback:
544 * a function to call when the text is received,
545 * or the retrieval fails. (It will always be called
546 * one way or the other.)
547 * user_data:
548 * user data to pass to callback.
549 * Since 2.10
551 public void requestRichText(GtkTextBuffer* buffer, GtkClipboardRichTextReceivedFunc callback, void* userData)
553 // void gtk_clipboard_request_rich_text (GtkClipboard *clipboard, GtkTextBuffer *buffer, GtkClipboardRichTextReceivedFunc callback, gpointer user_data);
554 gtk_clipboard_request_rich_text(gtkClipboard, buffer, callback, userData);
558 * Requests the contents of the clipboard using the given target.
559 * This function waits for the data to be received using the main
560 * loop, so events, timeouts, etc, may be dispatched during the wait.
561 * clipboard:
562 * a GtkClipboard
563 * target:
564 * an atom representing the form into which the clipboard
565 * owner should convert the selection.
566 * Returns:
567 * a newly-allocated GtkSelectionData object or NULL
568 * if retrieving the given target failed. If non-NULL,
569 * this value must be freed with gtk_selection_data_free()
570 * when you are finished with it.
572 public GtkSelectionData* waitForContents(GdkAtom target)
574 // GtkSelectionData* gtk_clipboard_wait_for_contents (GtkClipboard *clipboard, GdkAtom target);
575 return gtk_clipboard_wait_for_contents(gtkClipboard, target);
579 * Requests the contents of the clipboard as text and converts
580 * the result to UTF-8 if necessary. This function waits for
581 * the data to be received using the main loop, so events,
582 * timeouts, etc, may be dispatched during the wait.
583 * clipboard:
584 * a GtkClipboard
585 * Returns:
586 * a newly-allocated UTF-8 string which must
587 * be freed with g_free(), or NULL if retrieving
588 * the selection data failed. (This could happen
589 * for various reasons, in particular if the
590 * clipboard was empty or if the contents of the
591 * clipboard could not be converted into text form.)
593 public char[] waitForText()
595 // gchar* gtk_clipboard_wait_for_text (GtkClipboard *clipboard);
596 return Str.toString(gtk_clipboard_wait_for_text(gtkClipboard) );
600 * Requests the contents of the clipboard as image and converts
601 * the result to a GdkPixbuf. This function waits for
602 * the data to be received using the main loop, so events,
603 * timeouts, etc, may be dispatched during the wait.
604 * clipboard:
605 * a GtkClipboard
606 * Returns:
607 * a newly-allocated GdkPixbuf object which must
608 * be disposed with g_object_unref(), or NULL if
609 * retrieving the selection data failed. (This
610 * could happen for various reasons, in particular
611 * if the clipboard was empty or if the contents of
612 * the clipboard could not be converted into an image.)
613 * Since 2.6
615 public Pixbuf waitForImage()
617 // GdkPixbuf* gtk_clipboard_wait_for_image (GtkClipboard *clipboard);
618 return new Pixbuf( gtk_clipboard_wait_for_image(gtkClipboard) );
622 * Requests the contents of the clipboard as rich text. This function
623 * waits for the data to be received using the main loop, so events,
624 * timeouts, etc, may be dispatched during the wait.
625 * clipboard:
626 * a GtkClipboard
627 * buffer:
628 * a GtkTextBuffer
629 * format:
630 * return location for the format of the returned data
631 * length:
632 * return location for the length of the returned data
633 * Returns:
634 * a newly-allocated binary block of data which must
635 * be freed with g_free(), or NULL if retrieving
636 * the selection data failed. (This could happen
637 * for various reasons, in particular if the
638 * clipboard was empty or if the contents of the
639 * clipboard could not be converted into text form.)
640 * Since 2.10
642 public byte* waitForRichText(GtkTextBuffer* buffer, GdkAtom* format, uint* length)
644 // guint8* gtk_clipboard_wait_for_rich_text (GtkClipboard *clipboard, GtkTextBuffer *buffer, GdkAtom *format, gsize *length);
645 return gtk_clipboard_wait_for_rich_text(gtkClipboard, buffer, format, length);
649 * Test to see if there is text available to be pasted
650 * This is done by requesting the TARGETS atom and checking
651 * if it contains any of the supported text targets. This function
652 * waits for the data to be received using the main loop, so events,
653 * timeouts, etc, may be dispatched during the wait.
654 * This function is a little faster than calling
655 * gtk_clipboard_wait_for_text() since it doesn't need to retrieve
656 * the actual text.
657 * clipboard:
658 * a GtkClipboard
659 * Returns:
660 * TRUE is there is text available, FALSE otherwise.
662 public int waitIsTextAvailable()
664 // gboolean gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard);
665 return gtk_clipboard_wait_is_text_available(gtkClipboard);
669 * Test to see if there is an image available to be pasted
670 * This is done by requesting the TARGETS atom and checking
671 * if it contains any of the supported image targets. This function
672 * waits for the data to be received using the main loop, so events,
673 * timeouts, etc, may be dispatched during the wait.
674 * This function is a little faster than calling
675 * gtk_clipboard_wait_for_image() since it doesn't need to retrieve
676 * the actual image data.
677 * clipboard:
678 * a GtkClipboard
679 * Returns:
680 * TRUE is there is an image available, FALSE otherwise.
681 * Since 2.6
683 public int waitIsImageAvailable()
685 // gboolean gtk_clipboard_wait_is_image_available (GtkClipboard *clipboard);
686 return gtk_clipboard_wait_is_image_available(gtkClipboard);
690 * Test to see if there is rich text available to be pasted
691 * This is done by requesting the TARGETS atom and checking
692 * if it contains any of the supported rich text targets. This function
693 * waits for the data to be received using the main loop, so events,
694 * timeouts, etc, may be dispatched during the wait.
695 * This function is a little faster than calling
696 * gtk_clipboard_wait_for_rich_text() since it doesn't need to retrieve
697 * the actual text.
698 * clipboard:
699 * a GtkClipboard
700 * buffer:
701 * a GtkTextBuffer
702 * Returns:
703 * TRUE is there is rich text available, FALSE otherwise.
704 * Since 2.10
706 public int waitIsRichTextAvailable(GtkTextBuffer* buffer)
708 // gboolean gtk_clipboard_wait_is_rich_text_available (GtkClipboard *clipboard, GtkTextBuffer *buffer);
709 return gtk_clipboard_wait_is_rich_text_available(gtkClipboard, buffer);
713 * Returns a list of targets that are present on the clipboard, or NULL
714 * if there aren't any targets available. The returned list must be
715 * freed with g_free().
716 * This function waits for the data to be received using the main
717 * loop, so events, timeouts, etc, may be dispatched during the wait.
718 * clipboard:
719 * a GtkClipboard
720 * targets:
721 * location to store an array of targets. The result
722 * stored here must be freed with g_free().
723 * n_targets:
724 * location to store number of items in targets.
725 * Returns:
726 * TRUE if any targets are present on the clipboard,
727 * otherwise FALSE.
728 * Since 2.4
730 public int waitForTargets(GdkAtom** targets, int* nTargets)
732 // gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard, GdkAtom **targets, gint *n_targets);
733 return gtk_clipboard_wait_for_targets(gtkClipboard, targets, nTargets);
737 * Checks if a clipboard supports pasting data of a given type. This
738 * function can be used to determine if a "Paste" menu item should be
739 * insensitive or not.
740 * If you want to see if there's text available on the clipboard, use
741 * gtk_clipboard_wait_is_text_available() instead.
742 * clipboard:
743 * a GtkClipboard
744 * target:
745 * A GdkAtom indicating which target to look for.
746 * Returns:
747 * TRUE if the target is available, FALSE otherwise.
748 * Since 2.6
750 public int waitIsTargetAvailable(GdkAtom target)
752 // gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard, GdkAtom target);
753 return gtk_clipboard_wait_is_target_available(gtkClipboard, target);
757 * Hints that the clipboard data should be stored somewhere when the
758 * application exits or when gtk_clipboard_store() is called.
759 * This value is reset when the clipboard owner changes.
760 * Where the clipboard data is stored is platform dependent,
761 * see gdk_display_store_clipboard() for more information.
762 * clipboard:
763 * a GtkClipboard
764 * targets:
765 * array containing information about which forms should be stored
766 * or NULL to indicate that all forms should be stored.
767 * n_targets:
768 * number of elements in targets
769 * Since 2.6
771 public void setCanStore(GtkTargetEntry* targets, int nTargets)
773 // void gtk_clipboard_set_can_store (GtkClipboard *clipboard, const GtkTargetEntry *targets, gint n_targets);
774 gtk_clipboard_set_can_store(gtkClipboard, targets, nTargets);
778 * Stores the current clipboard data somewhere so that it will stay
779 * around after the application has quit.
780 * clipboard:
781 * a GtkClipboard
782 * Since 2.6
783 * Signal Details
784 * The "owner-change" signal
785 * void user_function (GtkClipboard *clipboard,
786 * GdkEvent *event,
787 * gpointer user_data) : Run First
788 * clipboard:
789 * the object which received the signal.
790 * event:
791 * user_data:
792 * user data set when the signal handler was connected.
793 * See Also
794 * GtkSelection
795 * GtkClipboard provides a high-level wrapper around the
796 * lower level routines that deal with X selections. It is
797 * also possibly to directly manipulate the X selections,
798 * though it is seldom necessary to do so.
800 public void store()
802 // void gtk_clipboard_store (GtkClipboard *clipboard);
803 gtk_clipboard_store(gtkClipboard);