W Wrapl, The Programming Language

Libraries:Gtk:Gtk:Clipboard

Types

T

Inherits from:

Constants

Nil : T

Functions

Get(selection @ Gtk.Gdk.Atom.T) : Gtk.Gtk.Clipboard.T

Returns the clipboard object for the given selection. See GetForDisplay for complete details.

selection a Gtk.Gdk.Atom.T which identifies the clipboard to use
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]


GetForDisplay(display @ Gtk.Gdk.Display.T, selection @ Gtk.Gdk.Atom.T) : Gtk.Gtk.Clipboard.T

Returns the clipboard object for the given selection. Cut/copy/paste menu items and keyboard shortcuts should use the default clipboard, returned by passing GDK_SELECTION_CLIPBOARD for selection. (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 GDK_SELECTION_PRIMARY. Cut/copy/paste menu items conceptually copy the contents of the GDK_SELECTION_PRIMARY clipboard to the default clipboard, i.e. they copy the selection to what the user sees as the clipboard.

(Passing GDK_NONE is the same as using gdk_atom_intern ("CLIPBOARD", FALSE). See 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 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".

display the display for which the clipboard is to be retrieved or created
selection a Gtk.Gdk.Atom.T which identifies the clipboard to use.
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]


GetType() : Gtk.GObject.Type.T



Methods

:Clear(self @ T) : Std.Object.T

Clears the contents of the clipboard. Generally this should only be called between the time you call SetWithOwner or SetWithData, and when the clear_func you supplied is called. Otherwise, the clipboard may be owned by someone else.

clipboard a T


:GetDisplay(self @ T) : Gtk.Gdk.Display.T

Gets the Gtk.Gdk.Display.T associated with clipboard

clipboard a T
Returns the Gtk.Gdk.Display.T associated with clipboard. [transfer none]


:GetOwner(self @ T) : Gtk.GObject.Object.T

If the clipboard contents callbacks were set with SetWithOwner, and the SetWithData or Clear has not subsequently called, returns the owner set by SetWithOwner.

clipboard a T
Returns the owner of the clipboard, if any; otherwise NULL. [transfer none]


:RequestContents(self @ T, target @ Gtk.Gdk.Atom.T, callback @ Std.Function.T, user_data) : Std.Object.T

Requests the contents of clipboard as the given target. When the results of the result are later received the supplied callback will be called.

clipboard a T
target an atom representing the form into which the clipboard owner should convert the selection.
callback A function to call when the results are received (or the retrieval fails). If the retrieval fails the length field of selection_data will be negative.
user_data user data to pass to callback


:RequestImage(self @ T, callback @ Std.Function.T, user_data) : Std.Object.T

Requests the contents of the clipboard as image. When the image is later received, it will be converted to a Gtk.Gdk.Pixbuf.T, and callback will be called.

The pixbuf parameter to callback will contain the resulting Gtk.Gdk.Pixbuf.T if the request succeeded, or NULL 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.

clipboard a T
callback a function to call when the image is received, or the retrieval fails. (It will always be called one way or the other.)
user_data user data to pass to callback.


:RequestRichText(self @ T, buffer @ Gtk.Gtk.TextBuffer.T, callback @ Std.Function.T, user_data) : Std.Object.T

Requests the contents of the clipboard as rich text. When the rich text is later received, callback will be called.

The text parameter to callback will contain the resulting rich text if the request succeeded, or NULL if it failed. The length parameter will contain 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.

clipboard a T
buffer a Gtk.Gtk.TextBuffer.T
callback a function to call when the text is received, or the retrieval fails. (It will always be called one way or the other.)
user_data user data to pass to callback.


:RequestTargets(self @ T, callback @ Std.Function.T, user_data) : Std.Object.T

Requests the contents of the clipboard as list of supported targets. When the list is later received, callback will be called.

The targets parameter to callback will contain the resulting targets if the request succeeded, or NULL if it failed.

clipboard a T
callback a function to call when the targets are received, or the retrieval fails. (It will always be called one way or the other.)
user_data user data to pass to callback.


:RequestText(self @ T, callback @ Std.Function.T, user_data) : Std.Object.T

Requests the contents of the clipboard as text. When the text is later received, it will be converted to UTF-8 if necessary, and callback will be called.

The text parameter to callback will contain the resulting text if the request succeeded, or NULL 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.

clipboard a T
callback a function to call when the text is received, or the retrieval fails. (It will always be called one way or the other.)
user_data user data to pass to callback.


:RequestUris(self @ T, callback @ Std.Function.T, user_data) : Std.Object.T

Requests the contents of the clipboard as URIs. When the URIs are later received callback will be called.

The uris parameter to callback will contain the resulting array of URIs if the request succeeded, or NULL 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 URI form.

clipboard a T
callback a function to call when the URIs are received, or the retrieval fails. (It will always be called one way or the other.)
user_data user data to pass to callback.


:SetCanStore(self @ T, targets @ Gtk.Gtk.TargetEntry.T, n_targets @ Std.Integer.SmallT) : Std.Object.T

Hints that the clipboard data should be stored somewhere when the application exits or when Store is called.

This value is reset when the clipboard owner changes. Where the clipboard data is stored is platform dependent, see Gtk.Gdk.Display.StoreClipboard for more information.

clipboard a T
targets array containing information about which forms should be stored or NULL to indicate that all forms should be stored. [allow-none][array length=n_targets]
n_targets number of elements in targets


:SetImage(self @ T, pixbuf @ Gtk.Gdk.Pixbuf.T) : Std.Object.T

Sets the contents of the clipboard to the given Gtk.Gdk.Pixbuf.T. GTK+ will take responsibility for responding for requests for the image, and for converting the image into the requested format.

clipboard a T object
pixbuf a Gtk.Gdk.Pixbuf.T


:SetText(self @ T, text @ Std.String.T, len @ Std.Integer.SmallT) : Std.Object.T

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.

clipboard a T object
text a UTF-8 string.
len length of text, in bytes, or -1, in which case the length will be determined with <span class="code"><span class="var">strlen</span><span class="delimiter">()</span></span>.


:SetWithData(self @ T, targets @ Gtk.Gtk.TargetEntry.T, n_targets @ Std.Integer.SmallT, get_func @ Std.Function.T, clear_func @ Std.Function.T, user_data) : Std.Symbol.T

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.

clipboard a T
targets array containing information about the available forms for the clipboard data
n_targets number of elements in targets
get_func function to call to get the actual clipboard data
clear_func when the clipboard contents are set again, this function will be called, and get_func will not be subsequently called.
user_data user data to pass to get_func and clear_func.
Returns TRUE if setting the clipboard data succeeded. If setting the clipboard data failed the provided callback functions will be ignored.


:SetWithOwner(self @ T, targets @ Gtk.Gtk.TargetEntry.T, n_targets @ Std.Integer.SmallT, get_func @ Std.Function.T, clear_func @ Std.Function.T, owner @ Gtk.GObject.Object.T) : Std.Symbol.T

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 SetWithData is that instead of an generic user_data pointer, a GObject is passed in.

clipboard a T
targets array containing information about the available forms for the clipboard data
n_targets number of elements in targets
get_func function to call to get the actual clipboard data
clear_func when the clipboard contents are set again, this function will be called, and get_func will not be subsequently called.
owner an object that "owns" the data. This object will be passed to the callbacks when called.
Returns TRUE if setting the clipboard data succeeded. If setting the clipboard data failed the provided callback functions will be ignored.


:Store(self @ T) : Std.Object.T

Stores the current clipboard data somewhere so that it will stay around after the application has quit.

clipboard a T


:WaitForContents(self @ T, target @ Gtk.Gdk.Atom.T) : Gtk.Gtk.SelectionData.T

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.

clipboard a T
target an atom representing the form into which the clipboard owner should convert the selection.
Returns a newly-allocated Gtk.Gtk.SelectionData.T object or NULL if retrieving the given target failed. If non-NULL, this value must be freed with Gtk.Gtk.SelectionData.Free when you are finished with it.


:WaitForImage(self @ T) : Gtk.Gdk.Pixbuf.T

Requests the contents of the clipboard as image and converts the result to a Gtk.Gdk.Pixbuf.T. This function waits for the data to be received using the main loop, so events, timeouts, etc, may be dispatched during the wait.

clipboard a T
Returns a newly-allocated Gtk.Gdk.Pixbuf.T 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]


:WaitForRichText(self @ T, buffer @ Gtk.Gtk.TextBuffer.T, format @ Gtk.Gdk.Atom.T, length @ Std.Object.T) : Std.Object.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.

clipboard a T
buffer a Gtk.Gtk.TextBuffer.T
format return location for the format of the returned data
length return location for the length of the returned data
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]


:WaitForTargets(self @ T, targets @ Std.Object.T, n_targets @ Std.Object.T) : Std.Symbol.T

Returns a list of targets that are present on the clipboard, or NULL if there aren't any targets available. The returned list must be freed with 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.

clipboard a T
targets location to store an array of targets. The result stored here must be freed with g_free(). [out][array length=n_targets][transfer container]
n_targets location to store number of items in targets.
Returns TRUE if any targets are present on the clipboard, otherwise FALSE.


:WaitForText(self @ T) : Std.String.T

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.

clipboard a T
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.)


:WaitForUris(self @ T) : Agg.List.T

Requests the contents of the clipboard as URIs. This function waits for the data to be received using the main loop, so events, timeouts, etc, may be dispatched during the wait.

clipboard a T
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]


:WaitIsImageAvailable(self @ T) : Std.Symbol.T

Test to see if there is an image available to be pasted This is done by requesting the TARGETS atom and checking if it contains any of the supported image targets. This function waits for the data to be received using the main loop, so events, timeouts, etc, may be dispatched during the wait.

This function is a little faster than calling WaitForImage since it doesn't need to retrieve the actual image data.

clipboard a T
Returns TRUE is there is an image available, FALSE otherwise.


:WaitIsRichTextAvailable(self @ T, buffer @ Gtk.Gtk.TextBuffer.T) : Std.Symbol.T

Test to see if there is rich text available to be pasted This is done by requesting the TARGETS atom and checking if it contains any of the supported rich text targets. This function waits for the data to be received using the main loop, so events, timeouts, etc, may be dispatched during the wait.

This function is a little faster than calling WaitForRichText since it doesn't need to retrieve the actual text.

clipboard a T
buffer a Gtk.Gtk.TextBuffer.T
Returns TRUE is there is rich text available, FALSE otherwise.


:WaitIsTargetAvailable(self @ T, target @ Gtk.Gdk.Atom.T) : Std.Symbol.T

Checks if a clipboard supports pasting data of a given type. This function can be used to determine if a "Paste" menu item should be insensitive or not.

If you want to see if there's text available on the clipboard, use WaitIsTextAvailable instead.

clipboard a T
target A Gtk.Gdk.Atom.T indicating which target to look for.
Returns TRUE if the target is available, FALSE otherwise.


:WaitIsTextAvailable(self @ T) : Std.Symbol.T

Test to see if there is text available to be pasted This is done by requesting the TARGETS atom and checking if it contains any of the supported text targets. This function waits for the data to be received using the main loop, so events, timeouts, etc, may be dispatched during the wait.

This function is a little faster than calling WaitForText since it doesn't need to retrieve the actual text.

clipboard a T
Returns TRUE is there is text available, FALSE otherwise.


:WaitIsUrisAvailable(self @ T) : Std.Symbol.T

Test to see if there is a list of URIs available to be pasted This is done by requesting the TARGETS atom and checking if it contains the URI targets. This function waits for the data to be received using the main loop, so events, timeouts, etc, may be dispatched during the wait.

This function is a little faster than calling WaitForUris since it doesn't need to retrieve the actual URI data.

clipboard a T
Returns TRUE is there is an URI list available, FALSE otherwise.