Provides content for the clipboard or for drag-and-drop operations in a number of formats.
To create a GdkContentProvider, use [ctorGdk.ContentProvider.new_for_value] or [ctorGdk.ContentProvider.new_for_bytes].
GDK knows how to handle common text and image formats out-of-the-box. See [classGdk.ContentSerializer] and [classGdk.ContentDeserializer] if you want to add support for application-specific data formats.
type Cb_Gdk_Content_Provider_Void is not null access procedure
(Self : access Gdk_Content_Provider_Record'Class);
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
procedure Content_Changed
(Self : not null access Gdk_Content_Provider_Record)
Emits the ::content-changed signal.
Formats_Property : constant Glib.Properties.Property_Boxed;
Type: Content_Formats The possible formats that the provider can provide its data in.
type Gasync_Ready_Callback is access procedure
(Source_Object : access Glib.Object.GObject_Record'Class;
Res : Glib.G_Async_Result);
Type definition for a function that will be called back when an asynchronous operation within GIO has been completed. Gasync_Ready_Callback callbacks from Gtask.Gtask are guaranteed to be invoked in a later iteration of the thread-default main context (see [methodGlib.MainContext.push_thread_default]) where the Gtask.Gtask was created. All other users of Gasync_Ready_Callback must likewise call it asynchronously in a later iteration of the main context. The asynchronous operation is guaranteed to have held a reference to Source_Object from the time when the *_async function was called, until after this callback returns.
the object the asynchronous operation was started with.
a Glib.G_Async_Result.
type Gdk_Content_Provider is access all Gdk_Content_Provider_Record'Class;
function Gdk_Content_Provider_New_For_Bytes
(Mime_Type : UTF8_String;
Bytes : Glib.Bytes.Gbytes) return Gdk_Content_Provider
Create a content provider that provides the given Bytes as data for the given Mime_Type.
the mime type
a GBytes with the data for Mime_Type
function Gdk_Content_Provider_New_For_Value
(Value : in out Glib.Values.GValue) return Gdk_Content_Provider
Create a content provider that provides the given Value.
a GValue
type Gdk_Content_Provider_Record is new GObject_Record with null record;
procedure Gdk_New_For_Bytes
(Self : out Gdk_Content_Provider;
Mime_Type : UTF8_String;
Bytes : Glib.Bytes.Gbytes)
Create a content provider that provides the given Bytes as data for the given Mime_Type.
the mime type
a GBytes with the data for Mime_Type
procedure Gdk_New_For_Value
(Self : out Gdk_Content_Provider;
Value : in out Glib.Values.GValue)
Create a content provider that provides the given Value.
a GValue
function Get_Type return Glib.GType
function Get_Value
(Self : not null access Gdk_Content_Provider_Record;
Value : in out Glib.Values.GValue;
Error : out Glib.Error.GError) return Boolean
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 [methodGdk.ContentProvider.ref_formats]. However, if the given GType is not supported, this operation can fail and G_IO_ERROR_NOT_SUPPORTED will be reported.
the GValue to fill
the return location for a recoverable error
True if the value was set successfully. Otherwise Error will be set to describe the failure.
procedure Initialize_For_Bytes
(Self : not null access Gdk_Content_Provider_Record'Class;
Mime_Type : UTF8_String;
Bytes : Glib.Bytes.Gbytes)
Create a content provider that provides the given Bytes as data for the given Mime_Type. Initialize_For_Bytes does nothing if the object was already created with another call to Initialize* or G_New.
the mime type
a GBytes with the data for Mime_Type
procedure Initialize_For_Value
(Self : not null access Gdk_Content_Provider_Record'Class;
Value : in out Glib.Values.GValue)
Create a content provider that provides the given Value. Initialize_For_Value does nothing if the object was already created with another call to Initialize* or G_New.
a GValue
procedure On_Content_Changed
(Self : not null access Gdk_Content_Provider_Record;
Call : Cb_Gdk_Content_Provider_Void;
After : Boolean := False)
Emitted whenever the content provided by this provider has changed.
procedure On_Content_Changed
(Self : not null access Gdk_Content_Provider_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted whenever the content provided by this provider has changed.
function Ref_Formats
(Self : not null access Gdk_Content_Provider_Record)
return Gdk.Content_Formats.Gdk_Content_Formats
Gets the formats that the provider can provide its current contents in.
The formats of the provider. Has transfer-ownership='full'.
function Ref_Storable_Formats
(Self : not null access Gdk_Content_Provider_Record)
return Gdk.Content_Formats.Gdk_Content_Formats
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 [methodGdk.ContentProvider.ref_formats].
The storable formats of the provider. Has transfer-ownership='full'.
Signal_Content_Changed : constant Glib.Signal_Name := "content-changed";
Emitted whenever the content provided by this provider has changed.
Storable_Formats_Property : constant Glib.Properties.Property_Boxed;
Type: Content_Formats The subset of formats that clipboard managers should store this provider's data in.
procedure Write_Mime_Type_Async
(Self : not null access Gdk_Content_Provider_Record;
Mime_Type : UTF8_String;
Stream : not null access Glib.Output_Stream.Goutput_Stream_Record'Class;
Io_Priority : Glib.Gint;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
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 [methodGdk.ContentProvider.ref_formats]. However, if the given GType is not supported, G_IO_ERROR_NOT_SUPPORTED will be reported. The given Stream will not be closed.
the mime type to provide the data in
the GOutputStream to write to
I/O priority of the request.
optional GCancellable object, null to ignore.
callback to call when the request is satisfied
function Write_Mime_Type_Finish
(Self : not null access Gdk_Content_Provider_Record;
Result : Glib.G_Async_Result;
Error : out Glib.Error.GError) return Boolean
Finishes an asynchronous write operation. See [methodGdk.ContentProvider.write_mime_type_async].
a GAsyncResult
the return location for a recoverable error
True if the operation was completed successfully. Otherwise Error will be set to describe the failure.