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

GI.Gdk.Objects.Clipboard

Description

The GdkClipboard object represents data shared between applications or inside an 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 Clipboard.set_text() or 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 GInputStream object.

Synopsis

Exported types

newtype Clipboard Source #

Memory-managed wrapper type.

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

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

type ParentTypes Clipboard Source # 
Instance details

Defined in GI.Gdk.Objects.Clipboard

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 GdkClipboard

-> m (Maybe ContentProvider)

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

Returns the GdkContentProvider 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 GdkClipboard

-> m Display

Returns: a GdkDisplay

Gets the GdkDisplay that the clipboard was created for.

getFormats

clipboardGetFormats Source #

Arguments

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

clipboard: a GdkClipboard

-> 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 GdkClipboard

-> 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 GdkClipboard

-> [Text]

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

-> Int32

ioPriority: the I/O priority of the request

-> Maybe b

cancellable: optional GCancellable object

-> 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 must 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 GdkClipboard

-> b

result: a GAsyncResult

-> m (Maybe InputStream, Text)

Returns: a GInputStream (Can throw GError)

Finishes an asynchronous clipboard read.

See clipboardReadAsync.

readTextAsync

clipboardReadTextAsync Source #

Arguments

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

clipboard: a GdkClipboard

-> Maybe b

cancellable: optional GCancellable object

-> 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 must 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 GdkClipboard

-> b

result: a GAsyncResult

-> m (Maybe Text)

Returns: a new string (Can throw GError)

Finishes an asynchronous clipboard read.

See clipboardReadTextAsync.

readTextureAsync

clipboardReadTextureAsync Source #

Arguments

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

clipboard: a GdkClipboard

-> Maybe b

cancellable: optional GCancellable object, Nothing to ignore.

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously request the clipboard contents converted to a GdkPixbuf.

When the operation is finished callback will be called. You must 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 GdkClipboard

-> b

result: a GAsyncResult

-> m (Maybe Texture)

Returns: a new GdkTexture (Can throw GError)

Finishes an asynchronous clipboard read.

See clipboardReadTextureAsync.

readValueAsync

clipboardReadValueAsync Source #

Arguments

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

clipboard: a GdkClipboard

-> GType

type: a GType to read

-> Int32

ioPriority: the I/O priority of the request

-> Maybe b

cancellable: optional GCancellable object

-> 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 must then call clipboardReadValueFinish to get the resulting GValue.

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

readValueFinish

clipboardReadValueFinish Source #

Arguments

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

clipboard: a GdkClipboard

-> b

result: a GAsyncResult

-> m GValue

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

Finishes an asynchronous clipboard read.

See clipboardReadValueAsync.

set

clipboardSet Source #

Arguments

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

clipboard: a GdkClipboard

-> GValue

value: a GValue 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 GdkClipboard

-> 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 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.

storeAsync

clipboardStoreAsync Source #

Arguments

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

clipboard: a GdkClipboard

-> Int32

ioPriority: the I/O priority of the request

-> Maybe b

cancellable: optional GCancellable object

-> Maybe AsyncReadyCallback

callback: callback to call when the request is satisfied

-> m () 

Asynchronously instructs the clipboard to store its contents remotely.

If the clipboard is not local, this function does nothing but report success.

The callback must call clipboardStoreFinish.

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 Gtk.Application is shut down, so you likely don't need to call it.

storeFinish

clipboardStoreFinish Source #

Arguments

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

clipboard: a GdkClipboard

-> b

result: a GAsyncResult

-> m ()

(Can throw GError)

Finishes an asynchronous clipboard store.

See clipboardStoreAsync.

Properties

content

The GdkContentProvider 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 GdkDisplay 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 ClipboardChangedCallback = IO () Source #

Emitted when the clipboard changes ownership.

afterClipboardChanged :: (IsClipboard a, MonadIO m) => a -> ((?self :: 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

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit ?self parameter. Note that this requires activating the ImplicitParams GHC extension.

onClipboardChanged :: (IsClipboard a, MonadIO m) => a -> ((?self :: 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