#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.Requisition
(
Requisition(..) ,
newZeroRequisition ,
noRequisition ,
#if ENABLE_OVERLOADING
RequisitionCopyMethodInfo ,
#endif
requisitionCopy ,
#if ENABLE_OVERLOADING
RequisitionFreeMethodInfo ,
#endif
requisitionFree ,
requisitionNew ,
getRequisitionHeight ,
#if ENABLE_OVERLOADING
requisition_height ,
#endif
setRequisitionHeight ,
getRequisitionWidth ,
#if ENABLE_OVERLOADING
requisition_width ,
#endif
setRequisitionWidth ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
newtype Requisition = Requisition (ManagedPtr Requisition)
foreign import ccall "gtk_requisition_get_type" c_gtk_requisition_get_type ::
IO GType
instance BoxedObject Requisition where
boxedType _ = c_gtk_requisition_get_type
newZeroRequisition :: MonadIO m => m Requisition
newZeroRequisition = liftIO $ callocBoxedBytes 8 >>= wrapBoxed Requisition
instance tag ~ 'AttrSet => Constructible Requisition tag where
new _ attrs = do
o <- newZeroRequisition
GI.Attributes.set o attrs
return o
noRequisition :: Maybe Requisition
noRequisition = Nothing
getRequisitionWidth :: MonadIO m => Requisition -> m Int32
getRequisitionWidth s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Int32
return val
setRequisitionWidth :: MonadIO m => Requisition -> Int32 -> m ()
setRequisitionWidth s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Int32)
#if ENABLE_OVERLOADING
data RequisitionWidthFieldInfo
instance AttrInfo RequisitionWidthFieldInfo where
type AttrAllowedOps RequisitionWidthFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequisitionWidthFieldInfo = (~) Int32
type AttrBaseTypeConstraint RequisitionWidthFieldInfo = (~) Requisition
type AttrGetType RequisitionWidthFieldInfo = Int32
type AttrLabel RequisitionWidthFieldInfo = "width"
type AttrOrigin RequisitionWidthFieldInfo = Requisition
attrGet _ = getRequisitionWidth
attrSet _ = setRequisitionWidth
attrConstruct = undefined
attrClear _ = undefined
requisition_width :: AttrLabelProxy "width"
requisition_width = AttrLabelProxy
#endif
getRequisitionHeight :: MonadIO m => Requisition -> m Int32
getRequisitionHeight s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 4) :: IO Int32
return val
setRequisitionHeight :: MonadIO m => Requisition -> Int32 -> m ()
setRequisitionHeight s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 4) (val :: Int32)
#if ENABLE_OVERLOADING
data RequisitionHeightFieldInfo
instance AttrInfo RequisitionHeightFieldInfo where
type AttrAllowedOps RequisitionHeightFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequisitionHeightFieldInfo = (~) Int32
type AttrBaseTypeConstraint RequisitionHeightFieldInfo = (~) Requisition
type AttrGetType RequisitionHeightFieldInfo = Int32
type AttrLabel RequisitionHeightFieldInfo = "height"
type AttrOrigin RequisitionHeightFieldInfo = Requisition
attrGet _ = getRequisitionHeight
attrSet _ = setRequisitionHeight
attrConstruct = undefined
attrClear _ = undefined
requisition_height :: AttrLabelProxy "height"
requisition_height = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList Requisition
type instance O.AttributeList Requisition = RequisitionAttributeList
type RequisitionAttributeList = ('[ '("width", RequisitionWidthFieldInfo), '("height", RequisitionHeightFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_requisition_new" gtk_requisition_new ::
IO (Ptr Requisition)
requisitionNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Requisition
requisitionNew = liftIO $ do
result <- gtk_requisition_new
checkUnexpectedReturnNULL "requisitionNew" result
result' <- (wrapBoxed Requisition) result
return result'
#if ENABLE_OVERLOADING
#endif
foreign import ccall "gtk_requisition_copy" gtk_requisition_copy ::
Ptr Requisition ->
IO (Ptr Requisition)
requisitionCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Requisition
-> m Requisition
requisitionCopy requisition = liftIO $ do
requisition' <- unsafeManagedPtrGetPtr requisition
result <- gtk_requisition_copy requisition'
checkUnexpectedReturnNULL "requisitionCopy" result
result' <- (wrapBoxed Requisition) result
touchManagedPtr requisition
return result'
#if ENABLE_OVERLOADING
data RequisitionCopyMethodInfo
instance (signature ~ (m Requisition), MonadIO m) => O.MethodInfo RequisitionCopyMethodInfo Requisition signature where
overloadedMethod _ = requisitionCopy
#endif
foreign import ccall "gtk_requisition_free" gtk_requisition_free ::
Ptr Requisition ->
IO ()
requisitionFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Requisition
-> m ()
requisitionFree requisition = liftIO $ do
requisition' <- unsafeManagedPtrGetPtr requisition
gtk_requisition_free requisition'
touchManagedPtr requisition
return ()
#if ENABLE_OVERLOADING
data RequisitionFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RequisitionFreeMethodInfo Requisition signature where
overloadedMethod _ = requisitionFree
#endif
#if ENABLE_OVERLOADING
type family ResolveRequisitionMethod (t :: Symbol) (o :: *) :: * where
ResolveRequisitionMethod "copy" o = RequisitionCopyMethodInfo
ResolveRequisitionMethod "free" o = RequisitionFreeMethodInfo
ResolveRequisitionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRequisitionMethod t Requisition, O.MethodInfo info Requisition p) => O.IsLabelProxy t (Requisition -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveRequisitionMethod t Requisition, O.MethodInfo info Requisition p) => O.IsLabel t (Requisition -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif