{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) A #GtkTargetPair is used to represent the same information as a table of #GtkTargetEntry, but in an efficient form. -} module GI.Gtk.Structs.TargetPair ( -- * Exported types TargetPair(..) , noTargetPair , -- * Properties -- ** Flags targetPairReadFlags , -- ** Info targetPairReadInfo , -- ** Target targetPairReadTarget , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gtk.Types import GI.Gtk.Callbacks import qualified GI.Gdk as Gdk newtype TargetPair = TargetPair (ForeignPtr TargetPair) noTargetPair :: Maybe TargetPair noTargetPair = Nothing targetPairReadTarget :: TargetPair -> IO Gdk.Atom targetPairReadTarget s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO (Ptr Gdk.Atom) -- XXX Wrapping a foreign struct/union with no known destructor, leak? val' <- (\x -> Gdk.Atom <$> newForeignPtr_ x) val return val' targetPairReadFlags :: TargetPair -> IO Word32 targetPairReadFlags s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Word32 return val targetPairReadInfo :: TargetPair -> IO Word32 targetPairReadInfo s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO Word32 return val