gi-gdk-4.0.3: Gdk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Gdk.Objects.Clipboard

Description

The Clipboard object represents a clipboard of data shared between different applications or between different parts of the same application.

To get a GdkClipboard object, use displayGetClipboard or displayGetPrimaryClipboard. You can find out about the data that is currently available in a clipboard using clipboardGetFormats.

To make text or image data available in a clipboard, use gdk_clipboard_set_text() or gdk_clipboard_set_texture(). For other data, you can use clipboardSetContent, which takes a ContentProvider object.

To read textual or image data from a clipboard, use clipboardReadTextAsync or clipboardReadTextureAsync. For other data, use clipboardReadAsync, which provides a InputStream object.

Synopsis

Exported types

newtype Clipboard Source #

Memory-managed wrapper type.

Constructors

Clipboard (ManagedPtr Clipboard) 

Instances

Instances details
Eq Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

GObject Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

ManagedPtrNewtype Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

Methods

toManagedPtr :: Clipboard -> ManagedPtr Clipboard

TypedObject Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

Methods

glibType :: IO GType

HasParentTypes Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

IsGValue (Maybe Clipboard) Source #

Convert Clipboard to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gdk.Objects.Clipboard

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Clipboard -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Clipboard)

type ParentTypes Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

type ParentTypes Clipboard = '[Object]

class (GObject o, IsDescendantOf Clipboard o) => IsClipboard o Source #

Type class for types which can be safely cast to Clipboard, for instance with toClipboard.

Instances

Instances details
(GObject o, IsDescendantOf Clipboard o) => IsClipboard o Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

toClipboard :: (MonadIO m, IsClipboard o) => o -> m Clipboard Source #

Cast to Clipboard, for types for which this is known to be safe. For general casts, use castTo.

Methods

getContent

clipboardGetContent Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a) 
=> a

clipboard: a Clipboard

-> m (Maybe ContentProvider)

Returns: The content of a clipboard or Nothing if the clipboard does not maintain any content.

Returns the ContentProvider currently set on clipboard. If the clipboard is empty or its contents are not owned by the current process, Nothing will be returned.

getDisplay

clipboardGetDisplay Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a) 
=> a

clipboard: a Clipboard

-> m Display

Returns: a Display

Gets the Display that the clipboard was created for.

getFormats

clipboardGetFormats Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a) 
=> a

clipboard: a Clipboard

-> m ContentFormats

Returns: The formats of the clipboard

Gets the formats that the clipboard can provide its current contents in.

isLocal

clipboardIsLocal Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a) 
=> a

clipboard: a Clipboard

-> m Bool

Returns: True if the clipboard is local

Returns if the clipboard is local. A clipboard is considered local if it was last claimed by the running application.

Note that clipboardGetContent may return Nothing even on a local clipboard. In this case the clipboard is empty.

readAsync

clipboardReadAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) 
=> a

clipboard: a Clipboard

-> Text

mimeTypes: a Nothing-terminated array of mime types to choose from

-> Int32

ioPriority: the [I/O priority][io-priority] of the request.

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously requests an input stream to read the clipboard's contents from. When the operation is finished callback will be called. You can then call clipboardReadFinish to get the result of the operation.

The clipboard will choose the most suitable mime type from the given list to fulfill the request, preferring the ones listed first.

readFinish

clipboardReadFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) 
=> a

clipboard: a Clipboard

-> b

result: a AsyncResult

-> m (Maybe InputStream, Text)

Returns: a InputStream or Nothing on error. (Can throw GError)

Finishes an asynchronous clipboard read started with clipboardReadAsync.

readTextAsync

clipboardReadTextAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) 
=> a

clipboard: a Clipboard

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously request the clipboard contents converted to a string. When the operation is finished callback will be called. You can then call clipboardReadTextFinish to get the result.

This is a simple wrapper around clipboardReadValueAsync. Use that function or clipboardReadAsync directly if you need more control over the operation.

readTextFinish

clipboardReadTextFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) 
=> a

clipboard: a Clipboard

-> b

result: a AsyncResult

-> m (Maybe Text)

Returns: a new string or Nothing on error. (Can throw GError)

Finishes an asynchronous clipboard read started with clipboardReadTextAsync.

readTextureAsync

clipboardReadTextureAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) 
=> a

