gtkmm
3.97.1
|
Provides content for data transfer between applications. More...
#include <gdkmm/contentprovider.h>
Public Types | |
using | SlotGetValue = sigc::slot< void(Glib::ValueBase&)> |
Callback type for providing data in a Glib::ValueBase. More... | |
using | SlotGetBytes = sigc::slot< Glib::RefPtr< Glib::Bytes >(const Glib::ustring&)> |
Callback type for providing data in a Glib::Bytes. More... | |
![]() | |
typedef void(*)(gpointer data | DestroyNotify) |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
Public Member Functions | |
ContentProvider (ContentProvider&& src) noexcept | |
ContentProvider& | operator= (ContentProvider&& src) noexcept |
~ContentProvider () noexcept override | |
GdkContentProvider* | gobj () |
Provides access to the underlying C GObject. More... | |
const GdkContentProvider* | gobj () const |
Provides access to the underlying C GObject. More... | |
GdkContentProvider* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
Glib::RefPtr< ContentFormats > | ref_formats () const |
Gets the formats that the provider can provide its current contents in. More... | |
Glib::RefPtr< ContentFormats > | ref_storable_formats () const |
Gets the formats that the provider suggests other applications to store the data in. More... | |
void | content_changed () |
Emits the Gdk::ContentProvider::signal_contents_changed() signal. More... | |
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. More... | |
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. More... | |
void | write_mime_type_finish (const Glib::RefPtr< Gio::AsyncResult >& result) const |
Finishes an asynchronous write operation started with write_mime_type_async(). More... | |
void | get_value (Glib::ValueBase& value) const |
Gets the contents of provider stored in value. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > | property_formats () const |
The possible formats that the provider can provide its data in. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ContentFormats > > | property_storable_formats () const |
The subset of formats that clipboard managers should store this provider's data in. More... | |
Glib::SignalProxy< void()> | signal_content_changed () |
![]() | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark &key) |
void | set_data (const Quark &key, void *data) |
void | set_data (const Quark &key, void *data, DestroyNotify notify) |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
![]() | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value) |
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const |
void | set_property (const Glib::ustring &property_name, const PropertyType &value) |
void | get_property (const Glib::ustring &property_name, PropertyType &value) const |
PropertyType | get_property (const Glib::ustring &property_name) const |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot) |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot) |
void | freeze_notify () |
void | thaw_notify () |
virtual void | reference () const |
virtual void | unreference () const |
GObject * | gobj () |
const GObject * | gobj () const |
GObject * | gobj_copy () const |
![]() | |
trackable () noexcept | |
trackable (const trackable &src) noexcept | |
trackable (trackable &&src) noexcept | |
~trackable () | |
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
void | notify_callbacks () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) noexcept |
void | remove_destroy_notify_callback (notifiable *data) const |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
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. More... | |
static Glib::RefPtr< ContentProvider > | create (const Glib::ValueBase& value) |
Create a content provider that provides the given value. More... | |
static Glib::RefPtr< ContentProvider > | create (GType type, const SlotGetValue& slot) |
Create a content provider that provides data that is provided via a callback. More... | |
static Glib::RefPtr< ContentProvider > | create (const Glib::RefPtr< const ContentFormats >& formats, const SlotGetBytes& slot) |
Create a content provider that provides data that is provided via a callback. More... | |
Protected Member Functions | |
ContentProvider () | |
virtual void | on_content_changed () |
This is a default handler for the signal signal_content_changed(). More... | |
![]() | |
Object () | |
Object (const Glib::ConstructParams &construct_params) | |
Object (GObject *castitem) | |
~Object () noexcept override | |
![]() | |
ObjectBase () | |
ObjectBase (const char *custom_type_name) | |
ObjectBase (const std::type_info &custom_type_info) | |
ObjectBase (ObjectBase &&src) noexcept | |
ObjectBase & | operator= (ObjectBase &&src) noexcept |
virtual | ~ObjectBase () noexcept=0 |
void | initialize (GObject *castitem) |
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gdk::ContentProvider > | wrap (GdkContentProvider* object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
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.
using Gdk::ContentProvider::SlotGetBytes = sigc::slot<Glib::RefPtr<Glib::Bytes>(const Glib::ustring&)> |
Callback type for providing data in a Glib::Bytes.
For instance:
mime_type | The mime type. |
using Gdk::ContentProvider::SlotGetValue = sigc::slot<void(Glib::ValueBase&)> |
Callback type for providing data in a Glib::ValueBase.
For instance:
[in,out] | value | Where to store the provided value. value has 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, the operation can fail. |
|
noexcept |
|
overridenoexcept |
|
protected |
void Gdk::ContentProvider::content_changed | ( | ) |
Emits the Gdk::ContentProvider::signal_contents_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 Bytes with the data for mime_type. |
|
static |
Create a content provider that provides the given value.
value | A Value. |
|
static |
Create a content provider that provides data that is provided via a callback.
type | The type that the callback provides. |
slot | Callback to populate a Glib::Value. |
|
static |
Create a content provider that provides data that is provided via a callback.
formats | Formats to advertise. |
slot | Callback to return a Glib::Bytes. |
|
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 Type the value should be provided in. This given Type does not need to be listed in the formats returned by ref_formats(). However, if the given Type is not supported, this operation can fail and Gio::Error::NOT_SUPPORTED will be reported.
value | The 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 Glib::RefPtr< Gio::Cancellable > & | cancellable | ||
) | const |
Asynchronously writes the contents of provider to stream in the given mime_type.
When the operation is finished slot will be called. You can then call write_mime_type_finish() to get the result of the operation.
The given mime type does not need to be listed in the formats returned by ref_formats(). However, if the given Type 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 OutputStream to write to. |
io_priority | The [I/O priority][io-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_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_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes an asynchronous write operation started with write_mime_type_async().
result | A 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. |