Represents data shared between applications or inside an application.
To get a GdkClipboard object, use [methodGdk.Display.get_clipboard] or [methodGdk.Display.get_primary_clipboard]. You can find out about the data that is currently available in a clipboard using [methodGdk.Clipboard.get_formats].
To make text or image data available in a clipboard, use [methodGdk.Clipboard.set_text] or [methodGdk.Clipboard.set_texture]. For other data, you can use [methodGdk.Clipboard.set_content], which takes a [classGdk.ContentProvider] object.
To read textual or image data from a clipboard, use [methodGdk.Clipboard.read_text_async] or [methodGdk.Clipboard.read_texture_async]. For other data, use [methodGdk.Clipboard.read_async], which provides a GInputStream object.
type Cb_Gdk_Clipboard_Void is not null access procedure (Self : access Gdk_Clipboard_Record'Class);
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
Content_Property : constant Glib.Properties.Property_Boxed;
Type: Content_Provider The GdkContentProvider or null if the clipboard is empty or contents are provided otherwise.
Display_Property : constant Glib.Properties.Property_Boxed;
Type: Display The GdkDisplay that the clipboard belongs to.
Formats_Property : constant Glib.Properties.Property_Boxed;
Type: Content_Formats The possible formats that the clipboard 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_Clipboard is access all Gdk_Clipboard_Record'Class;
type Gdk_Clipboard_Record is new GObject_Record with null record;
function Get_Content
(Self : not null access Gdk_Clipboard_Record)
return Gdk.Content_Provider.Gdk_Content_Provider
Returns the GdkContentProvider currently set on Clipboard. If the Clipboard is empty or its contents are not owned by the current process, null will be returned.
The content of a clipboard if the clipboard does not maintain any content. Has transfer-ownership='none'.
function Get_Display
(Self : not null access Gdk_Clipboard_Record) return Gdk.Gdk_Display
Gets the GdkDisplay that the clipboard was created for.
a GdkDisplay. Has transfer-ownership='none'.
function Get_Formats
(Self : not null access Gdk_Clipboard_Record)
return Gdk.Content_Formats.Gdk_Content_Formats
Gets the formats that the clipboard can provide its current contents in.
The formats of the clipboard. Has transfer-ownership='none'.
function Get_Type return Glib.GType
function Is_Local
(Self : not null access Gdk_Clipboard_Record) return Boolean
Returns if the clipboard is local. A clipboard is considered local if it was last claimed by the running application. Note that [methodGdk.Clipboard.get_content] may return null even on a local clipboard. In this case the clipboard is empty.
True if the clipboard is local
Local_Property : constant Glib.Properties.Property_Boolean;
True if the contents of the clipboard are owned by this process.
procedure On_Changed
(Self : not null access Gdk_Clipboard_Record;
Call : Cb_Gdk_Clipboard_Void;
After : Boolean := False)
Emitted when the clipboard changes ownership.
procedure On_Changed
(Self : not null access Gdk_Clipboard_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the clipboard changes ownership.
procedure Read_Async
(Self : not null access Gdk_Clipboard_Record;
Mime_Types : GNAT.Strings.String_List;
Io_Priority : Glib.Gint;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
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.
a null-terminated array of mime types to choose from
the I/O priority of the request
optional GCancellable object
callback to call when the request is satisfied
function Read_Finish
(Self : not null access Gdk_Clipboard_Record;
Result : Glib.G_Async_Result;
Out_Mime_Type : access UTF8_String := null;
Error : out Glib.Error.GError)
return Glib.Input_Stream.Ginput_Stream
Finishes an asynchronous clipboard read. See [methodGdk.Clipboard.read_async].
a GAsyncResult
location to store the chosen mime type
the return location for a recoverable error
a GInputStream. Has transfer-ownership='full'.
procedure Read_Text_Async
(Self : not null access Gdk_Clipboard_Record;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
Asynchronously request the Clipboard contents converted to a string. This is a simple wrapper around [methodGdk.Clipboard.read_value_async]. Use that function or [methodGdk.Clipboard.read_async] directly if you need more control over the operation.
optional GCancellable object
callback to call when the request is satisfied
function Read_Text_Finish
(Self : not null access Gdk_Clipboard_Record;
Result : Glib.G_Async_Result;
Error : out Glib.Error.GError) return UTF8_String
Finishes an asynchronous clipboard read. See [methodGdk.Clipboard.read_text_async].
a GAsyncResult
the return location for a recoverable error
a new string
procedure Read_Texture_Async
(Self : not null access Gdk_Clipboard_Record;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
Asynchronously request the Clipboard contents converted to a GdkPixbuf. This is a simple wrapper around [methodGdk.Clipboard.read_value_async]. Use that function or [methodGdk.Clipboard.read_async] directly if you need more control over the operation.
optional GCancellable object, null to ignore.
callback to call when the request is satisfied
function Read_Texture_Finish
(Self : not null access Gdk_Clipboard_Record;
Result : Glib.G_Async_Result;
Error : out Glib.Error.GError) return Gdk.Texture.Gdk_Texture
Finishes an asynchronous clipboard read. See [methodGdk.Clipboard.read_texture_async].
a GAsyncResult
the return location for a recoverable error
a new GdkTexture. Has transfer-ownership='full'.
procedure Read_Value_Async
(Self : not null access Gdk_Clipboard_Record;
The_Type : GType;
Io_Priority : Glib.Gint;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
Asynchronously request the Clipboard contents converted to the given Type. For local clipboard contents that are available in the given GType, the value will be copied directly. Otherwise, GDK will try to use [funcContent_Deserialize_Async] to convert the clipboard's data.
a GType to read
the I/O priority of the request
optional GCancellable object
callback to call when the request is satisfied
function Read_Value_Finish
(Self : not null access Gdk_Clipboard_Record;
Result : Glib.G_Async_Result;
Error : out Glib.Error.GError) return Glib.Values.GValue
Finishes an asynchronous clipboard read. See [methodGdk.Clipboard.read_value_async].
a GAsyncResult
the return location for a recoverable error
a GValue containing the result.
function Set_Content
(Self : not null access Gdk_Clipboard_Record;
Provider : access Gdk.Content_Provider.Gdk_Content_Provider_Record'Class)
return Boolean
Sets a new content provider on Clipboard. The clipboard will claim the GdkDisplay'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.
the new contents of Clipboard or null to clear the clipboard
True if setting the clipboard succeeded
procedure Set_Text
(Self : not null access Gdk_Clipboard_Record;
Text : UTF8_String)
Puts the given Text into the clipboard.
Text to put into the clipboard
procedure Set_Texture
(Self : not null access Gdk_Clipboard_Record;
Texture : not null access Gdk.Texture.Gdk_Texture_Record'Class)
Puts the given Texture into the clipboard.
a GdkTexture to put into the clipboard
procedure Set_Value
(Self : not null access Gdk_Clipboard_Record;
Value : in out Glib.Values.GValue)
Sets the Clipboard to contain the given Value.
a GValue to set
Signal_Changed : constant Glib.Signal_Name := "changed";
Emitted when the clipboard changes ownership.
procedure Store_Async
(Self : not null access Gdk_Clipboard_Record;
Io_Priority : Glib.Gint;
Cancellable : access Glib.Cancellable.Gcancellable_Record'Class;
Callback : Gasync_Ready_Callback)
Asynchronously instructs the Clipboard to store its contents remotely. If the clipboard is not local, this function does nothing but report success. 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 GtkApplication is shut down, so you likely don't need to call it.
the I/O priority of the request
optional GCancellable object
callback to call when the request is satisfied
function Store_Finish
(Self : not null access Gdk_Clipboard_Record;
Result : Glib.G_Async_Result;
Error : out Glib.Error.GError) return Boolean
Finishes an asynchronous clipboard store. See [methodGdk.Clipboard.store_async].
a GAsyncResult
the return location for a recoverable error
True if storing was successful.