alternative to assert
[gtkD.git] / src / gtk / Clipboard.d
blob958ddb653685fa4589fb18db72e5d96ebdb20e07
1 /*
2 * This file is part of duit.
4 * duit 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 * duit 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 duit; 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 * local aliases:
58 module gtk.Clipboard;
60 private import gtk.gtktypes;
62 private import lib.gtk;
64 private import glib.Str;
65 private import gtk.Clipboard;
66 private import gdk.Display;
67 private import gobject.ObjectG;
68 private import gdk.Pixbuf;
70 /**
71 * Description
72 * The GtkClipboard object represents a clipboard of data shared
73 * between different processes or between different widgets in
74 * the same process. Each clipboard is identified by a name encoded as a
75 * GdkAtom. (Conversion to and from strings can be done with
76 * gdk_atom_intern() and gdk_atom_name().) The default clipboard
77 * corresponds to the "CLIPBOARD" atom; another commonly used clipboard
78 * is the "PRIMARY" clipboard, which, in X, traditionally contains
79 * the currently selected text.
80 * To support having a number of different formats on the clipboard
81 * at the same time, the clipboard mechanism allows providing
82 * callbacks instead of the actual data. When you set the contents
83 * of the clipboard, you can either supply the data directly (via
84 * functions like gtk_clipboard_set_text()), or you can supply a
85 * callback to be called at a later time when the data is needed (via
86 * gtk_clipboard_set_with_data() or gtk_clipboard_set_with_owner().)
87 * Providing a callback also avoids having to make copies of the data
88 * when it is not needed.
89 * gtk_clipboard_set_with_data() and gtk_clipboard_set_with_owner()
90 * are quite similar; the choice between the two depends mostly on
91 * which is more convenient in a particular situation.
92 * The former is most useful when you want to have a blob of data
93 * with callbacks to convert it into the various data types that you
94 * advertise. When the clear_func you provided is called, you
95 * simply free the data blob. The latter is more useful when the
96 * contents of clipboard reflect the internal state of a GObject
97 * (As an example, for the PRIMARY clipboard, when an entry widget
98 * provides the clipboard's contents the contents are simply the
99 * text within the selected region.) If the contents change, the
100 * entry widget can call gtk_clipboard_set_with_owner() to update
101 * the timestamp for clipboard ownership, without having to worry
102 * about clear_func being called.
103 * Requesting the data from the clipboard is essentially
104 * asynchronous. If the contents of the clipboard are provided within
105 * the same process, then a direct function call will be made to
106 * retrieve the data, but if they are provided by another process,
107 * then the data needs to be retrieved from the other process, which
108 * may take some time. To avoid blocking the user interface, the call
109 * to request the selection, gtk_clipboard_request_contents() takes a
110 * callback that will be called when the contents are received (or
111 * when the request fails.) If you don't want to deal with providing
112 * a separate callback, you can also use gtk_clipboard_wait_for_contents().
113 * What this does is run the GLib main loop recursively waiting for
114 * the contents. This can simplify the code flow, but you still have
115 * to be aware that other callbacks in your program can be called
116 * while this recursive mainloop is running.
117 * Along with the functions to get the clipboard contents as an
118 * arbitrary data chunk, there are also functions to retrieve
119 * it as text, gtk_clipboard_request_text() and
120 * gtk_clipboard_wait_for_text(). These functions take care of
121 * determining which formats are advertised by the clipboard
122 * provider, asking for the clipboard in the best available format
123 * and converting the results into the UTF-8 encoding. (The standard
124 * form for representing strings in GTK+.)
126 private import gobject.ObjectG;
127 public class Clipboard : ObjectG
130 /** the main Gtk struct */
131 protected GtkClipboard* gtkClipboard;
134 public GtkClipboard* getClipboardStruct()
136 return gtkClipboard;
140 /** the main Gtk struct as a void* */
141 protected void* getStruct()
143 return cast(void*)gtkClipboard;
147 * Sets our main struct and passes it to the parent class
149 public this (GtkClipboard* gtkClipboard)
151 super(cast(GObject*)gtkClipboard);
152 this.gtkClipboard = gtkClipboard;
158 // imports for the signal processing
159 private import gobject.Signals;
160 private import gdk.gdktypes;
161 int[char[]] connectedSignals;
163 void delegate(GdkEvent*, Clipboard)[] onOwnerChangeListeners;
164 void addOnOwnerChange(void delegate(GdkEvent*, Clipboard) dlg)
166 if ( !("owner-change" in connectedSignals) )
168 Signals.connectData(
169 getStruct(),
170 "owner-change",
171 cast(GCallback)&callBackOwnerChange,
172 this,
173 null,
174 cast(ConnectFlags)0);
175 connectedSignals["owner-change"] = 1;
177 onOwnerChangeListeners ~= dlg;
179 extern(C) static void callBackOwnerChange(GtkClipboard* clipboardStruct, GdkEvent* event, Clipboard clipboard)
181 bit consumed = false;
183 foreach ( void delegate(GdkEvent*, Clipboard) dlg ; clipboard.onOwnerChangeListeners )
185 dlg(event, clipboard);
188 return consumed;
201 * Returns the clipboard object for the given selection.
202 * See gtk_clipboard_get_for_display() for complete details.
203 * selection:
204 * a GdkAtom which identifies the clipboard
205 * to use.
206 * Returns:
207 * the appropriate clipboard object. If no
208 * clipboard already exists, a new one will
209 * be created. Once a clipboard object has
210 * been created, it is persistent and, since
211 * it is owned by GTK+, must not be freed or
212 * unrefd.
214 public static Clipboard get(GdkAtom selection)
216 // GtkClipboard* gtk_clipboard_get (GdkAtom selection);
217 return new Clipboard( gtk_clipboard_get(selection) );
221 * Returns the clipboard object for the given selection.
222 * Cut/copy/paste menu items and keyboard shortcuts should use
223 * the default clipboard, returned by passing GDK_SELECTION_CLIPBOARD for selection.
224 * (GDK_NONE is supported as a synonym for GDK_SELECTION_CLIPBOARD
225 * for backwards compatibility reasons.)
226 * The currently-selected object or text should be provided on the clipboard
227 * identified by GDK_SELECTION_PRIMARY. Cut/copy/paste menu items
228 * conceptually copy the contents of the GDK_SELECTION_PRIMARY clipboard
229 * to the default clipboard, i.e. they copy the selection to what the
230 * user sees as the clipboard.
231 * (Passing GDK_NONE is the same as using gdk_atom_intern
232 * ("CLIPBOARD", FALSE). See
233 * http://www.freedesktop.org/Standards/clipboards-spec
234 * for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY"
235 * selections under the X window system. On Win32 the
236 * GDK_SELECTION_PRIMARY clipboard is essentially ignored.)
237 * It's possible to have arbitrary named clipboards; if you do invent
238 * new clipboards, you should prefix the selection name with an
239 * underscore (because the ICCCM requires that nonstandard atoms are
240 * underscore-prefixed), and namespace it as well. For example,
241 * if your application called "Foo" has a special-purpose
242 * clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD".
243 * display:
244 * the display for which the clipboard is to be retrieved or created
245 * selection:
246 * a GdkAtom which identifies the clipboard
247 * to use.
248 * Returns:
249 * the appropriate clipboard object. If no
250 * clipboard already exists, a new one will
251 * be created. Once a clipboard object has
252 * been created, it is persistent and, since
253 * it is owned by GTK+, must not be freed or
254 * unrefd.
255 * Since 2.2
257 public static Clipboard getForDisplay(Display display, GdkAtom selection)
259 // GtkClipboard* gtk_clipboard_get_for_display (GdkDisplay *display, GdkAtom selection);
260 return new Clipboard( gtk_clipboard_get_for_display((display is null) ? null : display.getDisplayStruct(), selection) );
264 * Gets the GdkDisplay associated with clipboard
265 * clipboard:
266 * a GtkClipboard
267 * Returns:
268 * the GdkDisplay associated with clipboard
269 * Since 2.2
271 public Display getDisplay()
273 // GdkDisplay* gtk_clipboard_get_display (GtkClipboard *clipboard);
274 return new Display( gtk_clipboard_get_display(gtkClipboard) );
278 * Virtually sets the contents of the specified clipboard by providing
279 * a list of supported formats for the clipboard data and a function
280 * to call to get the actual data when it is requested.
281 * clipboard:
282 * a GtkClipboard
283 * targets:
284 * array containing information about the available forms for the
285 * clipboard data
286 * n_targets:
287 * number of elements in targets
288 * get_func:
289 * function to call to get the actual clipboard data
290 * clear_func:
291 * when the clipboard contents are set again, this function will
292 * be called, and get_func will not be subsequently called.
293 * user_data:
294 * user data to pass to get_func and clear_func.
295 * Returns:
296 * TRUE if setting the clipboard data succeeded. If setting
297 * the clipboard data failed the provided callback functions
298 * will be ignored.
300 public int setWithData(GtkTargetEntry* targets, uint nTargets, GtkClipboardGetFunc getFunc, GtkClipboardClearFunc clearFunc, void* userData)
302 // gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard, const GtkTargetEntry *targets, guint n_targets, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, gpointer user_data);
303 return gtk_clipboard_set_with_data(gtkClipboard, targets, nTargets, getFunc, clearFunc, userData);
307 * Virtually sets the contents of the specified clipboard by providing
308 * a list of supported formats for the clipboard data and a function
309 * to call to get the actual data when it is requested.
310 * The difference between this function and gtk_clipboard_set_with_data()
311 * is that instead of an generic user_data pointer, a GObject is passed
312 * in.
313 * clipboard:
314 * a GtkClipboard
315 * targets:
316 * array containing information about the available forms for the
317 * clipboard data
318 * n_targets:
319 * number of elements in targets
320 * get_func:
321 * function to call to get the actual clipboard data
322 * clear_func:
323 * when the clipboard contents are set again, this function will
324 * be called, and get_func will not be subsequently called.
325 * owner:
326 * an object that "owns" the data. This object will be passed
327 * to the callbacks when called.
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 setWithOwner(GtkTargetEntry* targets, uint nTargets, GtkClipboardGetFunc getFunc, GtkClipboardClearFunc clearFunc, ObjectG owner)
335 // gboolean gtk_clipboard_set_with_owner (GtkClipboard *clipboard, const GtkTargetEntry *targets, guint n_targets, GtkClipboardGetFunc get_func, GtkClipboardClearFunc clear_func, GObject *owner);
336 return gtk_clipboard_set_with_owner(gtkClipboard, targets, nTargets, getFunc, clearFunc, (owner is null) ? null : owner.getObjectGStruct());
340 * If the clipboard contents callbacks were set with
341 * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
342 * gtk_clipboard_clear() has not subsequently called, returns the owner set
343 * by gtk_clipboard_set_with_owner().
344 * clipboard:
345 * a GtkClipboard
346 * Returns:
347 * the owner of the clipboard, if any; otherwise NULL.
349 public ObjectG getOwner()
351 // GObject* gtk_clipboard_get_owner (GtkClipboard *clipboard);
352 return new ObjectG( gtk_clipboard_get_owner(gtkClipboard) );
356 * Clears the contents of the clipboard. Generally this should only
357 * be called between the time you call gtk_clipboard_set_with_owner()
358 * or gtk_clipboard_set_with_data(),
359 * and when the clear_func you supplied is called. Otherwise, the
360 * clipboard may be owned by someone else.
361 * clipboard:
362 * a GtkClipboard
364 public void clear()
366 // void gtk_clipboard_clear (GtkClipboard *clipboard);
367 gtk_clipboard_clear(gtkClipboard);
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 * clipboard:
376 * a GtkClipboard object
377 * text:
378 * a UTF-8 string.
379 * len:
380 * length of text, in bytes, or -1, in which case
381 * the length will be determined with strlen().
383 public void setText(char[] text, int len)
385 // void gtk_clipboard_set_text (GtkClipboard *clipboard, const gchar *text, gint len);
386 gtk_clipboard_set_text(gtkClipboard, Str.toStringz(text), len);
390 * Sets the contents of the clipboard to the given GdkPixbuf.
391 * GTK+ will take responsibility for responding for requests
392 * for the image, and for converting the image into the
393 * requested format.
394 * clipboard:
395 * a GtkClipboard object
396 * pixbuf:
397 * a GdkPixbuf
398 * Since 2.6
400 public void setImage(Pixbuf pixbuf)
402 // void gtk_clipboard_set_image (GtkClipboard *clipboard, GdkPixbuf *pixbuf);
403 gtk_clipboard_set_image(gtkClipboard, (pixbuf is null) ? null : pixbuf.getPixbufStruct());
407 * Requests the contents of clipboard as the given target.
408 * When the results of the result are later received the supplied callback
409 * will be called.
410 * clipboard:
411 * a GtkClipboard
412 * target:
413 * an atom representing the form into which the clipboard
414 * owner should convert the selection.
415 * callback:
416 * A function to call when the results are received
417 * (or the retrieval fails). If the retrieval fails
418 * the length field of selection_data will be
419 * negative.
420 * user_data:
421 * user data to pass to callback
423 public void requestContents(GdkAtom target, GtkClipboardReceivedFunc callback, void* userData)
425 // void gtk_clipboard_request_contents (GtkClipboard *clipboard, GdkAtom target, GtkClipboardReceivedFunc callback, gpointer user_data);
426 gtk_clipboard_request_contents(gtkClipboard, target, callback, userData);
430 * Requests the contents of the clipboard as text. When the text is
431 * later received, it will be converted to UTF-8 if necessary, and
432 * callback will be called.
433 * The text parameter to callback will contain the resulting text if
434 * the request succeeded, or NULL if it failed. This could happen for
435 * various reasons, in particular if the clipboard was empty or if the
436 * contents of the clipboard could not be converted into text form.
437 * clipboard:
438 * a GtkClipboard
439 * callback:
440 * a function to call when the text is received,
441 * or the retrieval fails. (It will always be called
442 * one way or the other.)
443 * user_data:
444 * user data to pass to callback.
446 public void requestText(GtkClipboardTextReceivedFunc callback, void* userData)
448 // void gtk_clipboard_request_text (GtkClipboard *clipboard, GtkClipboardTextReceivedFunc callback, gpointer user_data);
449 gtk_clipboard_request_text(gtkClipboard, callback, userData);
453 * Requests the contents of the clipboard as image. When the image is
454 * later received, it will be converted to a GdkPixbuf, and
455 * callback will be called.
456 * The pixbuf parameter to callback will contain the resulting
457 * GdkPixbuf if the request succeeded, or NULL if it failed. This
458 * could happen for various reasons, in particular if the clipboard
459 * was empty or if the contents of the clipboard could not be
460 * converted into an image.
461 * clipboard:
462 * a GtkClipboard
463 * callback:
464 * a function to call when the image is received,
465 * or the retrieval fails. (It will always be called
466 * one way or the other.)
467 * user_data:
468 * user data to pass to callback.
469 * Since 2.6
471 public void requestImage(GtkClipboardImageReceivedFunc callback, void* userData)
473 // void gtk_clipboard_request_image (GtkClipboard *clipboard, GtkClipboardImageReceivedFunc callback, gpointer user_data);
474 gtk_clipboard_request_image(gtkClipboard, callback, userData);
478 * Requests the contents of the clipboard as list of supported targets.
479 * When the list is later received, callback will be called.
480 * The targets parameter to callback will contain the resulting targets if
481 * the request succeeded, or NULL if it failed.
482 * clipboard:
483 * a GtkClipboard
484 * callback:
485 * a function to call when the targets are received,
486 * or the retrieval fails. (It will always be called
487 * one way or the other.)
488 * user_data:
489 * user data to pass to callback.
490 * Since 2.4
492 public void requestTargets(GtkClipboardTargetsReceivedFunc callback, void* userData)
494 // void gtk_clipboard_request_targets (GtkClipboard *clipboard, GtkClipboardTargetsReceivedFunc callback, gpointer user_data);
495 gtk_clipboard_request_targets(gtkClipboard, callback, userData);
499 * Requests the contents of the clipboard as rich text. When the rich
500 * text is later received, callback will be called.
501 * The text parameter to callback will contain the resulting rich
502 * text if the request succeeded, or NULL if it failed. The length
503 * parameter will contain text's length. This function can fail for
504 * various reasons, in particular if the clipboard was empty or if the
505 * contents of the clipboard could not be converted into rich text form.
506 * clipboard:
507 * a GtkClipboard
508 * buffer:
509 * a GtkTextBuffer
510 * callback:
511 * a function to call when the text is received,
512 * or the retrieval fails. (It will always be called
513 * one way or the other.)
514 * user_data:
515 * user data to pass to callback.
516 * Since 2.10
518 public void requestRichText(GtkTextBuffer* buffer, GtkClipboardRichTextReceivedFunc callback, void* userData)
520 // void gtk_clipboard_request_rich_text (GtkClipboard *clipboard, GtkTextBuffer *buffer, GtkClipboardRichTextReceivedFunc callback, gpointer user_data);
521 gtk_clipboard_request_rich_text(gtkClipboard, buffer, callback, userData);
525 * Requests the contents of the clipboard using the given target.
526 * This function waits for the data to be received using the main
527 * loop, so events, timeouts, etc, may be dispatched during the wait.
528 * clipboard:
529 * a GtkClipboard
530 * target:
531 * an atom representing the form into which the clipboard
532 * owner should convert the selection.
533 * Returns:
534 * a newly-allocated GtkSelectionData object or NULL
535 * if retrieving the given target failed. If non-NULL,
536 * this value must be freed with gtk_selection_data_free()
537 * when you are finished with it.
539 public GtkSelectionData* waitForContents(GdkAtom target)
541 // GtkSelectionData* gtk_clipboard_wait_for_contents (GtkClipboard *clipboard, GdkAtom target);
542 return gtk_clipboard_wait_for_contents(gtkClipboard, target);
546 * Requests the contents of the clipboard as text and converts
547 * the result to UTF-8 if necessary. This function waits for
548 * the data to be received using the main loop, so events,
549 * timeouts, etc, may be dispatched during the wait.
550 * clipboard:
551 * a GtkClipboard
552 * Returns:
553 * a newly-allocated UTF-8 string which must
554 * be freed with g_free(), or NULL if retrieving
555 * the selection data failed. (This could happen
556 * for various reasons, in particular if the
557 * clipboard was empty or if the contents of the
558 * clipboard could not be converted into text form.)
560 public char[] waitForText()
562 // gchar* gtk_clipboard_wait_for_text (GtkClipboard *clipboard);
563 return Str.toString(gtk_clipboard_wait_for_text(gtkClipboard) );
567 * Requests the contents of the clipboard as image and converts
568 * the result to a GdkPixbuf. This function waits for
569 * the data to be received using the main loop, so events,
570 * timeouts, etc, may be dispatched during the wait.
571 * clipboard:
572 * a GtkClipboard
573 * Returns:
574 * a newly-allocated GdkPixbuf object which must
575 * be disposed with g_object_unref(), or NULL if
576 * retrieving the selection data failed. (This
577 * could happen for various reasons, in particular
578 * if the clipboard was empty or if the contents of
579 * the clipboard could not be converted into an image.)
580 * Since 2.6
582 public Pixbuf waitForImage()
584 // GdkPixbuf* gtk_clipboard_wait_for_image (GtkClipboard *clipboard);
585 return new Pixbuf( gtk_clipboard_wait_for_image(gtkClipboard) );
589 * Requests the contents of the clipboard as rich text. This function
590 * waits for the data to be received using the main loop, so events,
591 * timeouts, etc, may be dispatched during the wait.
592 * clipboard:
593 * a GtkClipboard
594 * buffer:
595 * a GtkTextBuffer
596 * format:
597 * return location for the format of the returned data
598 * length:
599 * return location for the length of the returned data
600 * Returns:
601 * a newly-allocated binary block of data which must
602 * be freed with g_free(), or NULL if retrieving
603 * the selection data failed. (This could happen
604 * for various reasons, in particular if the
605 * clipboard was empty or if the contents of the
606 * clipboard could not be converted into text form.)
607 * Since 2.10
609 public byte* waitForRichText(GtkTextBuffer* buffer, GdkAtom* format, uint* length)
611 // guint8* gtk_clipboard_wait_for_rich_text (GtkClipboard *clipboard, GtkTextBuffer *buffer, GdkAtom *format, gsize *length);
612 return gtk_clipboard_wait_for_rich_text(gtkClipboard, buffer, format, length);
616 * Test to see if there is text available to be pasted
617 * This is done by requesting the TARGETS atom and checking
618 * if it contains any of the supported text targets. This function
619 * waits for the data to be received using the main loop, so events,
620 * timeouts, etc, may be dispatched during the wait.
621 * This function is a little faster than calling
622 * gtk_clipboard_wait_for_text() since it doesn't need to retrieve
623 * the actual text.
624 * clipboard:
625 * a GtkClipboard
626 * Returns:
627 * TRUE is there is text available, FALSE otherwise.
629 public int waitIsTextAvailable()
631 // gboolean gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard);
632 return gtk_clipboard_wait_is_text_available(gtkClipboard);
636 * Test to see if there is an image available to be pasted
637 * This is done by requesting the TARGETS atom and checking
638 * if it contains any of the supported image 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_image() since it doesn't need to retrieve
643 * the actual image data.
644 * clipboard:
645 * a GtkClipboard
646 * Returns:
647 * TRUE is there is an image available, FALSE otherwise.
648 * Since 2.6
650 public int waitIsImageAvailable()
652 // gboolean gtk_clipboard_wait_is_image_available (GtkClipboard *clipboard);
653 return gtk_clipboard_wait_is_image_available(gtkClipboard);
657 * Test to see if there is rich text available to be pasted
658 * This is done by requesting the TARGETS atom and checking
659 * if it contains any of the supported rich text 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_rich_text() since it doesn't need to retrieve
664 * the actual text.
665 * clipboard:
666 * a GtkClipboard
667 * buffer:
668 * a GtkTextBuffer
669 * Returns:
670 * TRUE is there is rich text available, FALSE otherwise.
671 * Since 2.10
673 public int waitIsRichTextAvailable(GtkTextBuffer* buffer)
675 // gboolean gtk_clipboard_wait_is_rich_text_available (GtkClipboard *clipboard, GtkTextBuffer *buffer);
676 return gtk_clipboard_wait_is_rich_text_available(gtkClipboard, buffer);
680 * Returns a list of targets that are present on the clipboard, or NULL
681 * if there aren't any targets available. The returned list must be
682 * freed with g_free().
683 * This function waits for the data to be received using the main
684 * loop, so events, timeouts, etc, may be dispatched during the wait.
685 * clipboard:
686 * a GtkClipboard
687 * targets:
688 * location to store an array of targets. The result
689 * stored here must be freed with g_free().
690 * n_targets:
691 * location to store number of items in targets.
692 * Returns:
693 * TRUE if any targets are present on the clipboard,
694 * otherwise FALSE.
695 * Since 2.4
697 public int waitForTargets(GdkAtom** targets, int* nTargets)
699 // gboolean gtk_clipboard_wait_for_targets (GtkClipboard *clipboard, GdkAtom **targets, gint *n_targets);
700 return gtk_clipboard_wait_for_targets(gtkClipboard, targets, nTargets);
704 * Checks if a clipboard supports pasting data of a given type. This
705 * function can be used to determine if a "Paste" menu item should be
706 * insensitive or not.
707 * If you want to see if there's text available on the clipboard, use
708 * gtk_clipboard_wait_is_text_available() instead.
709 * clipboard:
710 * a GtkClipboard
711 * target:
712 * A GdkAtom indicating which target to look for.
713 * Returns:
714 * TRUE if the target is available, FALSE otherwise.
715 * Since 2.6
717 public int waitIsTargetAvailable(GdkAtom target)
719 // gboolean gtk_clipboard_wait_is_target_available (GtkClipboard *clipboard, GdkAtom target);
720 return gtk_clipboard_wait_is_target_available(gtkClipboard, target);
724 * Hints that the clipboard data should be stored somewhere when the
725 * application exits or when gtk_clipboard_store() is called.
726 * This value is reset when the clipboard owner changes.
727 * Where the clipboard data is stored is platform dependent,
728 * see gdk_display_store_clipboard() for more information.
729 * clipboard:
730 * a GtkClipboard
731 * targets:
732 * array containing information about which forms should be stored
733 * or NULL to indicate that all forms should be stored.
734 * n_targets:
735 * number of elements in targets
736 * Since 2.6
738 public void setCanStore(GtkTargetEntry* targets, int nTargets)
740 // void gtk_clipboard_set_can_store (GtkClipboard *clipboard, const GtkTargetEntry *targets, gint n_targets);
741 gtk_clipboard_set_can_store(gtkClipboard, targets, nTargets);
745 * Stores the current clipboard data somewhere so that it will stay
746 * around after the application has quit.
747 * clipboard:
748 * a GtkClipboard
749 * Since 2.6
750 * Signal Details
751 * The "owner-change" signal
752 * void user_function (GtkClipboard *clipboard,
753 * GdkEvent *event,
754 * gpointer user_data) : Run first
755 * clipboard:
756 * the object which received the signal.
757 * event:
758 * user_data:
759 * user data set when the signal handler was connected.
760 * See Also
761 * GtkSelection
762 * GtkClipboard provides a high-level wrapper around the
763 * lower level routines that deal with X selections. It is
764 * also possibly to directly manipulate the X selections,
765 * though it is seldom necessary to do so.
767 public void store()
769 // void gtk_clipboard_store (GtkClipboard *clipboard);
770 gtk_clipboard_store(gtkClipboard);