gtkmm 4.16.0
|
Share data between applications for Copy-and-Paste. More...
#include <gdkmm/clipboard.h>
Public Member Functions | |
Clipboard (Clipboard && src) noexcept | |
Clipboard & | operator= (Clipboard && src) noexcept |
~Clipboard () noexcept override | |
GdkClipboard * | gobj () |
Provides access to the underlying C GObject. | |
const GdkClipboard * | gobj () const |
Provides access to the underlying C GObject. | |
GdkClipboard * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
Glib::RefPtr< Display > | get_display () |
Gets the Gdk::Display that the clipboard was created for. | |
Glib::RefPtr< const Display > | get_display () const |
Gets the Gdk::Display that the clipboard was created for. | |
Glib::RefPtr< ContentFormats > | get_formats () |
Gets the formats that the clipboard can provide its current contents in. | |
Glib::RefPtr< const ContentFormats > | get_formats () const |
Gets the formats that the clipboard can provide its current contents in. | |
bool | is_local () const |
Returns if the clipboard is local. | |
Glib::RefPtr< ContentProvider > | get_content () |
Returns the Gdk::ContentProvider currently set on clipboard. | |
Glib::RefPtr< const ContentProvider > | get_content () const |
Returns the Gdk::ContentProvider currently set on clipboard. | |
void | read_async (const std::vector< Glib::ustring > & mime_types, int io_priority, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable) |
Asynchronously requests an input stream to read the clipboard's contents from. | |
void | read_async (const std::vector< Glib::ustring > & mime_types, int io_priority, const Gio::SlotAsyncReady & slot) |
A read_async() convenience overload. | |
Glib::RefPtr< Gio::InputStream > | read_finish (const Glib::RefPtr< Gio::AsyncResult > & result, Glib::ustring & out_mime_type) |
Finishes an asynchronous clipboard read. | |
void | read_texture_async (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable) |
Asynchronously request the clipboard contents converted to a Gdk::Pixbuf . | |
void | read_texture_async (const Gio::SlotAsyncReady & slot) |
A read_texture_async() convenience overload. | |
Glib::RefPtr< Texture > | read_texture_finish (const Glib::RefPtr< Gio::AsyncResult > & result) |
Finishes an asynchronous clipboard read. | |
void | read_text_async (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable) |
Asynchronously request the clipboard contents converted to a string. | |
void | read_text_async (const Gio::SlotAsyncReady & slot) |
A read_text_async() convenience overload. | |
Glib::ustring | read_text_finish (const Glib::RefPtr< Gio::AsyncResult > & result) |
Finishes an asynchronous clipboard read. | |
bool | set_content (const Glib::RefPtr< const ContentProvider > & provider) |
Sets a new content provider on clipboard. | |
bool | unset_content () |
Clears the clipboard. | |
void | set_text (const Glib::ustring & text) |
Puts the given text into the clipboard. | |
void | set_texture (const Glib::RefPtr< const Texture > & texture) |
Puts the given texture into the clipboard. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > | property_display () const |
The Gdk::Display that the clipboard belongs to. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > | property_formats () const |
The possible formats that the clipboard can provide its data in. | |
Glib::PropertyProxy_ReadOnly< bool > | property_local () const |
true if the contents of the clipboard are owned by this process. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentProvider > > | property_content () const |
The Gdk::ContentProvider or nullptr if the clipboard is empty or contents are provided otherwise. | |
Glib::SignalProxy< void()> | signal_changed () |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::Clipboard > | wrap (GdkClipboard * object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Share data between applications for Copy-and-Paste.
The Gdk::Clipboard object represents a clipboard of data shared between different applications or between different parts of the same application.
To get a Clipboard object, use Gdk::Display::get_clipboard() or Gdk::Display::get_primary_clipboard(). You can find out about the data that is currently available in a clipboard using get_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 Gdk::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 Gio::InputStream object.
|
noexcept |
|
overridenoexcept |
Glib::RefPtr< ContentProvider > Gdk::Clipboard::get_content | ( | ) |
Returns the Gdk::ContentProvider
currently set on clipboard.
If the clipboard is empty or its contents are not owned by the current process, nullptr
will be returned.
Glib::RefPtr< const ContentProvider > Gdk::Clipboard::get_content | ( | ) | const |
Returns the Gdk::ContentProvider
currently set on clipboard.
If the clipboard is empty or its contents are not owned by the current process, nullptr
will be returned.
Glib::RefPtr< Display > Gdk::Clipboard::get_display | ( | ) |
Gets the Gdk::Display
that the clipboard was created for.
Gdk::Display
. Glib::RefPtr< const Display > Gdk::Clipboard::get_display | ( | ) | const |
Gets the Gdk::Display
that the clipboard was created for.
Gdk::Display
. Glib::RefPtr< ContentFormats > Gdk::Clipboard::get_formats | ( | ) |
Gets the formats that the clipboard can provide its current contents in.
Glib::RefPtr< const ContentFormats > Gdk::Clipboard::get_formats | ( | ) | const |
Gets the formats that the clipboard can provide its current contents in.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GdkClipboard * Gdk::Clipboard::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool Gdk::Clipboard::is_local | ( | ) | const |
Returns if the clipboard is local.
A clipboard is considered local if it was last claimed by the running application.
Note that get_content() may return nullptr
even on a local clipboard. In this case the clipboard is empty.
true
if the clipboard is local. Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentProvider > > Gdk::Clipboard::property_content | ( | ) | const |
The Gdk::ContentProvider
or nullptr
if the clipboard is empty or contents are provided otherwise.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Display > > Gdk::Clipboard::property_display | ( | ) | const |
The Gdk::Display
that the clipboard belongs to.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > Gdk::Clipboard::property_formats | ( | ) | const |
The possible formats that the clipboard can provide its data in.
Glib::PropertyProxy_ReadOnly< bool > Gdk::Clipboard::property_local | ( | ) | const |
true
if the contents of the clipboard are owned by this process.
Default value: true
void Gdk::Clipboard::read_async | ( | const std::vector< Glib::ustring > & | mime_types, |
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot | ||
) |
A read_async() convenience overload.
void Gdk::Clipboard::read_async | ( | const std::vector< Glib::ustring > & | mime_types, |
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) |
Asynchronously requests an input stream to read the clipboard's contents from.
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 nullptr -terminated array of mime types to choose from. |
io_priority | The I/O priority of the request. |
cancellable | Optional Gio::Cancellable object. |
slot | Callback to call when the request is satisfied. |
Glib::RefPtr< Gio::InputStream > Gdk::Clipboard::read_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result, |
Glib::ustring & | out_mime_type | ||
) |
Finishes an asynchronous clipboard read.
See read_async().
result | A Gio::AsyncResult . |
out_mime_type | Location to store the chosen mime type. |
Gio::InputStream
.Glib::Error |
void Gdk::Clipboard::read_text_async | ( | const Gio::SlotAsyncReady & | slot | ) |
A read_text_async() convenience overload.
void Gdk::Clipboard::read_text_async | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) |
Asynchronously request the clipboard contents converted to a string.
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 Gio::Cancellable object. |
slot | Callback to call when the request is satisfied. |
Glib::ustring Gdk::Clipboard::read_text_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |
Finishes an asynchronous clipboard read.
See read_text_async().
result | A Gio::AsyncResult . |
Glib::Error |
void Gdk::Clipboard::read_texture_async | ( | const Gio::SlotAsyncReady & | slot | ) |
A read_texture_async() convenience overload.
void Gdk::Clipboard::read_texture_async | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) |
Asynchronously request the clipboard contents converted to a Gdk::Pixbuf
.
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 Gio::Cancellable object, nullptr to ignore. |
slot | Callback to call when the request is satisfied. |
Glib::RefPtr< Texture > Gdk::Clipboard::read_texture_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) |
Finishes an asynchronous clipboard read.
See read_texture_async().
result | A Gio::AsyncResult . |
Gdk::Texture
.Glib::Error |
bool Gdk::Clipboard::set_content | ( | const Glib::RefPtr< const ContentProvider > & | provider | ) |
Sets a new content provider on clipboard.
The clipboard will claim the Gdk::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 clipboard's read functions, clipboard will select the best format to transfer the contents and then request that format from provider.
provider | The new contents of clipboard or nullptr to clear the clipboard. |
true
if setting the clipboard succeeded. void Gdk::Clipboard::set_text | ( | const Glib::ustring & | text | ) |
Puts the given text into the clipboard.
text | Text to put into the clipboard. |
void Gdk::Clipboard::set_texture | ( | const Glib::RefPtr< const Texture > & | texture | ) |
Puts the given texture into the clipboard.
texture | A Gdk::Texture to put into the clipboard. |
Glib::SignalProxy< void()> Gdk::Clipboard::signal_changed | ( | ) |
void on_my_changed()
Flags: Run Last
Emitted when the clipboard changes ownership.
bool Gdk::Clipboard::unset_content | ( | ) |
Clears the clipboard.
In the rare case of a failure, this function will return false
. The clipboard will then continue reporting its old contents.
true
if unsetting the clipboard succeeded.
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |