gtkmm 4.16.0
|
Provides content for data transfer between applications. More...
#include <gdkmm/contentprovider.h>
Public Member Functions | |
ContentProvider (ContentProvider && src) noexcept | |
ContentProvider & | operator= (ContentProvider && src) noexcept |
~ContentProvider () noexcept override | |
GdkContentProvider * | gobj () |
Provides access to the underlying C GObject. | |
const GdkContentProvider * | gobj () const |
Provides access to the underlying C GObject. | |
GdkContentProvider * | 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< ContentFormats > | ref_formats () const |
Gets the formats that the provider can provide its current contents in. | |
Glib::RefPtr< ContentFormats > | ref_storable_formats () const |
Gets the formats that the provider suggests other applications to store the data in. | |
void | content_changed () |
Emits the signal_content_changed() signal. | |
void | write_mime_type_async (const Glib::ustring & mime_type, const Glib::RefPtr< Gio::OutputStream > &stream, int io_priority, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable) const |
Asynchronously writes the contents of provider to stream in the given mime_type. | |
void | write_mime_type_async (const Glib::ustring & mime_type, const Glib::RefPtr< Gio::OutputStream > &stream, int io_priority, const Gio::SlotAsyncReady & slot) const |
A write_mime_type_async() convenience overload. | |
void | write_mime_type_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const |
Finishes an asynchronous write operation. | |
void | get_value (Glib::ValueBase & value) const |
Gets the contents of provider stored in value. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > | property_formats () const |
The possible formats that the provider can provide its data in. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > | property_storable_formats () const |
The subset of formats that clipboard managers should store this provider's data in. | |
Glib::SignalProxy< void()> | signal_content_changed () |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
static Glib::RefPtr< ContentProvider > | create (const Glib::ValueBase & value) |
Create a content provider that provides the given value. | |
static Glib::RefPtr< ContentProvider > | create (const std::vector< Glib::RefPtr< ContentProvider > > & providers) |
Creates a content provider that represents all the given providers. | |
static Glib::RefPtr< ContentProvider > | create (const Glib::ustring & mime_type, const Glib::RefPtr< const Glib::Bytes > & bytes) |
Create a content provider that provides the given bytes as data for the given mime_type. | |
Protected Member Functions | |
ContentProvider () | |
virtual void | on_content_changed () |
This is a default handler for the signal signal_content_changed(). | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::ContentProvider > | wrap (GdkContentProvider * object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Provides content for data transfer between applications.
A Gdk::ContentProvider is used to provide content for the clipboard in a number of formats.
To create a ContentProvider, use one of the overloaded create() methods.
GDK knows how to handle common text and image formats out-of-the-box. See Gdk::ContentSerializer and Gdk::ContentDeserializer if you want to add support for application-specific data formats.
|
noexcept |
|
overridenoexcept |
|
protected |
void Gdk::ContentProvider::content_changed | ( | ) |
Emits the signal_content_changed() signal.
|
static |
Create a content provider that provides the given bytes as data for the given mime_type.
mime_type | The mime type. |
bytes | A Glib::Bytes with the data for mime_type. |
Gdk::ContentProvider
.
|
static |
Create a content provider that provides the given value.
value | A Glib::Value . |
Gdk::ContentProvider
.
|
static |
Creates a content provider that represents all the given providers.
Whenever data needs to be written, the union provider will try the given providers in the given order and the first one supporting a format will be chosen to provide it.
This allows an easy way to support providing data in different formats. For example, an image may be provided by its file and by the image contents with a call such as
[C example ellipted]
providers | The Gdk::ContentProvider s to present the union of. |
n_providers | The number of providers. |
Gdk::ContentProvider
.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
void Gdk::ContentProvider::get_value | ( | Glib::ValueBase & | value | ) | const |
Gets the contents of provider stored in value.
The value will have been initialized to the GType
the value should be provided in. This given GType
does not need to be listed in the formats returned by ref_formats(). However, if the given GType
is not supported, this operation can fail and Gio::Error::NOT_SUPPORTED
will be reported.
value | The Glib::Value to fill. |
Glib::Error |
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GdkContentProvider * Gdk::ContentProvider::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
|
protectedvirtual |
This is a default handler for the signal signal_content_changed().
|
noexcept |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > Gdk::ContentProvider::property_formats | ( | ) | const |
The possible formats that the provider can provide its data in.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > Gdk::ContentProvider::property_storable_formats | ( | ) | const |
The subset of formats that clipboard managers should store this provider's data in.
Glib::RefPtr< ContentFormats > Gdk::ContentProvider::ref_formats | ( | ) | const |
Gets the formats that the provider can provide its current contents in.
Glib::RefPtr< ContentFormats > Gdk::ContentProvider::ref_storable_formats | ( | ) | const |
Gets the formats that the provider suggests other applications to store the data in.
An example of such an application would be a clipboard manager.
This can be assumed to be a subset of ref_formats().
Glib::SignalProxy< void()> Gdk::ContentProvider::signal_content_changed | ( | ) |
void on_my_content_changed()
Flags: Run Last
Emitted whenever the content provided by this provider has changed.
void Gdk::ContentProvider::write_mime_type_async | ( | const Glib::ustring & | mime_type, |
const Glib::RefPtr< Gio::OutputStream > & | stream, | ||
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot | ||
) | const |
A write_mime_type_async() convenience overload.
void Gdk::ContentProvider::write_mime_type_async | ( | const Glib::ustring & | mime_type, |
const Glib::RefPtr< Gio::OutputStream > & | stream, | ||
int | io_priority, | ||
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) | const |
Asynchronously writes the contents of provider to stream in the given mime_type.
The given mime type does not need to be listed in the formats returned by ref_formats(). However, if the given GType
is not supported, Gio::Error::NOT_SUPPORTED
will be reported.
The given stream will not be closed.
mime_type | The mime type to provide the data in. |
stream | The Gio::OutputStream to write to. |
io_priority | I/O priority of the request. |
cancellable | Optional Gio::Cancellable object, nullptr to ignore. |
slot | Callback to call when the request is satisfied. |
void Gdk::ContentProvider::write_mime_type_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes an asynchronous write operation.
result | A Gio::AsyncResult . |
Glib::Error |
|
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. |