packages feed

gi-gtk-0.3.18.13: GI/Gtk/Structs/BindingArg.hs


{- |
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 #GtkBindingArg holds the data associated with
an argument for a key binding signal emission as
stored in #GtkBindingSignal.
-}

module GI.Gtk.Structs.BindingArg
    ( 

-- * Exported types
    BindingArg(..)                          ,
    newZeroBindingArg                       ,
    noBindingArg                            ,


 -- * Properties
-- ** ArgType
    bindingArgReadArgType                   ,




    ) 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

newtype BindingArg = BindingArg (ForeignPtr BindingArg)
-- | Construct a `BindingArg` struct initialized to zero.
newZeroBindingArg :: MonadIO m => m BindingArg
newZeroBindingArg = liftIO $ callocBytes 8 >>= wrapPtr BindingArg

noBindingArg :: Maybe BindingArg
noBindingArg = Nothing

bindingArgReadArgType :: BindingArg -> IO GType
bindingArgReadArgType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CGType
    let val' = GType val
    return val'

type family ResolveBindingArgMethod (t :: Symbol) (o :: *) :: * where
    ResolveBindingArgMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveBindingArgMethod t BindingArg, MethodInfo info BindingArg p) => IsLabelProxy t (BindingArg -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveBindingArgMethod t BindingArg, MethodInfo info BindingArg p) => IsLabel t (BindingArg -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif