Struct gdk4::Clipboard[][src]

#[repr(transparent)]
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

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.

Values should be passed the same way they are passed to other value collecting APIs, such as [method@GObject.Object.set] or [func@GObject.signal_emit].

⚠️ The following code is in c ⚠️

gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");

gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
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.

Returns the type of the object.

Returns the ObjectClass of the object. Read more

Returns the class of the object.

Returns the class of the object in the given type T. Read more

Returns the interface T of the object. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_property but fails instead of panicking.

Sets the property property_name of the object to value value. Read more

Similar to Self::set_properties but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::set_properties_from_value but fails instead of panicking.

Sets multiple properties of the object at once. Read more

Similar to Self::property but fails instead of panicking.

Gets the property property_name of the object and cast it to the type V. Read more

Similar to Self::property_value but fails instead of panicking.

Gets the property property_name of the object. Read more

Check if the object has a property property_name of the given type_. Read more

Get the type of the property property_name of this object. Read more

Get the ParamSpec of the property property_name of this object.

Return all ParamSpec of the properties of this object.

Freeze all property notifications until the return guard object is dropped. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Set arbitrary data on this object with the given key. Read more

Return previously set arbitrary data of this object with the given key. Read more

Retrieve previously set arbitrary data of this object with the given key. Read more

Block a given signal handler. Read more

Unblock a given signal handler.

Stop emission of the currently emitted signal.

Stop emission of the currently emitted signal by the (possibly detailed) signal name.

Similar to Self::connect but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_local but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_local_id but fails instead of panicking.

Connect to the signal signal_id on this object. Read more

Similar to Self::connect_unsafe but fails instead of panicking.

Connect to the signal signal_name on this object. Read more

Similar to Self::connect_unsafe_id but fails instead of panicking.

Similar to Self::connect_closure but fails instead of panicking.

Connect a closure to the signal signal_name on this object. Read more

Similar to Self::connect_closure_id but fails instead of panicking.

Connect a closure to the signal signal_id on this object. Read more

Limits the lifetime of closure to the lifetime of the object. When the object’s reference count drops to zero, the closure will be invalidated. An invalidated closure will ignore any calls to Closure::invoke. Read more

Connect to the signal signal_id on this object. Read more

Similar to Self::emit but fails instead of panicking.

Emit signal by signal id. Read more

Similar to Self::emit_with_values but fails instead of panicking.

Same as Self::emit but takes Value for the arguments.

Similar to Self::emit_by_name but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_by_name_with_values but fails instead of panicking.

Emit signal by its name. Read more

Similar to Self::emit_with_details but fails instead of panicking.

Emit signal by signal id with details. Read more

Similar to Self::emit_with_details_and_values but fails instead of panicking.

Emit signal by signal id with details. Read more

Disconnect a previously connected signal handler.

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Connect to the notify signal of the object. Read more

Notify that the given property has changed its value. Read more

Notify that the given property has changed its value. Read more

Downgrade this object to a weak reference.

Bind property source_property on this object to the target_property on the target object. Read more

Returns the strong reference count of this object.

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.