clipboard: a Clipboard

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously request the clipboard contents converted to a Pixbuf. When the operation is finished callback will be called. You can then call clipboardReadTextureFinish to get the result.

This is a simple wrapper around clipboardReadValueAsync. Use that function or clipboardReadAsync directly if you need more control over the operation.

readTextureFinish

clipboardReadTextureFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) 
=> a

clipboard: a Clipboard

-> b

result: a AsyncResult

-> m (Maybe Texture)

Returns: a new Texture or Nothing on error. (Can throw GError)

Finishes an asynchronous clipboard read started with clipboardReadTextureAsync.

readValueAsync

clipboardReadValueAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) 
=> a

clipboard: a Clipboard

-> GType

type: a GType to read

-> Int32

ioPriority: the [I/O priority][io-priority] of the request.

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously request the clipboard contents converted to the given type. When the operation is finished callback will be called. You can then call clipboardReadValueFinish to get the resulting Value.

For local clipboard contents that are available in the given GType, the value will be copied directly. Otherwise, GDK will try to use contentDeserializeAsync to convert the clipboard's data.

readValueFinish

clipboardReadValueFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) 
=> a

clipboard: a Clipboard

-> b

result: a AsyncResult

-> m GValue

Returns: a Value containing the result. (Can throw GError)

Finishes an asynchronous clipboard read started with clipboardReadValueAsync.

set

clipboardSet Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a) 
=> a

clipboard: a Clipboard

-> GValue

value: a Value to set

-> m () 

Sets the clipboard to contain the given value.

setContent

clipboardSetContent Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsContentProvider b) 
=> a

clipboard: a Clipboard

-> Maybe b

provider: the new contents of clipboard or Nothing to clear the clipboard

-> m Bool

Returns: True if setting the clipboard succeeded

Sets a new content provider on clipboard. The clipboard will claim the 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.

storeAsync

clipboardStoreAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) 
=> a

clipboard: a Clipboard

-> Int32

ioPriority: the [I/O priority][io-priority] of the request.

-> Maybe b

cancellable: optional Cancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously instructs the clipboard to store its contents remotely to preserve them for later usage. If the clipboard is not local, this function does nothing but report success.

This function is called automatically when gtk_main() or GtkApplication exit, so you likely don't need to call it.

storeFinish

clipboardStoreFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) 
=> a

clipboard: a Clipboard

-> b

result: a AsyncResult

-> m ()

(Can throw GError)

Finishes an asynchronous clipboard store started with clipboardStoreAsync.

Properties

content

The ContentProvider or Nothing if the clipboard is empty or contents are provided otherwise.

getClipboardContent :: (MonadIO m, IsClipboard o) => o -> m (Maybe ContentProvider) Source #

Get the value of the “content” property. When overloading is enabled, this is equivalent to

get clipboard #content

display

The Display that the clipboard belongs to.

constructClipboardDisplay :: (IsClipboard o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o) Source #

Construct a GValueConstruct with valid value for the “display” property. This is rarely needed directly, but it is used by new.

getClipboardDisplay :: (MonadIO m, IsClipboard o) => o -> m Display Source #

Get the value of the “display” property. When overloading is enabled, this is equivalent to

get clipboard #display

formats

The possible formats that the clipboard can provide its data in.

getClipboardFormats :: (MonadIO m, IsClipboard o) => o -> m ContentFormats Source #

Get the value of the “formats” property. When overloading is enabled, this is equivalent to

get clipboard #formats

local

True if the contents of the clipboard are owned by this process.

getClipboardLocal :: (MonadIO m, IsClipboard o) => o -> m Bool Source #

Get the value of the “local” property. When overloading is enabled, this is equivalent to

get clipboard #local

Signals

changed

type C_ClipboardChangedCallback = Ptr () -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

type ClipboardChangedCallback = IO () Source #

The changed signal is emitted when the clipboard changes ownership.

afterClipboardChanged :: (IsClipboard a, MonadIO m) => a -> ClipboardChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after clipboard #changed callback

genClosure_ClipboardChanged :: MonadIO m => ClipboardChangedCallback -> m (GClosure C_ClipboardChangedCallback) Source #

Wrap the callback into a GClosure.

onClipboardChanged :: (IsClipboard a, MonadIO m) => a -> ClipboardChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the changed signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on clipboard #changed callback