Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype Clipboard = Clipboard (ManagedPtr Clipboard)
- class (GObject o, IsDescendantOf Clipboard o) => IsClipboard o
- toClipboard :: (MonadIO m, IsClipboard o) => o -> m Clipboard
- clipboardGetContent :: (HasCallStack, MonadIO m, IsClipboard a) => a -> m (Maybe ContentProvider)
- clipboardGetDisplay :: (HasCallStack, MonadIO m, IsClipboard a) => a -> m Display
- clipboardGetFormats :: (HasCallStack, MonadIO m, IsClipboard a) => a -> m ContentFormats
- clipboardIsLocal :: (HasCallStack, MonadIO m, IsClipboard a) => a -> m Bool
- clipboardReadAsync :: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) => a -> Text -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- clipboardReadFinish :: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) => a -> b -> m (Maybe InputStream, Text)
- clipboardReadTextAsync :: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- clipboardReadTextFinish :: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) => a -> b -> m (Maybe Text)
- clipboardReadTextureAsync :: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) => a -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- clipboardReadTextureFinish :: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) => a -> b -> m (Maybe Texture)
- clipboardReadValueAsync :: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) => a -> GType -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- clipboardReadValueFinish :: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) => a -> b -> m GValue
- clipboardSet :: (HasCallStack, MonadIO m, IsClipboard a) => a -> GValue -> m ()
- clipboardSetContent :: (HasCallStack, MonadIO m, IsClipboard a, IsContentProvider b) => a -> Maybe b -> m Bool
- clipboardStoreAsync :: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) => a -> Int32 -> Maybe b -> Maybe AsyncReadyCallback -> m ()
- clipboardStoreFinish :: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) => a -> b -> m ()
- getClipboardContent :: (MonadIO m, IsClipboard o) => o -> m (Maybe ContentProvider)
- constructClipboardDisplay :: (IsClipboard o, MonadIO m, IsDisplay a) => a -> m (GValueConstruct o)
- getClipboardDisplay :: (MonadIO m, IsClipboard o) => o -> m Display
- getClipboardFormats :: (MonadIO m, IsClipboard o) => o -> m ContentFormats
- getClipboardLocal :: (MonadIO m, IsClipboard o) => o -> m Bool
- type C_ClipboardChangedCallback = Ptr () -> Ptr () -> IO ()
- type ClipboardChangedCallback = IO ()
- afterClipboardChanged :: (IsClipboard a, MonadIO m) => a -> ClipboardChangedCallback -> m SignalHandlerId
- genClosure_ClipboardChanged :: MonadIO m => ClipboardChangedCallback -> m (GClosure C_ClipboardChangedCallback)
- mk_ClipboardChangedCallback :: C_ClipboardChangedCallback -> IO (FunPtr C_ClipboardChangedCallback)
- noClipboardChangedCallback :: Maybe ClipboardChangedCallback
- onClipboardChanged :: (IsClipboard a, MonadIO m) => a -> ClipboardChangedCallback -> m SignalHandlerId
- wrap_ClipboardChangedCallback :: ClipboardChangedCallback -> C_ClipboardChangedCallback
Exported types
Memory-managed wrapper type.
Instances
Eq Clipboard Source # | |
GObject Clipboard Source # | |
Defined in GI.Gdk.Objects.Clipboard | |
ManagedPtrNewtype Clipboard Source # | |
Defined in GI.Gdk.Objects.Clipboard toManagedPtr :: Clipboard -> ManagedPtr Clipboard | |
TypedObject Clipboard Source # | |
Defined in GI.Gdk.Objects.Clipboard | |
HasParentTypes Clipboard Source # | |
Defined in GI.Gdk.Objects.Clipboard | |
IsGValue (Maybe Clipboard) Source # | Convert |
Defined in GI.Gdk.Objects.Clipboard gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Clipboard -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Clipboard) | |
type ParentTypes Clipboard Source # | |
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
(GObject o, IsDescendantOf Clipboard o) => IsClipboard o Source # | |
Defined in GI.Gdk.Objects.Clipboard |
toClipboard :: (MonadIO m, IsClipboard o) => o -> m Clipboard Source #
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, isLocal, notify, notifyByPspec, readAsync, readFinish, readTextAsync, readTextFinish, readTextureAsync, readTextureFinish, readValueAsync, readValueFinish, ref, refSink, runDispose, set, stealData, stealQdata, storeAsync, storeFinish, thawNotify, unref, watchClosure.
Getters
getContent, getData, getDisplay, getFormats, getProperty, getQdata.
Setters
getContent
:: (HasCallStack, MonadIO m, IsClipboard a) | |
=> a |
|
-> m (Maybe ContentProvider) | Returns: The content of a clipboard or |
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
:: (HasCallStack, MonadIO m, IsClipboard a) | |
=> a |
|
-> m Display | Returns: a |
Gets the Display
that the clipboard was created for.
getFormats
:: (HasCallStack, MonadIO m, IsClipboard a) | |
=> a |
|
-> m ContentFormats | Returns: The formats of the clipboard |
Gets the formats that the clipboard can provide its current contents in.
isLocal
:: (HasCallStack, MonadIO m, IsClipboard a) | |
=> a |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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
:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m (Maybe InputStream, Text) | Returns: a |
Finishes an asynchronous clipboard read started with clipboardReadAsync
.
readTextAsync
clipboardReadTextAsync Source #
:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m (Maybe Text) | Returns: a new string or |
Finishes an asynchronous clipboard read started with
clipboardReadTextAsync
.
readTextureAsync
clipboardReadTextureAsync Source #
:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m (Maybe Texture) | Returns: a new |
Finishes an asynchronous clipboard read started with
clipboardReadTextureAsync
.
readValueAsync
clipboardReadValueAsync Source #
:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) | |
=> a |
|
-> GType |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m GValue |
Finishes an asynchronous clipboard read started with
clipboardReadValueAsync
.
set
:: (HasCallStack, MonadIO m, IsClipboard a) | |
=> a |
|
-> GValue |
|
-> m () |
Sets the clipboard
to contain the given value
.
setContent
:: (HasCallStack, MonadIO m, IsClipboard a, IsContentProvider b) | |
=> a |
|
-> Maybe b |
|
-> m Bool | Returns: |
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
:: (HasCallStack, MonadIO m, IsClipboard a, IsCancellable b) | |
=> a |
|
-> Int32 |
|
-> Maybe b |
|
-> Maybe AsyncReadyCallback |
|
-> 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
:: (HasCallStack, MonadIO m, IsClipboard a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
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
.
mk_ClipboardChangedCallback :: C_ClipboardChangedCallback -> IO (FunPtr C_ClipboardChangedCallback) Source #
Generate a function pointer callable from C code, from a C_ClipboardChangedCallback
.
noClipboardChangedCallback :: Maybe ClipboardChangedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
ClipboardChangedCallback
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