packages feed

gi-gtk-0.3.18.13: GI/Gtk/Structs/RcProperty.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)

Deprecated
-}

module GI.Gtk.Structs.RcProperty
    ( 

-- * Exported types
    RcProperty(..)                          ,
    newZeroRcProperty                       ,
    noRcProperty                            ,


 -- * Methods
-- ** rcPropertyParseBorder
    rcPropertyParseBorder                   ,


-- ** rcPropertyParseColor
    rcPropertyParseColor                    ,


-- ** rcPropertyParseEnum
    rcPropertyParseEnum                     ,


-- ** rcPropertyParseFlags
    rcPropertyParseFlags                    ,


-- ** rcPropertyParseRequisition
    rcPropertyParseRequisition              ,




 -- * Properties
-- ** Origin
    rcPropertyReadOrigin                    ,


-- ** PropertyName
    rcPropertyReadPropertyName              ,


-- ** TypeName
    rcPropertyReadTypeName                  ,


-- ** Value
    rcPropertyReadValue                     ,




    ) 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.GLib as GLib

newtype RcProperty = RcProperty (ForeignPtr RcProperty)
-- | Construct a `RcProperty` struct initialized to zero.
newZeroRcProperty :: MonadIO m => m RcProperty
newZeroRcProperty = liftIO $ callocBytes 40 >>= wrapPtr RcProperty

noRcProperty :: Maybe RcProperty
noRcProperty = Nothing

rcPropertyReadTypeName :: RcProperty -> IO Word32
rcPropertyReadTypeName s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Word32
    return val

rcPropertyReadPropertyName :: RcProperty -> IO Word32
rcPropertyReadPropertyName s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO Word32
    return val

rcPropertyReadOrigin :: RcProperty -> IO T.Text
rcPropertyReadOrigin s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    val' <- cstringToText val
    return val'

rcPropertyReadValue :: RcProperty -> IO GValue
rcPropertyReadValue s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr GValue)
    val' <- (newBoxed GValue) val
    return val'

-- method RcProperty::parse_border
-- method type : MemberFunction
-- Args : [Arg {argCName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gstring", argType = TInterface "GLib" "String", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_rc_property_parse_border" gtk_rc_property_parse_border :: 
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr GLib.String ->                      -- gstring : TInterface "GLib" "String"
    Ptr GValue ->                           -- property_value : TInterface "GObject" "Value"
    IO CInt


rcPropertyParseBorder ::
    (MonadIO m) =>
    GParamSpec                              -- pspec
    -> GLib.String                          -- gstring
    -> GValue                               -- propertyValue
    -> m Bool                               -- result
rcPropertyParseBorder pspec gstring propertyValue = liftIO $ do
    let pspec' = unsafeManagedPtrGetPtr pspec
    let gstring' = unsafeManagedPtrGetPtr gstring
    let propertyValue' = unsafeManagedPtrGetPtr propertyValue
    result <- gtk_rc_property_parse_border pspec' gstring' propertyValue'
    let result' = (/= 0) result
    touchManagedPtr gstring
    touchManagedPtr propertyValue
    return result'

-- method RcProperty::parse_color
-- method type : MemberFunction
-- Args : [Arg {argCName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gstring", argType = TInterface "GLib" "String", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_rc_property_parse_color" gtk_rc_property_parse_color :: 
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr GLib.String ->                      -- gstring : TInterface "GLib" "String"
    Ptr GValue ->                           -- property_value : TInterface "GObject" "Value"
    IO CInt


rcPropertyParseColor ::
    (MonadIO m) =>
    GParamSpec                              -- pspec
    -> GLib.String                          -- gstring
    -> GValue                               -- propertyValue
    -> m Bool                               -- result
rcPropertyParseColor pspec gstring propertyValue = liftIO $ do
    let pspec' = unsafeManagedPtrGetPtr pspec
    let gstring' = unsafeManagedPtrGetPtr gstring
    let propertyValue' = unsafeManagedPtrGetPtr propertyValue
    result <- gtk_rc_property_parse_color pspec' gstring' propertyValue'
    let result' = (/= 0) result
    touchManagedPtr gstring
    touchManagedPtr propertyValue
    return result'

-- method RcProperty::parse_enum
-- method type : MemberFunction
-- Args : [Arg {argCName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gstring", argType = TInterface "GLib" "String", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_rc_property_parse_enum" gtk_rc_property_parse_enum :: 
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr GLib.String ->                      -- gstring : TInterface "GLib" "String"
    Ptr GValue ->                           -- property_value : TInterface "GObject" "Value"
    IO CInt


rcPropertyParseEnum ::
    (MonadIO m) =>
    GParamSpec                              -- pspec
    -> GLib.String                          -- gstring
    -> GValue                               -- propertyValue
    -> m Bool                               -- result
rcPropertyParseEnum pspec gstring propertyValue = liftIO $ do
    let pspec' = unsafeManagedPtrGetPtr pspec
    let gstring' = unsafeManagedPtrGetPtr gstring
    let propertyValue' = unsafeManagedPtrGetPtr propertyValue
    result <- gtk_rc_property_parse_enum pspec' gstring' propertyValue'
    let result' = (/= 0) result
    touchManagedPtr gstring
    touchManagedPtr propertyValue
    return result'

-- method RcProperty::parse_flags
-- method type : MemberFunction
-- Args : [Arg {argCName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gstring", argType = TInterface "GLib" "String", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_rc_property_parse_flags" gtk_rc_property_parse_flags :: 
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr GLib.String ->                      -- gstring : TInterface "GLib" "String"
    Ptr GValue ->                           -- property_value : TInterface "GObject" "Value"
    IO CInt


rcPropertyParseFlags ::
    (MonadIO m) =>
    GParamSpec                              -- pspec
    -> GLib.String                          -- gstring
    -> GValue                               -- propertyValue
    -> m Bool                               -- result
rcPropertyParseFlags pspec gstring propertyValue = liftIO $ do
    let pspec' = unsafeManagedPtrGetPtr pspec
    let gstring' = unsafeManagedPtrGetPtr gstring
    let propertyValue' = unsafeManagedPtrGetPtr propertyValue
    result <- gtk_rc_property_parse_flags pspec' gstring' propertyValue'
    let result' = (/= 0) result
    touchManagedPtr gstring
    touchManagedPtr propertyValue
    return result'

-- method RcProperty::parse_requisition
-- method type : MemberFunction
-- Args : [Arg {argCName = "pspec", argType = TParamSpec, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "gstring", argType = TInterface "GLib" "String", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "property_value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_rc_property_parse_requisition" gtk_rc_property_parse_requisition :: 
    Ptr GParamSpec ->                       -- pspec : TParamSpec
    Ptr GLib.String ->                      -- gstring : TInterface "GLib" "String"
    Ptr GValue ->                           -- property_value : TInterface "GObject" "Value"
    IO CInt


rcPropertyParseRequisition ::
    (MonadIO m) =>
    GParamSpec                              -- pspec
    -> GLib.String                          -- gstring
    -> GValue                               -- propertyValue
    -> m Bool                               -- result
rcPropertyParseRequisition pspec gstring propertyValue = liftIO $ do
    let pspec' = unsafeManagedPtrGetPtr pspec
    let gstring' = unsafeManagedPtrGetPtr gstring
    let propertyValue' = unsafeManagedPtrGetPtr propertyValue
    result <- gtk_rc_property_parse_requisition pspec' gstring' propertyValue'
    let result' = (/= 0) result
    touchManagedPtr gstring
    touchManagedPtr propertyValue
    return result'

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

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

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