
@c %start of fragment

@deffn Function gtk-clipboard-get  (selection@tie{}@code{<gdk-atom>}) @result{}@tie{} (ret@tie{}@code{<gtk-clipboard*>})
Returns the clipboard object for the given selection. See
@code{gtk-clipboard-get-for-display} for complete details.

@table @var
@item selection
a @code{<gdk-atom>} which identifies the clipboard to use.

@item ret
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.

@end table

@end deffn

@deffn Function gtk-clipboard-get-for-display  (display@tie{}@code{<gdk-display>}) (selection@tie{}@code{<gdk-atom>}) @result{}@tie{} (ret@tie{}@code{<gtk-clipboard*>})
Returns the clipboard object for the given selection. Cut/copy/paste menu items
and keyboard shortcuts should use the default clipboard, returned by passing
@samp{GDK_SELECTION_CLIPBOARD} for @var{selection}. (@samp{GDK_NONE} is
supported as a synonym for GDK_SELECTION_CLIPBOARD for backwards compatibility
reasons.) The currently-selected object or text should be provided on the
clipboard identified by @code{<gdk-selection-primary>}. Cut/copy/paste menu
items conceptually copy the contents of the @code{<gdk-selection-primary>}
clipboard to the default clipboard, i.e. they copy the selection to what the
user sees as the clipboard.

