{-# LINE 2 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
{-# LANGUAGE OverloadedStrings #-}

{-# LINE 3 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
-- -*-haskell-*-
-- GIMP Toolkit (GTK) Clipboard
--
-- Author : Axel Simon
--
-- Created: 26 March 2007
--
-- Copyright (C) 2007 Axel Simon
--
-- This library is free software; you can redistribute it and/or
-- modify it under the terms of the GNU Lesser General Public
-- License as published by the Free Software Foundation; either
-- version 2.1 of the License, or (at your option) any later version.
--
-- This library is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- Lesser General Public License for more details.
--
-- I removed all definitions for the clipboard by Juergen Nicklisch since
-- the way the clipboards were selected didn't tie in with the Selection
-- module.
--
-- |
-- Maintainer : gtk2hs-users@lists.sourceforge.net
-- Stability : provisional
-- Portability : portable (depends on GHC)
--
-- Storing data on clipboards
--
module Graphics.UI.Gtk.General.Clipboard (

-- * Detail
--
-- | The 'Clipboard' object represents a clipboard of data shared between
-- different processes or between different widgets in the same process. Each
-- clipboard is identified by a 'SelectionTag' which itself is an 'Atom'. The
-- default clipboard corresponds to the 'selectionClipboard' tag; another
-- commonly used clipboard is the 'selectionPrimary' tag, which, in X,
-- traditionally contains the currently selected text.
--
-- To support having a number of different formats on the clipboard at the
-- same time, the clipboard mechanism allows providing callbacks instead of
-- the actual data. When you set the contents of the clipboard, you can either
-- supply the data directly (via functions like 'clipboardSetText'), or you
-- can supply a callback to be called at a later time when the data is needed
-- (via 'clipboardSetWithData'). Providing a callback also avoids having to
-- make copies of the data when it is not needed.
--
-- Setting clipboard data is done using 'clipboardSetWithData' and
-- 'clipboardSetWithOwner'. Both functions are quite similar; the choice
-- between the two depends mostly on which is more convenient in a particular
-- situation. The former is most useful when you want to have a blob of data
-- with callbacks to convert it into the various data types that you
-- advertise. When the @clearFunc@ you provided is called, you simply free the
-- data blob. The latter is more useful when the contents of clipboard reflect
-- the internal state of a 'GObject' (As an example, for the
-- 'selectionPrimary' clipboard, when an entry widget provides the clipboard's
-- contents the contents are simply the text within the selected region.) If
-- the contents change, the entry widget can call 'clipboardSetWithOwner' to
-- update the timestamp for clipboard ownership, without having to worry about
-- @clearFunc@ being called.
--
-- Requesting the data from the clipboard is essentially asynchronous. If the
-- contents of the clipboard are provided within the same process, then a
-- direct function call will be made to retrieve the data, but if they are
-- provided by another process, then the data needs to be retrieved from the
-- other process, which may take some time. To avoid blocking the user
-- interface, the call to request the selection, 'clipboardRequestContents'
-- takes a callback that will be called when the contents are received (or
-- when the request fails.) If you don't want to deal with providing a
-- separate callback, you can also use 'clipboardWaitForContents'. What this
-- does is run the GLib main loop recursively waiting for the contents. This
-- can simplify the code flow, but you still have to be aware that other
-- callbacks in your program can be called while this recursive mainloop is
-- running.
--
-- Along with the functions to get the clipboard contents as an arbitrary data
-- chunk, there are also functions to retrieve it as text,
-- 'clipboardRequestText' and 'clipboardWaitForText'. These functions take
-- care of determining which formats are advertised by the clipboard provider,
-- asking for the clipboard in the best available format and converting the
-- its content.

-- * Class Hierarchy
--
-- |
-- @
-- | 'GObject'
-- | +----Clipboard
-- @

-- * Types
  Clipboard,
  ClipboardClass,
  castToClipboard, gTypeClipboard,
  toClipboard,

-- * Constants
  selectionPrimary,
  selectionSecondary,
  selectionClipboard,

-- * Methods
  clipboardGet,

  clipboardGetForDisplay,
  clipboardGetDisplay,

  clipboardSetWithData,
{-
  clipboardSetWithOwner,
  clipboardGetOwner,
  clipboardClear,
-}
  clipboardSetText,

  clipboardSetImage,

  clipboardRequestContents,
  clipboardRequestText,

  clipboardRequestImage,


  clipboardRequestTargets,

  clipboardRequestRichText,



  clipboardSetCanStore,
  clipboardStore,

  ) where

import System.Glib.FFI
import System.Glib.UTFString
import Graphics.UI.Gtk.Types
{-# LINE 142 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
import Graphics.UI.Gtk.General.DNDTypes (SelectionTag, TargetTag,
  Atom(..))
import Graphics.UI.Gtk.General.Selection (InfoId, SelectionDataM)
import Graphics.UI.Gtk.General.Structs (
  selectionPrimary,
  selectionSecondary,
  selectionClipboard,
  withTargetEntries)
import Control.Monad ( liftM )
import Control.Monad.Reader (runReaderT)
import Data.IORef ( newIORef, readIORef, writeIORef )


{-# LINE 155 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}


--------------------
-- Methods

-- %hash c:d8d1 d:febf
-- | Returns the clipboard object for the given selection. See
-- 'clipboardGetForDisplay' for complete details.
--
clipboardGet ::
  SelectionTag -- ^ @selection@ - a 'SelectionTag' which
                 -- identifies the clipboard to use.
 -> IO Clipboard -- ^ returns the appropriate clipboard object. If no
                 -- clipboard already exists, a new one will be created. Once a
                 -- clipboard object has been created, it is persistent.
clipboardGet :: SelectionTag -> IO Clipboard
clipboardGet (Atom Ptr ()
selection) =
  (ForeignPtr Clipboard -> Clipboard, FinalizerPtr Clipboard)
-> IO (Ptr Clipboard) -> IO Clipboard
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Clipboard -> Clipboard, FinalizerPtr Clipboard)
forall {a}. (ForeignPtr Clipboard -> Clipboard, FinalizerPtr a)
mkClipboard (IO (Ptr Clipboard) -> IO Clipboard)
-> IO (Ptr Clipboard) -> IO Clipboard
forall a b. (a -> b) -> a -> b
$
  Ptr () -> IO (Ptr Clipboard)
gtk_clipboard_get Ptr ()
selection


-- %hash c:251 d:39fa
-- | Returns the clipboard object for the given selection. Cut\/copy\/paste
-- menu items and keyboard shortcuts should use the default clipboard,
-- returned by passing 'selectionClipboard' for @selection@. The
-- currently-selected object or text should be provided on the clipboard
-- identified by 'selectionPrimary'. Cut\/copy\/paste menu items conceptually
-- copy the contents of the 'selectionPrimary' clipboard to the default
-- clipboard, i.e. they copy the selection to what the user sees as the
-- clipboard.
--
-- See
-- <http:
-- discussion of the 'selectionClipboard' vs. 'selectionPrimary' selections
-- under the X window system. On Win32 the 'selectionPrimary' clipboard is
-- essentially ignored.
--
-- It's possible to have arbitrary named clipboards; if you do invent new
-- clipboards, you should prefix the selection name with an underscore
-- (because the ICCCM requires that nonstandard atoms are
-- underscore-prefixed), and namespace it as well. For example, if your
-- application called \"Foo\" has a special-purpose clipboard, you could
-- create it using 'Graphics.UI.Gtk.General.Selection.atomNew'
-- \"_FOO_SPECIAL_CLIPBOARD\".
--
-- * Available since Gtk+ version 2.2
--
clipboardGetForDisplay ::
    Display -- ^ @display@ - the display for which the clipboard is to be
                 -- retrieved or created
 -> SelectionTag -- ^ @selection@ - a 'SelectionTag' which
                 -- identifies the clipboard to use.
 -> IO Clipboard -- ^ returns the appropriate clipboard object. If no
                 -- clipboard already exists, a new one will be created. Once a
                 -- clipboard object has been created, it is persistent.
clipboardGetForDisplay :: Display -> SelectionTag -> IO Clipboard
clipboardGetForDisplay Display
display (Atom Ptr ()
selection) =
  (ForeignPtr Clipboard -> Clipboard, FinalizerPtr Clipboard)
-> IO (Ptr Clipboard) -> IO Clipboard
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Clipboard -> Clipboard, FinalizerPtr Clipboard)
forall {a}. (ForeignPtr Clipboard -> Clipboard, FinalizerPtr a)
mkClipboard (IO (Ptr Clipboard) -> IO Clipboard)
-> IO (Ptr Clipboard) -> IO Clipboard
forall a b. (a -> b) -> a -> b
$
  (\(Display ForeignPtr Display
arg1) Ptr ()
arg2 -> ForeignPtr Display
-> (Ptr Display -> IO (Ptr Clipboard)) -> IO (Ptr Clipboard)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Display
arg1 ((Ptr Display -> IO (Ptr Clipboard)) -> IO (Ptr Clipboard))
-> (Ptr Display -> IO (Ptr Clipboard)) -> IO (Ptr Clipboard)
forall a b. (a -> b) -> a -> b
$ \Ptr Display
argPtr1 ->Ptr Display -> Ptr () -> IO (Ptr Clipboard)
gtk_clipboard_get_for_display Ptr Display
argPtr1 Ptr ()
arg2)
{-# LINE 212 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    display Ptr ()
selection

-- %hash c:3931 d:93f1
-- | Gets the 'Display' associated with @clipboard@
--
-- * Available since Gtk+ version 2.2
--
clipboardGetDisplay :: ClipboardClass self => self
 -> IO Display -- ^ returns the 'Display' associated with @clipboard@
clipboardGetDisplay :: forall self. ClipboardClass self => self -> IO Display
clipboardGetDisplay self
self =
  (ForeignPtr Display -> Display, FinalizerPtr Display)
-> IO (Ptr Display) -> IO Display
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Display -> Display, FinalizerPtr Display)
forall {a}. (ForeignPtr Display -> Display, FinalizerPtr a)
mkDisplay (IO (Ptr Display) -> IO Display) -> IO (Ptr Display) -> IO Display
forall a b. (a -> b) -> a -> b
$
  (\(Clipboard ForeignPtr Clipboard
arg1) -> ForeignPtr Clipboard
-> (Ptr Clipboard -> IO (Ptr Display)) -> IO (Ptr Display)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO (Ptr Display)) -> IO (Ptr Display))
-> (Ptr Clipboard -> IO (Ptr Display)) -> IO (Ptr Display)
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> IO (Ptr Display)
gtk_clipboard_get_display Ptr Clipboard
argPtr1)
{-# LINE 224 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)


-- The memory management of the ClipboardGetFunc and ClipboardClearFunc sucks badly
-- in that there is no consistent way in which the latter could free the function
-- closure of the former, since it is *not* called when the data of the same
-- object is changed. What we do is that we store the function pointers as attributes
-- of the Clipboard. Overwriting or finalizing these attributes will call their
-- destructors and thereby free them. Thus, by setting these attributes each time we
-- install new data functions, we cuningly finalized the previous closures. Hooray.

{-# NOINLINE getFuncQuark #-}
getFuncQuark :: Quark
getFuncQuark :: Quark
getFuncQuark = IO Quark -> Quark
forall a. IO a -> a
unsafePerformIO (IO Quark -> Quark) -> IO Quark -> Quark
forall a b. (a -> b) -> a -> b
$ DefaultGlibString -> IO Quark
forall string. GlibString string => string -> IO Quark
quarkFromString (DefaultGlibString
"hsClipboardGetFuncClosure"::DefaultGlibString)

{-# NOINLINE clearFuncQuark #-}
clearFuncQuark :: Quark
clearFuncQuark :: Quark
clearFuncQuark = IO Quark -> Quark
forall a. IO a -> a
unsafePerformIO (IO Quark -> Quark) -> IO Quark -> Quark
forall a b. (a -> b) -> a -> b
$ DefaultGlibString -> IO Quark
forall string. GlibString string => string -> IO Quark
quarkFromString (DefaultGlibString
"hsClipboardClearFuncClosure"::DefaultGlibString)

-- %hash c:c65a d:b402
-- | Virtually sets the contents of the specified clipboard by providing a
-- list of supported formats for the clipboard data and a function to call to
-- get the actual data when it is requested.
--
clipboardSetWithData :: ClipboardClass self => self
 -> [(TargetTag, InfoId)] -- ^ @targets@ - a list containing information
                              -- about the available forms for the clipboard
                              -- data
 -> (InfoId -> SelectionDataM ())
                              -- ^ @getFunc@ - function to call to get the
                              -- actual clipboard data, should call
                              -- 'selectionDataSet'.
 -> IO () -- ^ @clearFunc@ - when the clipboard contents
                              -- are set again, this function will be called,
                              -- and @getFunc@ will not be subsequently called.
 -> IO Bool -- ^ returns @True@ if setting the clipboard
                              -- data succeeded.
clipboardSetWithData :: forall self.
ClipboardClass self =>
self
-> [(SelectionTag, Quark)]
-> (Quark -> SelectionDataM ())
-> IO ()
-> IO Bool
clipboardSetWithData self
self [(SelectionTag, Quark)]
targets Quark -> SelectionDataM ()
getFunc IO ()
clearFunc = do
  ClipboardGetFunc
gFunPtr <- (Ptr Clipboard -> Ptr () -> Quark -> Ptr () -> IO ())
-> IO ClipboardGetFunc
mkClipboardGetFunc
    (\Ptr Clipboard
_ Ptr ()
sPtr Quark
info Ptr ()
_ -> SelectionDataM () -> Ptr () -> IO ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (Quark -> SelectionDataM ()
getFunc Quark
info) Ptr ()
sPtr IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())
  ClipboardClearFunc
cFunPtr <- (Ptr Clipboard -> Ptr () -> IO ()) -> IO ClipboardClearFunc
mkClipboardClearFunc
    (\Ptr Clipboard
_ Ptr ()
_ -> IO ()
clearFunc)
  Bool
res <- [(SelectionTag, Quark)] -> (Int -> Ptr () -> IO Bool) -> IO Bool
forall a.
[(SelectionTag, Quark)] -> (Int -> Ptr () -> IO a) -> IO a
withTargetEntries [(SelectionTag, Quark)]
targets ((Int -> Ptr () -> IO Bool) -> IO Bool)
-> (Int -> Ptr () -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Int
nTargets Ptr ()
targets ->
    (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
    (\(Clipboard ForeignPtr Clipboard
arg1) Ptr ()
arg2 Quark
arg3 ClipboardGetFunc
arg4 ClipboardClearFunc
arg5 Ptr ()
arg6 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO CInt) -> IO CInt)
-> (Ptr Clipboard -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard
-> Ptr ()
-> Quark
-> ClipboardGetFunc
-> ClipboardClearFunc
-> Ptr ()
-> IO CInt
gtk_clipboard_set_with_data Ptr Clipboard
argPtr1 Ptr ()
arg2 Quark
arg3 ClipboardGetFunc
arg4 ClipboardClearFunc
arg5 Ptr ()
arg6)
{-# LINE 269 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
      (toClipboard self)
      Ptr ()
targets
      (Int -> Quark
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
nTargets)
      ClipboardGetFunc
gFunPtr
      ClipboardClearFunc
cFunPtr
      Ptr ()
forall a. Ptr a
nullPtr
  (\(GObject ForeignPtr GObject
arg1) Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4 -> ForeignPtr GObject -> (Ptr GObject -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr GObject
arg1 ((Ptr GObject -> IO ()) -> IO ())
-> (Ptr GObject -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GObject
argPtr1 ->Ptr GObject -> Quark -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO ()
g_object_set_qdata_full Ptr GObject
argPtr1 Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4) (self -> GObject
forall o. GObjectClass o => o -> GObject
toGObject self
self) Quark
getFuncQuark
     (ClipboardGetFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr ClipboardGetFunc
gFunPtr) FunPtr (Ptr () -> IO ())
destroyFunPtr
  (\(GObject ForeignPtr GObject
arg1) Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4 -> ForeignPtr GObject -> (Ptr GObject -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr GObject
arg1 ((Ptr GObject -> IO ()) -> IO ())
-> (Ptr GObject -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GObject
argPtr1 ->Ptr GObject -> Quark -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO ()
g_object_set_qdata_full Ptr GObject
argPtr1 Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4) (self -> GObject
forall o. GObjectClass o => o -> GObject
toGObject self
self) Quark
clearFuncQuark
     (ClipboardClearFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr ClipboardClearFunc
cFunPtr) FunPtr (Ptr () -> IO ())
destroyFunPtr
  Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
res

type ClipboardGetFunc = FunPtr (((Ptr Clipboard) -> ((Ptr ()) -> (CUInt -> ((Ptr ()) -> (IO ()))))))
{-# LINE 282 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
type ClipboardClearFunc = FunPtr (((Ptr Clipboard) -> ((Ptr ()) -> (IO ()))))
{-# LINE 283 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}

foreign import ccall "wrapper" mkClipboardGetFunc ::
  (Ptr Clipboard -> Ptr () -> (CUInt) -> Ptr () -> IO ()) -> IO ClipboardGetFunc

foreign import ccall "wrapper" mkClipboardClearFunc ::
  (Ptr Clipboard -> Ptr () -> IO ()) -> IO ClipboardClearFunc

-- %hash c:e778 d:7b3f
-- | Virtually sets the contents of the specified clipboard by providing a
-- list of supported formats for the clipboard data and a function to call to
-- get the actual data when it is requested.
--
-- The difference between this function and 'clipboardSetWithData' is that
-- a 'GObject' is passed in.
--
_clipboardSetWithOwner :: (ClipboardClass self, GObjectClass owner) => self
 -> [(TargetTag, InfoId)] -- ^ @targets@ - a list containing information
                              -- about the available forms for the clipboard
                              -- data
 -> (InfoId -> SelectionDataM ())
                              -- ^ @getFunc@ - function to call to get the
                              -- actual clipboard data, should call
                              -- 'selectionDataSet'.
 -> IO () -- ^ @clearFunc@ - when the clipboard contents
                              -- are set again, this function will be called,
                              -- and @getFunc@ will not be subsequently called.
 -> owner -- ^ @owner@ - an object that \"owns\" the data.
 -> IO Bool -- ^ returns @True@ if setting the clipboard
                              -- data succeeded. If setting the clipboard data
                              -- failed the provided callback functions will be
                              -- ignored.
_clipboardSetWithOwner :: forall self owner.
(ClipboardClass self, GObjectClass owner) =>
self
-> [(SelectionTag, Quark)]
-> (Quark -> SelectionDataM ())
-> IO ()
-> owner
-> IO Bool
_clipboardSetWithOwner self
self [(SelectionTag, Quark)]
targets Quark -> SelectionDataM ()
getFunc IO ()
clearFunc owner
owner = do
  ClipboardGetFunc
gFunPtr <- (Ptr Clipboard -> Ptr () -> Quark -> Ptr () -> IO ())
-> IO ClipboardGetFunc
mkClipboardGetFunc
    (\Ptr Clipboard
_ Ptr ()
sPtr Quark
info Ptr ()
_ -> SelectionDataM () -> Ptr () -> IO ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT (Quark -> SelectionDataM ()
getFunc Quark
info) Ptr ()
sPtr IO () -> IO () -> IO ()
forall a b. IO a -> IO b -> IO b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())
  ClipboardClearFunc
cFunPtr <- (Ptr Clipboard -> Ptr () -> IO ()) -> IO ClipboardClearFunc
mkClipboardClearFunc
    (\Ptr Clipboard
_ Ptr ()
_ -> IO ()
clearFunc)
  Bool
res <- [(SelectionTag, Quark)] -> (Int -> Ptr () -> IO Bool) -> IO Bool
forall a.
[(SelectionTag, Quark)] -> (Int -> Ptr () -> IO a) -> IO a
withTargetEntries [(SelectionTag, Quark)]
targets ((Int -> Ptr () -> IO Bool) -> IO Bool)
-> (Int -> Ptr () -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \Int
nTargets Ptr ()
targets ->
    (CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
    (\(Clipboard ForeignPtr Clipboard
arg1) Ptr ()
arg2 Quark
arg3 ClipboardGetFunc
arg4 ClipboardClearFunc
arg5 (GObject ForeignPtr GObject
arg6) -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO CInt) -> IO CInt)
-> (Ptr Clipboard -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->ForeignPtr GObject -> (Ptr GObject -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr GObject
arg6 ((Ptr GObject -> IO CInt) -> IO CInt)
-> (Ptr GObject -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr GObject
argPtr6 ->Ptr Clipboard
-> Ptr ()
-> Quark
-> ClipboardGetFunc
-> ClipboardClearFunc
-> Ptr GObject
-> IO CInt
gtk_clipboard_set_with_owner Ptr Clipboard
argPtr1 Ptr ()
arg2 Quark
arg3 ClipboardGetFunc
arg4 ClipboardClearFunc
arg5 Ptr GObject
argPtr6)
{-# LINE 322 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
      (toClipboard self)
      Ptr ()
targets
      (Int -> Quark
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
nTargets)
      ClipboardGetFunc
gFunPtr
      ClipboardClearFunc
cFunPtr
      (owner -> GObject
forall o. GObjectClass o => o -> GObject
toGObject owner
owner)
  (\(GObject ForeignPtr GObject
arg1) Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4 -> ForeignPtr GObject -> (Ptr GObject -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr GObject
arg1 ((Ptr GObject -> IO ()) -> IO ())
-> (Ptr GObject -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GObject
argPtr1 ->Ptr GObject -> Quark -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO ()
g_object_set_qdata_full Ptr GObject
argPtr1 Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4) (self -> GObject
forall o. GObjectClass o => o -> GObject
toGObject self
self) Quark
getFuncQuark
     (ClipboardGetFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr ClipboardGetFunc
gFunPtr) FunPtr (Ptr () -> IO ())
destroyFunPtr
  (\(GObject ForeignPtr GObject
arg1) Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4 -> ForeignPtr GObject -> (Ptr GObject -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr GObject
arg1 ((Ptr GObject -> IO ()) -> IO ())
-> (Ptr GObject -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr GObject
argPtr1 ->Ptr GObject -> Quark -> Ptr () -> FunPtr (Ptr () -> IO ()) -> IO ()
g_object_set_qdata_full Ptr GObject
argPtr1 Quark
arg2 Ptr ()
arg3 FunPtr (Ptr () -> IO ())
arg4) (self -> GObject
forall o. GObjectClass o => o -> GObject
toGObject self
self) Quark
clearFuncQuark
     (ClipboardClearFunc -> Ptr ()
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr ClipboardClearFunc
cFunPtr) FunPtr (Ptr () -> IO ())
destroyFunPtr
  Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
res

-- %hash c:dba2 d:efc2
-- | If the clipboard contents callbacks were set with
-- 'clipboardSetWithOwner', and the 'clipboardSetWithData' or 'clipboardClear'
-- has not subsequently called, returns the owner set by
-- 'clipboardSetWithOwner'.
--
_clipboardGetOwner :: ClipboardClass self => self
 -> IO (Maybe GObject) -- ^ returns the owner of the clipboard, if any; otherwise
                        -- @Nothing@.
_clipboardGetOwner :: forall self. ClipboardClass self => self -> IO (Maybe GObject)
_clipboardGetOwner self
self =
  (IO (Ptr GObject) -> IO GObject)
-> IO (Ptr GObject) -> IO (Maybe GObject)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr GObject -> GObject, FinalizerPtr GObject)
-> IO (Ptr GObject) -> IO GObject
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr GObject -> GObject, FinalizerPtr GObject)
forall {a}. (ForeignPtr GObject -> GObject, FinalizerPtr a)
mkGObject) (IO (Ptr GObject) -> IO (Maybe GObject))
-> IO (Ptr GObject) -> IO (Maybe GObject)
forall a b. (a -> b) -> a -> b
$
  (\(Clipboard ForeignPtr Clipboard
arg1) -> ForeignPtr Clipboard
-> (Ptr Clipboard -> IO (Ptr GObject)) -> IO (Ptr GObject)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO (Ptr GObject)) -> IO (Ptr GObject))
-> (Ptr Clipboard -> IO (Ptr GObject)) -> IO (Ptr GObject)
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> IO (Ptr GObject)
gtk_clipboard_get_owner Ptr Clipboard
argPtr1)
{-# LINE 346 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)

-- %hash c:d6f8 d:486
-- | Clears the contents of the clipboard. Generally this should only be
-- called between the time you call 'clipboardSetWithOwner' or
-- 'clipboardSetWithData', and when the @clearFunc@ you supplied is called.
-- Otherwise, the clipboard may be owned by someone else.
--
_clipboardClear :: ClipboardClass self => self -> IO ()
_clipboardClear :: forall self. ClipboardClass self => self -> IO ()
_clipboardClear self
self =
  (\(Clipboard ForeignPtr Clipboard
arg1) -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> IO ()
gtk_clipboard_clear Ptr Clipboard
argPtr1)
{-# LINE 357 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)

-- %hash c:5211 d:14c6
-- | Sets the contents of the clipboard to the given UTF-8 string. Gtk+ will
-- make a copy of the text and take responsibility for responding for requests
-- for the text, and for converting the text into the requested format.
--
clipboardSetText :: (ClipboardClass self, GlibString string) => self
 -> string -- ^ @text@ - the text to be set as clipboard content
 -> IO ()
clipboardSetText :: forall self string.
(ClipboardClass self, GlibString string) =>
self -> string -> IO ()
clipboardSetText self
self string
text =
  string -> (CStringLen -> IO ()) -> IO ()
forall a. string -> (CStringLen -> IO a) -> IO a
forall s a. GlibString s => s -> (CStringLen -> IO a) -> IO a
withUTFStringLen string
text ((CStringLen -> IO ()) -> IO ()) -> (CStringLen -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \(Ptr CChar
textPtr,Int
len) ->
  (\(Clipboard ForeignPtr Clipboard
arg1) Ptr CChar
arg2 CInt
arg3 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> Ptr CChar -> CInt -> IO ()
gtk_clipboard_set_text Ptr Clipboard
argPtr1 Ptr CChar
arg2 CInt
arg3)
{-# LINE 370 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    Ptr CChar
textPtr
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
len)


-- %hash c:5172 d:e4dd
-- | Sets the contents of the clipboard to the given 'Pixbuf'. Gtk+ will take
-- responsibility for responding for requests for the image, and for converting
-- the image into the requested format.
--
-- * Available since Gtk+ version 2.6
--
clipboardSetImage :: ClipboardClass self => self
 -> Pixbuf -- ^ @pixbuf@ - a 'Pixbuf'
 -> IO ()
clipboardSetImage :: forall self. ClipboardClass self => self -> Pixbuf -> IO ()
clipboardSetImage self
self Pixbuf
pixbuf =
  (\(Clipboard ForeignPtr Clipboard
arg1) (Pixbuf ForeignPtr Pixbuf
arg2) -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->ForeignPtr Pixbuf -> (Ptr Pixbuf -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Pixbuf
arg2 ((Ptr Pixbuf -> IO ()) -> IO ()) -> (Ptr Pixbuf -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Pixbuf
argPtr2 ->Ptr Clipboard -> Ptr Pixbuf -> IO ()
gtk_clipboard_set_image Ptr Clipboard
argPtr1 Ptr Pixbuf
argPtr2)
{-# LINE 387 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    Pixbuf
pixbuf


-- %hash c:22cd d:f72d
-- | Requests the contents of clipboard as the given target. When the results
-- of the result are later received the supplied callback will be called.
--
clipboardRequestContents :: ClipboardClass self => self
 -> TargetTag -- ^ @target@ - an atom representing the form
                                 -- into which the clipboard owner should
                                 -- convert the selection.
 -> SelectionDataM () -- ^ @callback@ - A function to call when the
                                 -- results are received (or the retrieval
                                 -- fails). If the retrieval fails,
                                 -- 'selectionDataIsValid' returns @False@.
 -> IO ()
clipboardRequestContents :: forall self.
ClipboardClass self =>
self -> SelectionTag -> SelectionDataM () -> IO ()
clipboardRequestContents self
self (Atom Ptr ()
target) SelectionDataM ()
callback = do
  IORef (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
cbRef <- FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
-> IO (IORef (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())))
forall a. a -> IO (IORef a)
newIORef FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
forall a. FunPtr a
nullFunPtr
  FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
cbPtr <- (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
-> IO (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
mkClipboardReceivedFunc
    (\Ptr Clipboard
_ Ptr ()
sPtr Ptr ()
_ -> do
      FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()) -> IO ()
forall a. FunPtr a -> IO ()
freeHaskellFunPtr (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()) -> IO ())
-> IO (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
-> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< IORef (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
-> IO (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
forall a. IORef a -> IO a
readIORef IORef (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
cbRef
      SelectionDataM () -> Ptr () -> IO ()
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT SelectionDataM ()
callback Ptr ()
sPtr
      () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ())
  IORef (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
-> FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()) -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef (FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()))
cbRef FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
cbPtr
  (\(Clipboard ForeignPtr Clipboard
arg1) Ptr ()
arg2 FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
arg3 Ptr ()
arg4 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard
-> Ptr ()
-> FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
-> Ptr ()
-> IO ()
gtk_clipboard_request_contents Ptr Clipboard
argPtr1 Ptr ()
arg2 FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
arg3 Ptr ()
arg4)
{-# LINE 413 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    Ptr ()
target
    FunPtr (Ptr Clipboard -> Ptr () -> Ptr () -> IO ())
cbPtr
    Ptr ()
forall a. Ptr a
nullPtr

type ClipboardReceivedFunc = FunPtr (((Ptr Clipboard) -> ((Ptr ()) -> ((Ptr ()) -> (IO ())))))
{-# LINE 419 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}

foreign import ccall "wrapper" mkClipboardReceivedFunc ::
  (Ptr Clipboard -> Ptr () -> Ptr () -> IO ()) -> IO ClipboardReceivedFunc

-- %hash c:7bb1 d:4ef1
-- | Requests the contents of the clipboard as text. When the text is later
-- received, it will be converted if it is stored in a different character set
-- if necessary, and @callback@ will be called.
--
-- The @text@ parameter to @callback@ will contain the resulting text if the
-- request succeeded, or @Nothing@ if it failed. This could happen for various reasons, in
-- particular if the clipboard was empty or if the contents of the clipboard
-- could not be converted into text form.
--
clipboardRequestText :: (ClipboardClass self, GlibString string) => self
 -> (Maybe string -> IO ()) -- ^ @callback@ - a function to call when
                                     -- the text is received, or the retrieval
                                     -- fails. (It will always be called one
                                     -- way or the other.)
 -> IO ()
clipboardRequestText :: forall self string.
(ClipboardClass self, GlibString string) =>
self -> (Maybe string -> IO ()) -> IO ()
clipboardRequestText self
self Maybe string -> IO ()
callback = do
  IORef (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
cbRef <- FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
-> IO
     (IORef (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())))
forall a. a -> IO (IORef a)
newIORef FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
forall a. FunPtr a
nullFunPtr
  FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
cbPtr <- (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
-> IO (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
mkClipboardTextReceivedFunc
    (\Ptr Clipboard
_ Ptr CChar
sPtr Ptr ()
_ -> do
      FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()) -> IO ()
forall a. FunPtr a -> IO ()
freeHaskellFunPtr (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()) -> IO ())
-> IO (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
-> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< IORef (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
-> IO (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
forall a. IORef a -> IO a
readIORef IORef (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
cbRef
      Maybe string
mStr <- if Ptr CChar
sPtrPtr CChar -> Ptr CChar -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr CChar
forall a. Ptr a
nullPtr then Maybe string -> IO (Maybe string)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe string
forall a. Maybe a
Nothing else
        (string -> Maybe string) -> IO string -> IO (Maybe string)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM string -> Maybe string
forall a. a -> Maybe a
Just (IO string -> IO (Maybe string)) -> IO string -> IO (Maybe string)
forall a b. (a -> b) -> a -> b
$ Ptr CChar -> IO string
forall s. GlibString s => Ptr CChar -> IO s
peekUTFString Ptr CChar
sPtr
      Maybe string -> IO ()
callback Maybe string
mStr)
  IORef (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
-> FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()) -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef (FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ()))
cbRef FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
cbPtr
  (\(Clipboard ForeignPtr Clipboard
arg1) FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
arg2 Ptr ()
arg3 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard
-> FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
-> Ptr ()
-> IO ()
gtk_clipboard_request_text Ptr Clipboard
argPtr1 FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
arg2 Ptr ()
arg3)
{-# LINE 449 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    FunPtr (Ptr Clipboard -> Ptr CChar -> Ptr () -> IO ())
cbPtr
    Ptr ()
forall a. Ptr a
nullPtr

type ClipboardTextReceivedFunc = FunPtr (((Ptr Clipboard) -> ((Ptr CChar) -> ((Ptr ()) -> (IO ())))))
{-# LINE 454 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}

foreign import ccall "wrapper" mkClipboardTextReceivedFunc ::
  (Ptr Clipboard -> CString -> Ptr () -> IO ()) -> IO ClipboardTextReceivedFunc



-- %hash c:3207 d:e3c1
-- | Requests the contents of the clipboard as image. When the image is later
-- received, it will be converted to a 'Pixbuf', and @callback@ will be called.
--
-- The @pixbuf@ parameter to @callback@ will contain the resulting 'Pixbuf'
-- if the request succeeded, or @Nothing@ if it failed. This could happen for various
-- reasons, in particular if the clipboard was empty or if the contents of the
-- clipboard could not be converted into an image.
--
-- * Available since Gtk+ version 2.6
--
clipboardRequestImage :: ClipboardClass self => self
 -> (Maybe Pixbuf -> IO ()) -- ^ @callback@ - a function to call
                                      -- when the image is received, or the
                                      -- retrieval fails. (It will always be
                                      -- called one way or the other.)
 -> IO ()
clipboardRequestImage :: forall self.
ClipboardClass self =>
self -> (Maybe Pixbuf -> IO ()) -> IO ()
clipboardRequestImage self
self Maybe Pixbuf -> IO ()
callback = do
  IORef (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
cbRef <- FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
-> IO
     (IORef (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())))
forall a. a -> IO (IORef a)
newIORef FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
forall a. FunPtr a
nullFunPtr
  FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
cbPtr <- (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
-> IO (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
mkClipboardImageReceivedFunc
    (\Ptr Clipboard
_ Ptr Pixbuf
sPtr Ptr ()
_ -> do
      FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()) -> IO ()
forall a. FunPtr a -> IO ()
freeHaskellFunPtr (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()) -> IO ())
-> IO (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
-> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< IORef (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
-> IO (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
forall a. IORef a -> IO a
readIORef IORef (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
cbRef
      Maybe Pixbuf
mPixbuf <- (IO (Ptr Pixbuf) -> IO Pixbuf)
-> IO (Ptr Pixbuf) -> IO (Maybe Pixbuf)
forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
maybeNull ((ForeignPtr Pixbuf -> Pixbuf, FinalizerPtr Pixbuf)
-> IO (Ptr Pixbuf) -> IO Pixbuf
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewGObject (ForeignPtr Pixbuf -> Pixbuf, FinalizerPtr Pixbuf)
forall {a}. (ForeignPtr Pixbuf -> Pixbuf, FinalizerPtr a)
mkPixbuf) (Ptr Pixbuf -> IO (Ptr Pixbuf)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Pixbuf
sPtr)
      Maybe Pixbuf -> IO ()
callback Maybe Pixbuf
mPixbuf)
  IORef (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
-> FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()) -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef (FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()))
cbRef FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
cbPtr
  (\(Clipboard ForeignPtr Clipboard
arg1) FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
arg2 Ptr ()
arg3 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard
-> FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
-> Ptr ()
-> IO ()
gtk_clipboard_request_image Ptr Clipboard
argPtr1 FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
arg2 Ptr ()
arg3)
{-# LINE 486 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    FunPtr (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ())
cbPtr
    Ptr ()
forall a. Ptr a
nullPtr

type ClipboardImageReceivedFunc = FunPtr (((Ptr Clipboard) -> ((Ptr Pixbuf) -> ((Ptr ()) -> (IO ())))))
{-# LINE 491 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}

foreign import ccall "wrapper" mkClipboardImageReceivedFunc ::
  (Ptr Clipboard -> Ptr Pixbuf -> Ptr () -> IO ()) -> IO ClipboardImageReceivedFunc




-- %hash c:63f6 d:c0e1
-- | Requests the contents of the clipboard as list of supported targets. When
-- the list is later received, @callback@ will be called.
--
-- The @targets@ parameter to @callback@ will contain the resulting targets
-- if the request succeeded, or @Nothing@ if it failed.
--
-- * Available since Gtk+ version 2.4
--
clipboardRequestTargets :: ClipboardClass self => self
 -> (Maybe [TargetTag] -> IO ()) -- ^ @callback@ - a function to call
                                        -- when the targets are received, or
                                        -- the retrieval fails. (It will always
                                        -- be called one way or the other.)
 -> IO ()
clipboardRequestTargets :: forall self.
ClipboardClass self =>
self -> (Maybe [SelectionTag] -> IO ()) -> IO ()
clipboardRequestTargets self
self Maybe [SelectionTag] -> IO ()
callback = do
  IORef
  (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
cbRef <- FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
-> IO
     (IORef
        (FunPtr
           (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())))
forall a. a -> IO (IORef a)
newIORef FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
forall a. FunPtr a
nullFunPtr
  FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
cbPtr <- (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
-> IO
     (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
mkClipboardTargetsReceivedFunc
    (\Ptr Clipboard
_ Ptr (Ptr ())
tPtr CInt
len Ptr ()
_ -> do
      -- We must free Haskell pointer *in* the callback to avoid segfault.
      FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
-> IO ()
forall a. FunPtr a -> IO ()
freeHaskellFunPtr (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
 -> IO ())
-> IO
     (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
-> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< IORef
  (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
-> IO
     (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
forall a. IORef a -> IO a
readIORef IORef
  (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
cbRef
      Maybe [SelectionTag]
mTargets <- if Ptr (Ptr ())
tPtrPtr (Ptr ()) -> Ptr (Ptr ()) -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr (Ptr ())
forall a. Ptr a
nullPtr then Maybe [SelectionTag] -> IO (Maybe [SelectionTag])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe [SelectionTag]
forall a. Maybe a
Nothing else
        ([Ptr ()] -> Maybe [SelectionTag])
-> IO [Ptr ()] -> IO (Maybe [SelectionTag])
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM ([SelectionTag] -> Maybe [SelectionTag]
forall a. a -> Maybe a
Just ([SelectionTag] -> Maybe [SelectionTag])
-> ([Ptr ()] -> [SelectionTag]) -> [Ptr ()] -> Maybe [SelectionTag]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Ptr () -> SelectionTag) -> [Ptr ()] -> [SelectionTag]
forall a b. (a -> b) -> [a] -> [b]
map Ptr () -> SelectionTag
Atom) (IO [Ptr ()] -> IO (Maybe [SelectionTag]))
-> IO [Ptr ()] -> IO (Maybe [SelectionTag])
forall a b. (a -> b) -> a -> b
$ Int -> Ptr (Ptr ()) -> IO [Ptr ()]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray (CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
len) Ptr (Ptr ())
tPtr
      Maybe [SelectionTag] -> IO ()
callback Maybe [SelectionTag]
mTargets)
  IORef
  (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
-> FunPtr
     (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
-> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef
  (FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ()))
cbRef FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
cbPtr
  (\(Clipboard ForeignPtr Clipboard
arg1) FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
arg2 Ptr ()
arg3 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard
-> FunPtr
     (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
-> Ptr ()
-> IO ()
gtk_clipboard_request_targets Ptr Clipboard
argPtr1 FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
arg2 Ptr ()
arg3)
{-# LINE 524 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    FunPtr (Ptr Clipboard -> Ptr (Ptr ()) -> CInt -> Ptr () -> IO ())
cbPtr
    Ptr ()
forall a. Ptr a
nullPtr

type ClipboardTargetsReceivedFunc = FunPtr (((Ptr Clipboard) -> ((Ptr (Ptr ())) -> (CInt -> ((Ptr ()) -> (IO ()))))))
{-# LINE 529 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}

foreign import ccall "wrapper" mkClipboardTargetsReceivedFunc ::
  (Ptr Clipboard -> Ptr (Ptr ()) -> (CInt) -> Ptr () -> IO ()) -> IO ClipboardTargetsReceivedFunc


-- %hash c:5601 d:d6a6
-- | Requests the contents of the clipboard as rich text. When the rich text
-- is later received, @callback@ will be called.
--
-- The @text@ parameter to @callback@ will contain the resulting rich text if
-- the request succeeded, or @Nothing@ if it failed. This function can fail
-- for various reasons, in particular if the clipboard was empty or if the
-- contents of the clipboard could not be converted into rich text form.
--
-- * Available since Gtk+ version 2.10
--
clipboardRequestRichText :: (ClipboardClass self, TextBufferClass buffer, GlibString string) => self
 -> buffer -- ^ @buffer@ - a 'TextBuffer' that determines the supported rich text formats
  -> (Maybe (TargetTag,string) -> IO ()) -- ^ @callback@ - a function to call
                                         -- when the text is received, or the
                                         -- retrieval fails. (It will always be
                                         -- called one way or the other.)
 -> IO ()
clipboardRequestRichText :: forall self buffer string.
(ClipboardClass self, TextBufferClass buffer, GlibString string) =>
self -> buffer -> (Maybe (SelectionTag, string) -> IO ()) -> IO ()
clipboardRequestRichText self
self buffer
buffer Maybe (SelectionTag, string) -> IO ()
callback = do
  IORef
  (FunPtr
     (Ptr Clipboard
      -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
cbRef <- FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
-> IO
     (IORef
        (FunPtr
           (Ptr Clipboard
            -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())))
forall a. a -> IO (IORef a)
newIORef FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
forall a. FunPtr a
nullFunPtr
  FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
cbPtr <- (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
-> IO
     (FunPtr
        (Ptr Clipboard
         -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
mkClipboardRichTextReceivedFunc
    (\Ptr Clipboard
_ Ptr ()
tPtr Ptr CUChar
sPtr Quark
len Ptr ()
_ -> do
      FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
-> IO ()
forall a. FunPtr a -> IO ()
freeHaskellFunPtr (FunPtr
   (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
 -> IO ())
-> IO
     (FunPtr
        (Ptr Clipboard
         -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
-> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< IORef
  (FunPtr
     (Ptr Clipboard
      -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
-> IO
     (FunPtr
        (Ptr Clipboard
         -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
forall a. IORef a -> IO a
readIORef IORef
  (FunPtr
     (Ptr Clipboard
      -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
cbRef
      Maybe (SelectionTag, string)
mRes <- if Ptr CUChar
sPtrPtr CUChar -> Ptr CUChar -> Bool
forall a. Eq a => a -> a -> Bool
==Ptr CUChar
forall a. Ptr a
nullPtr then Maybe (SelectionTag, string) -> IO (Maybe (SelectionTag, string))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (SelectionTag, string)
forall a. Maybe a
Nothing else ((SelectionTag, string) -> Maybe (SelectionTag, string))
-> IO (SelectionTag, string) -> IO (Maybe (SelectionTag, string))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (SelectionTag, string) -> Maybe (SelectionTag, string)
forall a. a -> Maybe a
Just (IO (SelectionTag, string) -> IO (Maybe (SelectionTag, string)))
-> IO (SelectionTag, string) -> IO (Maybe (SelectionTag, string))
forall a b. (a -> b) -> a -> b
$ do
        string
str <- CStringLen -> IO string
forall s. GlibString s => CStringLen -> IO s
peekUTFStringLen (Ptr CUChar -> Ptr CChar
forall a b. Ptr a -> Ptr b
castPtr Ptr CUChar
sPtr,Quark -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral Quark
len)
        (SelectionTag, string) -> IO (SelectionTag, string)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr () -> SelectionTag
Atom Ptr ()
tPtr, string
str)
      Maybe (SelectionTag, string) -> IO ()
callback Maybe (SelectionTag, string)
mRes)
  IORef
  (FunPtr
     (Ptr Clipboard
      -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
-> FunPtr
     (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
-> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef
  (FunPtr
     (Ptr Clipboard
      -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ()))
cbRef FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
cbPtr
  (\(Clipboard ForeignPtr Clipboard
arg1) (TextBuffer ForeignPtr TextBuffer
arg2) FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
arg3 Ptr ()
arg4 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->ForeignPtr TextBuffer -> (Ptr TextBuffer -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr TextBuffer
arg2 ((Ptr TextBuffer -> IO ()) -> IO ())
-> (Ptr TextBuffer -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr TextBuffer
argPtr2 ->Ptr Clipboard
-> Ptr TextBuffer
-> FunPtr
     (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
-> Ptr ()
-> IO ()
gtk_clipboard_request_rich_text Ptr Clipboard
argPtr1 Ptr TextBuffer
argPtr2 FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
arg3 Ptr ()
arg4)
{-# LINE 563 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    (buffer -> TextBuffer
forall o. TextBufferClass o => o -> TextBuffer
toTextBuffer buffer
buffer)
    FunPtr
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> Quark -> Ptr () -> IO ())
cbPtr
    Ptr ()
forall a. Ptr a
nullPtr

type ClipboardRichTextReceivedFunc = FunPtr (((Ptr Clipboard) -> ((Ptr ()) -> ((Ptr CUChar) -> (CUInt -> ((Ptr ()) -> (IO ())))))))
{-# LINE 569 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}

foreign import ccall "wrapper" mkClipboardRichTextReceivedFunc ::
  (Ptr Clipboard -> Ptr () -> Ptr CUChar -> (CUInt) -> Ptr () -> IO ()) ->
  IO ClipboardRichTextReceivedFunc




-- %hash c:6e6a d:f98a
-- | Hints that the clipboard data should be stored somewhere when the
-- application exits or when 'clipboardStore' is called.
--
-- This value is reset when the clipboard owner changes. Where the clipboard
-- data is stored is platform dependent, see 'displayStoreClipboard' for more
-- information.
--
-- * Available since Gtk+ version 2.6
--
clipboardSetCanStore :: ClipboardClass self => self
 -> Maybe [(TargetTag, InfoId)] -- ^ @targets@ - list containing information
                                -- about which forms should be stored or
                                -- @Nothing@ to indicate that all forms
                                -- should be stored.
 -> IO ()
clipboardSetCanStore :: forall self.
ClipboardClass self =>
self -> Maybe [(SelectionTag, Quark)] -> IO ()
clipboardSetCanStore self
self Maybe [(SelectionTag, Quark)]
Nothing =
  (\(Clipboard ForeignPtr Clipboard
arg1) Ptr ()
arg2 CInt
arg3 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> Ptr () -> CInt -> IO ()
gtk_clipboard_set_can_store Ptr Clipboard
argPtr1 Ptr ()
arg2 CInt
arg3)
{-# LINE 595 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    Ptr ()
forall a. Ptr a
nullPtr
    CInt
0
clipboardSetCanStore self
self (Just [(SelectionTag, Quark)]
targets) =
  [(SelectionTag, Quark)] -> (Int -> Ptr () -> IO ()) -> IO ()
forall a.
[(SelectionTag, Quark)] -> (Int -> Ptr () -> IO a) -> IO a
withTargetEntries [(SelectionTag, Quark)]
targets ((Int -> Ptr () -> IO ()) -> IO ())
-> (Int -> Ptr () -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Int
nTargets Ptr ()
targets ->
  (\(Clipboard ForeignPtr Clipboard
arg1) Ptr ()
arg2 CInt
arg3 -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> Ptr () -> CInt -> IO ()
gtk_clipboard_set_can_store Ptr Clipboard
argPtr1 Ptr ()
arg2 CInt
arg3)
{-# LINE 601 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)
    Ptr ()
targets
    (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
nTargets)

-- %hash c:f98a d:ded8
-- | Stores the current clipboard data somewhere so that it will stay around
-- after the application has quit.
--
-- * Available since Gtk+ version 2.6
--
clipboardStore :: ClipboardClass self => self -> IO ()
clipboardStore :: forall self. ClipboardClass self => self -> IO ()
clipboardStore self
self =
  (\(Clipboard ForeignPtr Clipboard
arg1) -> ForeignPtr Clipboard -> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Clipboard
arg1 ((Ptr Clipboard -> IO ()) -> IO ())
-> (Ptr Clipboard -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Clipboard
argPtr1 ->Ptr Clipboard -> IO ()
gtk_clipboard_store Ptr Clipboard
argPtr1)
{-# LINE 614 "./Graphics/UI/Gtk/General/Clipboard.chs" #-}
    (toClipboard self)

foreign import ccall safe "gtk_clipboard_get"
  gtk_clipboard_get :: ((Ptr ()) -> (IO (Ptr Clipboard)))

foreign import ccall safe "gtk_clipboard_get_for_display"
  gtk_clipboard_get_for_display :: ((Ptr Display) -> ((Ptr ()) -> (IO (Ptr Clipboard))))

foreign import ccall safe "gtk_clipboard_get_display"
  gtk_clipboard_get_display :: ((Ptr Clipboard) -> (IO (Ptr Display)))

foreign import ccall safe "gtk_clipboard_set_with_data"
  gtk_clipboard_set_with_data :: ((Ptr Clipboard) -> ((Ptr ()) -> (CUInt -> ((FunPtr ((Ptr Clipboard) -> ((Ptr ()) -> (CUInt -> ((Ptr ()) -> (IO ())))))) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr ()) -> (IO ())))) -> ((Ptr ()) -> (IO CInt)))))))

foreign import ccall unsafe "g_object_set_qdata_full"
  g_object_set_qdata_full :: ((Ptr GObject) -> (CUInt -> ((Ptr ()) -> ((FunPtr ((Ptr ()) -> (IO ()))) -> (IO ())))))

foreign import ccall safe "gtk_clipboard_set_with_owner"
  gtk_clipboard_set_with_owner :: ((Ptr Clipboard) -> ((Ptr ()) -> (CUInt -> ((FunPtr ((Ptr Clipboard) -> ((Ptr ()) -> (CUInt -> ((Ptr ()) -> (IO ())))))) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr ()) -> (IO ())))) -> ((Ptr GObject) -> (IO CInt)))))))

foreign import ccall safe "gtk_clipboard_get_owner"
  gtk_clipboard_get_owner :: ((Ptr Clipboard) -> (IO (Ptr GObject)))

foreign import ccall safe "gtk_clipboard_clear"
  gtk_clipboard_clear :: ((Ptr Clipboard) -> (IO ()))

foreign import ccall safe "gtk_clipboard_set_text"
  gtk_clipboard_set_text :: ((Ptr Clipboard) -> ((Ptr CChar) -> (CInt -> (IO ()))))

foreign import ccall safe "gtk_clipboard_set_image"
  gtk_clipboard_set_image :: ((Ptr Clipboard) -> ((Ptr Pixbuf) -> (IO ())))

foreign import ccall safe "gtk_clipboard_request_contents"
  gtk_clipboard_request_contents :: ((Ptr Clipboard) -> ((Ptr ()) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr ()) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ())))))

foreign import ccall safe "gtk_clipboard_request_text"
  gtk_clipboard_request_text :: ((Ptr Clipboard) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr CChar) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ()))))

foreign import ccall safe "gtk_clipboard_request_image"
  gtk_clipboard_request_image :: ((Ptr Clipboard) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr Pixbuf) -> ((Ptr ()) -> (IO ()))))) -> ((Ptr ()) -> (IO ()))))

foreign import ccall safe "gtk_clipboard_request_targets"
  gtk_clipboard_request_targets :: ((Ptr Clipboard) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr (Ptr ())) -> (CInt -> ((Ptr ()) -> (IO ())))))) -> ((Ptr ()) -> (IO ()))))

foreign import ccall safe "gtk_clipboard_request_rich_text"
  gtk_clipboard_request_rich_text :: ((Ptr Clipboard) -> ((Ptr TextBuffer) -> ((FunPtr ((Ptr Clipboard) -> ((Ptr ()) -> ((Ptr CUChar) -> (CUInt -> ((Ptr ()) -> (IO ()))))))) -> ((Ptr ()) -> (IO ())))))

foreign import ccall safe "gtk_clipboard_set_can_store"
  gtk_clipboard_set_can_store :: ((Ptr Clipboard) -> ((Ptr ()) -> (CInt -> (IO ()))))

foreign import ccall safe "gtk_clipboard_store"
  gtk_clipboard_store :: ((Ptr Clipboard) -> (IO ()))