Struct gdk4::Clipboard[][src]

pub struct Clipboard(_);
Expand description

The Clipboard object represents data shared between applications or inside an application.

To get a Clipboard object, use DisplayExt::clipboard() or DisplayExt::primary_clipboard(). You can find out about the data that is currently available in a clipboard using formats().

To make text or image data available in a clipboard, use set_text() or set_texture(). For other data, you can use set_content(), which takes a ContentProvider object.

To read textual or image data from a clipboard, use read_text_async() or read_texture_async(). For other data, use read_async(), which provides a GInputStream object.

Implementations

Creates a new builder-pattern struct instance to construct Clipboard objects.

This method returns an instance of ClipboardBuilder which can be used to create Clipboard objects.

Returns the ContentProvider currently set on self.

If the self is empty or its contents are not owned by the current process, None will be returned.

Returns

The content of a clipboard if the clipboard does not maintain any content

Gets the Display that the clipboard was created for.

Returns

a Display

Gets the formats that the clipboard can provide its current contents in.

Returns

The formats of the clipboard

Returns if the clipboard is local.

A clipboard is considered local if it was last claimed by the running application.

Note that content() may return None even on a local clipboard. In this case the clipboard is empty.

Returns

true if the clipboard is local

Sets a new content provider on self.

The clipboard will claim the Display’s resources and advertise these new contents to other applications.

In the rare case of a failure, this function will return false. The clipboard will then continue reporting its old contents and ignore provider.

If the contents are read by either an external application or the self’s read functions, self will select the best format to transfer the contents and then request that format from provider.

provider

the new contents of self or None to clear the clipboard

Returns

true if setting the clipboard succeeded

Puts the given text into the clipboard.

text

Text to put into the clipboard

Puts the given texture into the clipboard.

texture

a Texture to put into the clipboard

Emitted when the clipboard changes ownership.

Asynchronously requests an input stream to read the self’s contents from.

When the operation is finished callback will be called. You must then call Gdk::Clipboard::read_finish()`` to get the result of the operation.

The clipboard will choose the most suitable mime type from the given list to fulfill the request, preferring the ones listed first.

mime_types

a None-terminated array of mime types to choose from

io_priority

the I/O priority of the request

cancellable

optional GCancellable object

callback

callback to call when the request is satisfied

Sets the clipboard to contain the value collected from the given varargs.

⚠️ The following code is in c ⚠️

gdk_clipboard_set (clipboard, GTK_TYPE_TEXT_BUFFER, buffer);
type_

type of value to set

Asynchronously instructs the self to store its contents remotely.

If the clipboard is not local, this function does nothing but report success.

The callback must call Gdk::Clipboard::store_finish()``.

The purpose of this call is to preserve clipboard contents beyond the lifetime of an application, so this function is typically called on exit. Depending on the platform, the functionality may not be available unless a “clipboard manager” is running.

This function is called automatically when a Gtk::Application is shut down, so you likely don’t need to call it.

io_priority

the I/O priority of the request

cancellable

optional GCancellable object

callback

callback to call when the request is satisfied

Asynchronously request the self contents converted to the given type_.

When the operation is finished callback will be called. You must then call Gdk::Clipboard::read_value_finish()`` to get the resulting GValue.

For local clipboard contents that are available in the given GType, the value will be copied directly. Otherwise, GDK will try to use content_deserialize_async() to convert the clipboard’s data.

type_

a GType to read

io_priority

the I/O priority of the request

cancellable

optional GCancellable object

callback

callback to call when the request is satisfied

Asynchronously request the self contents converted to a string.

When the operation is finished callback will be called. You must then call Gdk::Clipboard::read_text_finish()`` to get the result.

This is a simple wrapper around read_value_async(). Use that function or read_async() directly if you need more control over the operation.

cancellable

optional GCancellable object

callback

callback to call when the request is satisfied

Asynchronously request the self contents converted to a gdk_pixbuf::Pixbuf.

When the operation is finished callback will be called. You must then call Gdk::Clipboard::read_texture_finish()`` to get the result.

This is a simple wrapper around read_value_async(). Use that function or read_async() directly if you need more control over the operation.

cancellable

optional GCancellable object, None to ignore.

callback

callback to call when the request is satisfied

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Casts to T unconditionally. Read more

Casts to &T unconditionally. Read more

Performs the conversion.

Performs the conversion.

Returns true if the object is an instance of (can be cast to) T.

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Safety Read more

Same as connect but takes a SignalId instead of a signal name.

Same as connect_local but takes a SignalId instead of a signal name.

Same as connect_unsafe but takes a SignalId instead of a signal name.

Emit signal by signal id.

Same as emit but takes Value for the arguments.

Emit signal by its name.

Same as emit_by_name but takes Value for the arguments.

Emit signal with details by signal id.

Same as emit_with_details but takes Value for the arguments.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Returns a SendValue clone of self.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.