(Passing @code{<gdk-none>} is the same as using @samp{gdk_atom_intern
("CLIPBOARD", FALSE)}. See
@uref{http://www.freedesktop.org/Standards/clipboards-spec,
http://www.freedesktop.org/Standards/clipboards-spec} for a detailed discussion
of the "CLIPBOARD" vs. "PRIMARY" selections under the X window system. On Win32
the @code{<gdk-selection-primary>} clipboard is essentially ignored.)

It's possible to have arbitrary named clipboards; if you do invent new
clipboards, you should prefix the selection name with an underscore (because the
ICCCM requires that nonstandard atoms are underscore-prefixed), and namespace it
as well. For example, if your application called "Foo" has a special-purpose
clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD".

@table @var
@item display
the display for which the clipboard is to be retrieved or created

@item selection
a @code{<gdk-atom>} which identifies the clipboard to use.

@item ret
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.

@end table

Since 2.2

@end deffn

@deffn Function gtk-clipboard-get-display  (self@tie{}@code{<gtk-clipboard*>}) @result{}@tie{} (ret@tie{}@code{<gdk-display>})
Gets the @code{<gdk-display>} associated with @var{clipboard}

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item ret
the @code{<gdk-display>} associated with @var{clipboard}

@end table

Since 2.2

@end deffn

@deffn Function gtk-clipboard-set-with-data  (self@tie{}@code{<gtk-clipboard*>}) (targets@tie{}@code{<gtk-target-entry*>}) (n_targets@tie{}@code{unsigned-int}) (get_func@tie{}@code{<gtk-clipboard-get-func>}) (clear_func@tie{}@code{<gtk-clipboard-clear-func>}) (user_data@tie{}@code{<gpointer>}) @result{}@tie{} (ret@tie{}@code{bool})
Virtually sets the contents of the specified clipboard by providing a list of
supported formats for the clipboard data and a function to call to get the
actual data when it is requested.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item targets
array containing information about the available forms for the clipboard data

@item n-targets
number of elements in @var{targets}

@item get-func
function to call to get the actual clipboard data

@item clear-func
when the clipboard contents are set again, this function will be called, and
@var{get-func} will not be subsequently called.

@item user-data
user data to pass to @var{get-func} and @var{clear-func}.

@item ret
@samp{@code{#t}} if setting the clipboard data succeeded. If setting the
clipboard data failed the provided callback functions will be ignored.

@end table

@end deffn

@deffn Function gtk-clipboard-set-with-owner  (self@tie{}@code{<gtk-clipboard*>}) (targets@tie{}@code{<gtk-target-entry*>}) (n_targets@tie{}@code{unsigned-int}) (get_func@tie{}@code{<gtk-clipboard-get-func>}) (clear_func@tie{}@code{<gtk-clipboard-clear-func>}) (owner@tie{}@code{<gobject>}) @result{}@tie{} (ret@tie{}@code{bool})
Virtually sets the contents of the specified clipboard by providing a list of
supported formats for the clipboard data and a function to call to get the
actual data when it is requested.

The difference between this function and @code{gtk-clipboard-set-with-data} is
that instead of an generic @var{user-data} pointer, a @code{<gobject>} is passed
in.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item targets
array containing information about the available forms for the clipboard data

@item n-targets
number of elements in @var{targets}

@item get-func
function to call to get the actual clipboard data

@item clear-func
when the clipboard contents are set again, this function will be called, and
@var{get-func} will not be subsequently called.

@item owner
an object that "owns" the data. This object will be passed to the callbacks when
called.

@item ret
@samp{@code{#t}} if setting the clipboard data succeeded. If setting the
clipboard data failed the provided callback functions will be ignored.

@end table

@end deffn

@deffn Function gtk-clipboard-get-owner  (self@tie{}@code{<gtk-clipboard*>}) @result{}@tie{} (ret@tie{}@code{<gobject>})
If the clipboard contents callbacks were set with
@code{gtk-clipboard-set-with-owner}, and the @code{gtk-clipboard-set-with-data}
or @code{gtk-clipboard-clear} has not subsequently called, returns the owner set
by @code{gtk-clipboard-set-with-owner}.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item ret
the owner of the clipboard, if any; otherwise @samp{@code{#f}}.

@end table

@end deffn

@deffn Function gtk-clipboard-clear  (self@tie{}@code{<gtk-clipboard*>})
Clears the contents of the clipboard. Generally this should only be called
between the time you call @code{gtk-clipboard-set-with-owner} or
@code{gtk-clipboard-set-with-data}, and when the @var{clear-func} you supplied
is called. Otherwise, the clipboard may be owned by someone else.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@end table

@end deffn

@deffn Function gtk-clipboard-set-text  (self@tie{}@code{<gtk-clipboard*>}) (text@tie{}@code{mchars})
Sets the contents of the clipboard to the given UTF-8 string. GTK+ will make a
copy of the text and take responsibility for responding for requests for the
text, and for converting the text into the requested format.

@table @var
@item clipboard
a @code{<gtk-clipboard>} object

@item text
a UTF-8 string.

@item len
length of @var{text}, in bytes, or -1, in which case the length will be
determined with @code{@code{strlen}}.

@end table

@end deffn

@deffn Function gtk-clipboard-set-image  (self@tie{}@code{<gtk-clipboard*>}) (pixbuf@tie{}@code{<gdk-pixbuf>})
Sets the contents of the clipboard to the given @code{<gdk-pixbuf>}. GTK+ will
take responsibility for responding for requests for the image, and for
converting the image into the requested format.

@table @var
@item clipboard
a @code{<gtk-clipboard>} object

@item pixbuf
a @code{<gdk-pixbuf>}

@end table

Since 2.6

@end deffn

@deffn Function gtk-clipboard-request-contents  (self@tie{}@code{<gtk-clipboard*>}) (target@tie{}@code{<gdk-atom>}) (callback@tie{}@code{<gtk-clipboard-received-func>}) (user_data@tie{}@code{<gpointer>})
Requests the contents of clipboard as the given target. When the results of the
result are later received the supplied callback will be called.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item target
an atom representing the form into which the clipboard owner should convert the
selection.

@item callback
A function to call when the results are received (or the retrieval fails). If
the retrieval fails the length field of @var{selection-data} will be negative.

@item user-data
user data to pass to @var{callback}

@end table

@end deffn

@deffn Function gtk-clipboard-request-text  (self@tie{}@code{<gtk-clipboard*>}) (callback@tie{}@code{<gtk-clipboard-text-received-func>}) (user_data@tie{}@code{<gpointer>})
Requests the contents of the clipboard as text. When the text is later received,
it will be converted to UTF-8 if necessary, and @var{callback} will be called.

The @var{text} parameter to @var{callback} will contain the resulting text if
the request succeeded, or @samp{@code{#f}} if it 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.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item callback
a function to call when the text is received, or the retrieval fails. (It will
always be called one way or the other.)

@item user-data
user data to pass to @var{callback}.

@end table

@end deffn

@deffn Function gtk-clipboard-request-image  (self@tie{}@code{<gtk-clipboard*>}) (callback@tie{}@code{<gtk-clipboard-image-received-func>}) (user_data@tie{}@code{<gpointer>})
Requests the contents of the clipboard as image. When the image is later
received, it will be converted to a @code{<gdk-pixbuf>}, and @var{callback} will
be called.

The @var{pixbuf} parameter to @var{callback} will contain the resulting
@code{<gdk-pixbuf>} if the request succeeded, or @samp{@code{#f}} if it 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.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item callback
a function to call when the image is received, or the retrieval fails. (It will
always be called one way or the other.)

@item user-data
user data to pass to @var{callback}.

@end table

Since 2.6

@end deffn

@deffn Function gtk-clipboard-request-targets  (self@tie{}@code{<gtk-clipboard*>}) (callback@tie{}@code{<gtk-clipboard-targets-received-func>}) (user_data@tie{}@code{<gpointer>})
Requests the contents of the clipboard as list of supported targets. When the
list is later received, @var{callback} will be called.

The @var{targets} parameter to @var{callback} will contain the resulting targets
if the request succeeded, or @samp{@code{#f}} if it failed.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item callback
a function to call when the targets are received, or the retrieval fails. (It
will always be called one way or the other.)

@item user-data
user data to pass to @var{callback}.

@end table

Since 2.4

@end deffn

@deffn Function gtk-clipboard-request-rich-text  (self@tie{}@code{<gtk-clipboard*>}) (buffer@tie{}@code{<gtk-text-buffer>}) (callback@tie{}@code{<gtk-clipboard-rich-text-received-func>}) (user_data@tie{}@code{<gpointer>})
Requests the contents of the clipboard as rich text. When the rich text is later
received, @var{callback} will be called.

The @var{text} parameter to @var{callback} will contain the resulting rich text
if the request succeeded, or @samp{@code{#f}} if it failed. The @var{length}
parameter will contain @var{text}'s length. This function can fail for various
reasons, in particular if the clipboard was empty or if the contents of the
clipboard could not be converted into rich text form.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item buffer
a @code{<gtk-text-buffer>}

@item callback
a function to call when the text is received, or the retrieval fails. (It will
always be called one way or the other.)

@item user-data
user data to pass to @var{callback}.

@end table

Since 2.10

@end deffn

@deffn Function gtk-clipboard-wait-for-contents  (self@tie{}@code{<gtk-clipboard*>}) (target@tie{}@code{<gdk-atom>}) @result{}@tie{} (ret@tie{}@code{<gtk-selection-data>})
Requests the contents of the clipboard using the given target. This function
waits for the data to be received using the main loop, so events, timeouts, etc,
may be dispatched during the wait.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item target
an atom representing the form into which the clipboard owner should convert the
selection.

@item ret
a newly-allocated @code{<gtk-selection-data>} object or @samp{@code{#f}} if
retrieving the given target failed. If non-@samp{@code{#f}}, this value must be
freed with @code{gtk-selection-data-free} when you are finished with it.

@end table

@end deffn

@deffn Function gtk-clipboard-wait-for-text  (self@tie{}@code{<gtk-clipboard*>}) @result{}@tie{} (ret@tie{}@code{mchars})
Requests the contents of the clipboard as text and converts the result to UTF-8
if necessary. This function waits for the data to be received using the main
loop, so events, timeouts, etc, may be dispatched during the wait.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item ret
a newly-allocated UTF-8 string which must be freed with @code{g-free}, or
@samp{@code{#f}} 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.)

@end table

@end deffn

@deffn Function gtk-clipboard-wait-for-image  (self@tie{}@code{<gtk-clipboard*>}) @result{}@tie{} (ret@tie{}@code{<gdk-pixbuf>})
Requests the contents of the clipboard as image and converts the result to a
@code{<gdk-pixbuf>}. This function waits for the data to be received using the
main loop, so events, timeouts, etc, may be dispatched during the wait.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item ret
a newly-allocated @code{<gdk-pixbuf>} object which must be disposed with
@code{g-object-unref}, or @samp{@code{#f}} 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.)

@end table

Since 2.6

@end deffn

@deffn Function gtk-clipboard-wait-for-rich-text  (self@tie{}@code{<gtk-clipboard*>}) (buffer@tie{}@code{<gtk-text-buffer>}) (format@tie{}@code{<gdk-atom*>}) @result{}@tie{} (ret@tie{}@code{<guint8*>}) (length@tie{}@code{size_t})
Requests the contents of the clipboard as rich text. This function waits for the
data to be received using the main loop, so events, timeouts, etc, may be
dispatched during the wait.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item buffer
a @code{<gtk-text-buffer>}

@item format
return location for the format of the returned data

@item length
return location for the length of the returned data

@item ret
a newly-allocated binary block of data which must be freed with @code{g-free},
or @samp{@code{#f}} 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.)

@end table

Since 2.10

@end deffn

@deffn Function gtk-clipboard-wait-for-targets  (self@tie{}@code{<gtk-clipboard*>}) (targets@tie{}@code{<gdk-atom**>}) @result{}@tie{} (ret@tie{}@code{bool}) (n_targets@tie{}@code{int})
Returns a list of targets that are present on the clipboard, or @samp{@code{#f}}
if there aren't any targets available. The returned list must be freed with
@code{g-free}. This function waits for the data to be received using the main
loop, so events, timeouts, etc, may be dispatched during the wait.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item targets
location to store an array of targets. The result stored here must be freed with
@code{g-free}.

@item n-targets
location to store number of items in @var{targets}.

@item ret
@samp{@code{#t}} if any targets are present on the clipboard, otherwise
@samp{@code{#f}}.

@end table

Since 2.4

@end deffn

@deffn Function gtk-clipboard-set-can-store  (self@tie{}@code{<gtk-clipboard*>}) (targets@tie{}@code{<gtk-target-entry*>}) (n_targets@tie{}@code{int})
Hints that the clipboard data should be stored somewhere when the application
exits or when @code{gtk-clipboard-store} is called.

This value is reset when the clipboard owner changes. Where the clipboard data
is stored is platform dependent, see @code{gdk-display-store-clipboard} for more
information.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@item targets
array containing information about which forms should be stored or
@samp{@code{#f}} to indicate that all forms should be stored.

@item n-targets
number of elements in @var{targets}

@end table

Since 2.6

@end deffn

@deffn Function gtk-clipboard-store  (self@tie{}@code{<gtk-clipboard*>})
Stores the current clipboard data somewhere so that it will stay around after
the application has quit.

@table @var
@item clipboard
a @code{<gtk-clipboard>}

@end table

Since 2.6

@end deffn


@c %end of fragment
