{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

The 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' object is created by a given 'GI.Gtk.Objects.CellArea.CellArea'
implementation via its 'GI.Gtk.Structs.CellAreaClass.CellAreaClass'.@/create_context/@() virtual
method and is used to store cell sizes and alignments for a series of
'GI.Gtk.Interfaces.TreeModel.TreeModel' rows that are requested and rendered in the same context.

'GI.Gtk.Interfaces.CellLayout.CellLayout' widgets can create any number of contexts in which to
request and render groups of data rows. However, it’s important that the
same context which was used to request sizes for a given 'GI.Gtk.Interfaces.TreeModel.TreeModel'
row also be used for the same row when calling other 'GI.Gtk.Objects.CellArea.CellArea' APIs
such as 'GI.Gtk.Objects.CellArea.cellAreaRender' and 'GI.Gtk.Objects.CellArea.cellAreaEvent'.
-}

module GI.Gtk.Objects.CellAreaContext
    ( 

-- * Exported types
    CellAreaContext(..)                     ,
    IsCellAreaContext                       ,
    toCellAreaContext                       ,
    noCellAreaContext                       ,


 -- * Methods
-- ** allocate #method:allocate#
    CellAreaContextAllocateMethodInfo       ,
    cellAreaContextAllocate                 ,


-- ** getAllocation #method:getAllocation#
    CellAreaContextGetAllocationMethodInfo  ,
    cellAreaContextGetAllocation            ,


-- ** getArea #method:getArea#
    CellAreaContextGetAreaMethodInfo        ,
    cellAreaContextGetArea                  ,


-- ** getPreferredHeight #method:getPreferredHeight#
    CellAreaContextGetPreferredHeightMethodInfo,
    cellAreaContextGetPreferredHeight       ,


-- ** getPreferredHeightForWidth #method:getPreferredHeightForWidth#
    CellAreaContextGetPreferredHeightForWidthMethodInfo,
    cellAreaContextGetPreferredHeightForWidth,


-- ** getPreferredWidth #method:getPreferredWidth#
    CellAreaContextGetPreferredWidthMethodInfo,
    cellAreaContextGetPreferredWidth        ,


-- ** getPreferredWidthForHeight #method:getPreferredWidthForHeight#
    CellAreaContextGetPreferredWidthForHeightMethodInfo,
    cellAreaContextGetPreferredWidthForHeight,


-- ** pushPreferredHeight #method:pushPreferredHeight#
    CellAreaContextPushPreferredHeightMethodInfo,
    cellAreaContextPushPreferredHeight      ,


-- ** pushPreferredWidth #method:pushPreferredWidth#
    CellAreaContextPushPreferredWidthMethodInfo,
    cellAreaContextPushPreferredWidth       ,


-- ** reset #method:reset#
    CellAreaContextResetMethodInfo          ,
    cellAreaContextReset                    ,




 -- * Properties
-- ** area #attr:area#
    CellAreaContextAreaPropertyInfo         ,
    cellAreaContextArea                     ,
    constructCellAreaContextArea            ,
    getCellAreaContextArea                  ,


-- ** minimumHeight #attr:minimumHeight#
    CellAreaContextMinimumHeightPropertyInfo,
    cellAreaContextMinimumHeight            ,
    getCellAreaContextMinimumHeight         ,


-- ** minimumWidth #attr:minimumWidth#
    CellAreaContextMinimumWidthPropertyInfo ,
    cellAreaContextMinimumWidth             ,
    getCellAreaContextMinimumWidth          ,


-- ** naturalHeight #attr:naturalHeight#
    CellAreaContextNaturalHeightPropertyInfo,
    cellAreaContextNaturalHeight            ,
    getCellAreaContextNaturalHeight         ,


-- ** naturalWidth #attr:naturalWidth#
    CellAreaContextNaturalWidthPropertyInfo ,
    cellAreaContextNaturalWidth             ,
    getCellAreaContextNaturalWidth          ,




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

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Objects.CellArea as Gtk.CellArea

newtype CellAreaContext = CellAreaContext (ManagedPtr CellAreaContext)
foreign import ccall "gtk_cell_area_context_get_type"
    c_gtk_cell_area_context_get_type :: IO GType

instance GObject CellAreaContext where
    gobjectType _ = c_gtk_cell_area_context_get_type
    

class GObject o => IsCellAreaContext o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError CellAreaContext a) =>
    IsCellAreaContext a
#endif
instance IsCellAreaContext CellAreaContext
instance GObject.Object.IsObject CellAreaContext

toCellAreaContext :: IsCellAreaContext o => o -> IO CellAreaContext
toCellAreaContext = unsafeCastTo CellAreaContext

noCellAreaContext :: Maybe CellAreaContext
noCellAreaContext = Nothing

type family ResolveCellAreaContextMethod (t :: Symbol) (o :: *) :: * where
    ResolveCellAreaContextMethod "allocate" o = CellAreaContextAllocateMethodInfo
    ResolveCellAreaContextMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveCellAreaContextMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveCellAreaContextMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveCellAreaContextMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveCellAreaContextMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveCellAreaContextMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveCellAreaContextMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveCellAreaContextMethod "pushPreferredHeight" o = CellAreaContextPushPreferredHeightMethodInfo
    ResolveCellAreaContextMethod "pushPreferredWidth" o = CellAreaContextPushPreferredWidthMethodInfo
    ResolveCellAreaContextMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveCellAreaContextMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveCellAreaContextMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveCellAreaContextMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveCellAreaContextMethod "reset" o = CellAreaContextResetMethodInfo
    ResolveCellAreaContextMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveCellAreaContextMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveCellAreaContextMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveCellAreaContextMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveCellAreaContextMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveCellAreaContextMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveCellAreaContextMethod "getAllocation" o = CellAreaContextGetAllocationMethodInfo
    ResolveCellAreaContextMethod "getArea" o = CellAreaContextGetAreaMethodInfo
    ResolveCellAreaContextMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveCellAreaContextMethod "getPreferredHeight" o = CellAreaContextGetPreferredHeightMethodInfo
    ResolveCellAreaContextMethod "getPreferredHeightForWidth" o = CellAreaContextGetPreferredHeightForWidthMethodInfo
    ResolveCellAreaContextMethod "getPreferredWidth" o = CellAreaContextGetPreferredWidthMethodInfo
    ResolveCellAreaContextMethod "getPreferredWidthForHeight" o = CellAreaContextGetPreferredWidthForHeightMethodInfo
    ResolveCellAreaContextMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveCellAreaContextMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveCellAreaContextMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveCellAreaContextMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveCellAreaContextMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCellAreaContextMethod t CellAreaContext, O.MethodInfo info CellAreaContext p) => O.IsLabelProxy t (CellAreaContext -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

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

-- VVV Prop "area"
   -- Type: TInterface (Name {namespace = "Gtk", name = "CellArea"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

getCellAreaContextArea :: (MonadIO m, IsCellAreaContext o) => o -> m Gtk.CellArea.CellArea
getCellAreaContextArea obj = liftIO $ checkUnexpectedNothing "getCellAreaContextArea" $ getObjectPropertyObject obj "area" Gtk.CellArea.CellArea

constructCellAreaContextArea :: (IsCellAreaContext o, Gtk.CellArea.IsCellArea a) => a -> IO (GValueConstruct o)
constructCellAreaContextArea val = constructObjectPropertyObject "area" (Just val)

data CellAreaContextAreaPropertyInfo
instance AttrInfo CellAreaContextAreaPropertyInfo where
    type AttrAllowedOps CellAreaContextAreaPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint CellAreaContextAreaPropertyInfo = Gtk.CellArea.IsCellArea
    type AttrBaseTypeConstraint CellAreaContextAreaPropertyInfo = IsCellAreaContext
    type AttrGetType CellAreaContextAreaPropertyInfo = Gtk.CellArea.CellArea
    type AttrLabel CellAreaContextAreaPropertyInfo = "area"
    type AttrOrigin CellAreaContextAreaPropertyInfo = CellAreaContext
    attrGet _ = getCellAreaContextArea
    attrSet _ = undefined
    attrConstruct _ = constructCellAreaContextArea
    attrClear _ = undefined

-- VVV Prop "minimum-height"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getCellAreaContextMinimumHeight :: (MonadIO m, IsCellAreaContext o) => o -> m Int32
getCellAreaContextMinimumHeight obj = liftIO $ getObjectPropertyInt32 obj "minimum-height"

data CellAreaContextMinimumHeightPropertyInfo
instance AttrInfo CellAreaContextMinimumHeightPropertyInfo where
    type AttrAllowedOps CellAreaContextMinimumHeightPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint CellAreaContextMinimumHeightPropertyInfo = (~) ()
    type AttrBaseTypeConstraint CellAreaContextMinimumHeightPropertyInfo = IsCellAreaContext
    type AttrGetType CellAreaContextMinimumHeightPropertyInfo = Int32
    type AttrLabel CellAreaContextMinimumHeightPropertyInfo = "minimum-height"
    type AttrOrigin CellAreaContextMinimumHeightPropertyInfo = CellAreaContext
    attrGet _ = getCellAreaContextMinimumHeight
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "minimum-width"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getCellAreaContextMinimumWidth :: (MonadIO m, IsCellAreaContext o) => o -> m Int32
getCellAreaContextMinimumWidth obj = liftIO $ getObjectPropertyInt32 obj "minimum-width"

data CellAreaContextMinimumWidthPropertyInfo
instance AttrInfo CellAreaContextMinimumWidthPropertyInfo where
    type AttrAllowedOps CellAreaContextMinimumWidthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint CellAreaContextMinimumWidthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint CellAreaContextMinimumWidthPropertyInfo = IsCellAreaContext
    type AttrGetType CellAreaContextMinimumWidthPropertyInfo = Int32
    type AttrLabel CellAreaContextMinimumWidthPropertyInfo = "minimum-width"
    type AttrOrigin CellAreaContextMinimumWidthPropertyInfo = CellAreaContext
    attrGet _ = getCellAreaContextMinimumWidth
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "natural-height"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getCellAreaContextNaturalHeight :: (MonadIO m, IsCellAreaContext o) => o -> m Int32
getCellAreaContextNaturalHeight obj = liftIO $ getObjectPropertyInt32 obj "natural-height"

data CellAreaContextNaturalHeightPropertyInfo
instance AttrInfo CellAreaContextNaturalHeightPropertyInfo where
    type AttrAllowedOps CellAreaContextNaturalHeightPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint CellAreaContextNaturalHeightPropertyInfo = (~) ()
    type AttrBaseTypeConstraint CellAreaContextNaturalHeightPropertyInfo = IsCellAreaContext
    type AttrGetType CellAreaContextNaturalHeightPropertyInfo = Int32
    type AttrLabel CellAreaContextNaturalHeightPropertyInfo = "natural-height"
    type AttrOrigin CellAreaContextNaturalHeightPropertyInfo = CellAreaContext
    attrGet _ = getCellAreaContextNaturalHeight
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "natural-width"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getCellAreaContextNaturalWidth :: (MonadIO m, IsCellAreaContext o) => o -> m Int32
getCellAreaContextNaturalWidth obj = liftIO $ getObjectPropertyInt32 obj "natural-width"

data CellAreaContextNaturalWidthPropertyInfo
instance AttrInfo CellAreaContextNaturalWidthPropertyInfo where
    type AttrAllowedOps CellAreaContextNaturalWidthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint CellAreaContextNaturalWidthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint CellAreaContextNaturalWidthPropertyInfo = IsCellAreaContext
    type AttrGetType CellAreaContextNaturalWidthPropertyInfo = Int32
    type AttrLabel CellAreaContextNaturalWidthPropertyInfo = "natural-width"
    type AttrOrigin CellAreaContextNaturalWidthPropertyInfo = CellAreaContext
    attrGet _ = getCellAreaContextNaturalWidth
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList CellAreaContext
type instance O.AttributeList CellAreaContext = CellAreaContextAttributeList
type CellAreaContextAttributeList = ('[ '("area", CellAreaContextAreaPropertyInfo), '("minimumHeight", CellAreaContextMinimumHeightPropertyInfo), '("minimumWidth", CellAreaContextMinimumWidthPropertyInfo), '("naturalHeight", CellAreaContextNaturalHeightPropertyInfo), '("naturalWidth", CellAreaContextNaturalWidthPropertyInfo)] :: [(Symbol, *)])

cellAreaContextArea :: AttrLabelProxy "area"
cellAreaContextArea = AttrLabelProxy

cellAreaContextMinimumHeight :: AttrLabelProxy "minimumHeight"
cellAreaContextMinimumHeight = AttrLabelProxy

cellAreaContextMinimumWidth :: AttrLabelProxy "minimumWidth"
cellAreaContextMinimumWidth = AttrLabelProxy

cellAreaContextNaturalHeight :: AttrLabelProxy "naturalHeight"
cellAreaContextNaturalHeight = AttrLabelProxy

cellAreaContextNaturalWidth :: AttrLabelProxy "naturalWidth"
cellAreaContextNaturalWidth = AttrLabelProxy

type instance O.SignalList CellAreaContext = CellAreaContextSignalList
type CellAreaContextSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method CellAreaContext::allocate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the allocated width for all #GtkTreeModel rows rendered\n    with @context, or -1.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the allocated height for all #GtkTreeModel rows rendered\n    with @context, or -1.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_allocate" gtk_cell_area_context_allocate :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Int32 ->                                -- width : TBasicType TInt
    Int32 ->                                -- height : TBasicType TInt
    IO ()

{- |
Allocates a width and\/or a height for all rows which are to be
rendered with /@context@/.

Usually allocation is performed only horizontally or sometimes
vertically since a group of rows are usually rendered side by
side vertically or horizontally and share either the same width
or the same height. Sometimes they are allocated in both horizontal
and vertical orientations producing a homogeneous effect of the
rows. This is generally the case for 'GI.Gtk.Objects.TreeView.TreeView' when
'GI.Gtk.Objects.TreeView.TreeView':@/fixed-height-mode/@ is enabled.

Since 3.0
-}
cellAreaContextAllocate ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> Int32
    {- ^ /@width@/: the allocated width for all 'GI.Gtk.Interfaces.TreeModel.TreeModel' rows rendered
    with /@context@/, or -1. -}
    -> Int32
    {- ^ /@height@/: the allocated height for all 'GI.Gtk.Interfaces.TreeModel.TreeModel' rows rendered
    with /@context@/, or -1. -}
    -> m ()
cellAreaContextAllocate context width height = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    gtk_cell_area_context_allocate context' width height
    touchManagedPtr context
    return ()

data CellAreaContextAllocateMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextAllocateMethodInfo a signature where
    overloadedMethod _ = cellAreaContextAllocate

-- method CellAreaContext::get_allocation
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the allocated width, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the allocated height, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_get_allocation" gtk_cell_area_context_get_allocation :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Ptr Int32 ->                            -- width : TBasicType TInt
    Ptr Int32 ->                            -- height : TBasicType TInt
    IO ()

{- |
Fetches the current allocation size for /@context@/.

If the context was not allocated in width or height, or if the
context was recently reset with 'GI.Gtk.Objects.CellAreaContext.cellAreaContextReset',
the returned value will be -1.

@since 3.0
-}
cellAreaContextGetAllocation ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> m (Int32,Int32)
cellAreaContextGetAllocation context = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    width <- allocMem :: IO (Ptr Int32)
    height <- allocMem :: IO (Ptr Int32)
    gtk_cell_area_context_get_allocation context' width height
    width' <- peek width
    height' <- peek height
    touchManagedPtr context
    freeMem width
    freeMem height
    return (width', height')

data CellAreaContextGetAllocationMethodInfo
instance (signature ~ (m (Int32,Int32)), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextGetAllocationMethodInfo a signature where
    overloadedMethod _ = cellAreaContextGetAllocation

-- method CellAreaContext::get_area
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "CellArea"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_get_area" gtk_cell_area_context_get_area :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    IO (Ptr Gtk.CellArea.CellArea)

{- |
Fetches the 'GI.Gtk.Objects.CellArea.CellArea' this /@context@/ was created by.

This is generally unneeded by layouting widgets; however,
it is important for the context implementation itself to
fetch information about the area it is being used for.

For instance at 'GI.Gtk.Structs.CellAreaContextClass.CellAreaContextClass'.@/allocate/@() time
it’s important to know details about any cell spacing
that the 'GI.Gtk.Objects.CellArea.CellArea' is configured with in order to
compute a proper allocation.

@since 3.0
-}
cellAreaContextGetArea ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> m Gtk.CellArea.CellArea
    {- ^ __Returns:__ the 'GI.Gtk.Objects.CellArea.CellArea' this context was created by. -}
cellAreaContextGetArea context = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    result <- gtk_cell_area_context_get_area context'
    checkUnexpectedReturnNULL "cellAreaContextGetArea" result
    result' <- (newObject Gtk.CellArea.CellArea) result
    touchManagedPtr context
    return result'

data CellAreaContextGetAreaMethodInfo
instance (signature ~ (m Gtk.CellArea.CellArea), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextGetAreaMethodInfo a signature where
    overloadedMethod _ = cellAreaContextGetArea

-- method CellAreaContext::get_preferred_height
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minimum_height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the minimum height,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "natural_height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the natural height,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_get_preferred_height" gtk_cell_area_context_get_preferred_height :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Ptr Int32 ->                            -- minimum_height : TBasicType TInt
    Ptr Int32 ->                            -- natural_height : TBasicType TInt
    IO ()

{- |
Gets the accumulative preferred height for all rows which have been
requested with this context.

After 'GI.Gtk.Objects.CellAreaContext.cellAreaContextReset' is called and\/or before ever
requesting the size of a 'GI.Gtk.Objects.CellArea.CellArea', the returned values are 0.

@since 3.0
-}
cellAreaContextGetPreferredHeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> m (Int32,Int32)
cellAreaContextGetPreferredHeight context = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    minimumHeight <- allocMem :: IO (Ptr Int32)
    naturalHeight <- allocMem :: IO (Ptr Int32)
    gtk_cell_area_context_get_preferred_height context' minimumHeight naturalHeight
    minimumHeight' <- peek minimumHeight
    naturalHeight' <- peek naturalHeight
    touchManagedPtr context
    freeMem minimumHeight
    freeMem naturalHeight
    return (minimumHeight', naturalHeight')

data CellAreaContextGetPreferredHeightMethodInfo
instance (signature ~ (m (Int32,Int32)), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextGetPreferredHeightMethodInfo a signature where
    overloadedMethod _ = cellAreaContextGetPreferredHeight

-- method CellAreaContext::get_preferred_height_for_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "width", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a proposed width for allocation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minimum_height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the minimum height,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "natural_height", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the natural height,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_get_preferred_height_for_width" gtk_cell_area_context_get_preferred_height_for_width :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Int32 ->                                -- width : TBasicType TInt
    Ptr Int32 ->                            -- minimum_height : TBasicType TInt
    Ptr Int32 ->                            -- natural_height : TBasicType TInt
    IO ()

{- |
Gets the accumulative preferred height for /@width@/ for all rows
which have been requested for the same said /@width@/ with this context.

After 'GI.Gtk.Objects.CellAreaContext.cellAreaContextReset' is called and\/or before ever
requesting the size of a 'GI.Gtk.Objects.CellArea.CellArea', the returned values are -1.

@since 3.0
-}
cellAreaContextGetPreferredHeightForWidth ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> Int32
    {- ^ /@width@/: a proposed width for allocation -}
    -> m (Int32,Int32)
cellAreaContextGetPreferredHeightForWidth context width = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    minimumHeight <- allocMem :: IO (Ptr Int32)
    naturalHeight <- allocMem :: IO (Ptr Int32)
    gtk_cell_area_context_get_preferred_height_for_width context' width minimumHeight naturalHeight
    minimumHeight' <- peek minimumHeight
    naturalHeight' <- peek naturalHeight
    touchManagedPtr context
    freeMem minimumHeight
    freeMem naturalHeight
    return (minimumHeight', naturalHeight')

data CellAreaContextGetPreferredHeightForWidthMethodInfo
instance (signature ~ (Int32 -> m (Int32,Int32)), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextGetPreferredHeightForWidthMethodInfo a signature where
    overloadedMethod _ = cellAreaContextGetPreferredHeightForWidth

-- method CellAreaContext::get_preferred_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minimum_width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the minimum width,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "natural_width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the natural width,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_get_preferred_width" gtk_cell_area_context_get_preferred_width :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Ptr Int32 ->                            -- minimum_width : TBasicType TInt
    Ptr Int32 ->                            -- natural_width : TBasicType TInt
    IO ()

{- |
Gets the accumulative preferred width for all rows which have been
requested with this context.

After 'GI.Gtk.Objects.CellAreaContext.cellAreaContextReset' is called and\/or before ever
requesting the size of a 'GI.Gtk.Objects.CellArea.CellArea', the returned values are 0.

@since 3.0
-}
cellAreaContextGetPreferredWidth ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> m (Int32,Int32)
cellAreaContextGetPreferredWidth context = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    minimumWidth <- allocMem :: IO (Ptr Int32)
    naturalWidth <- allocMem :: IO (Ptr Int32)
    gtk_cell_area_context_get_preferred_width context' minimumWidth naturalWidth
    minimumWidth' <- peek minimumWidth
    naturalWidth' <- peek naturalWidth
    touchManagedPtr context
    freeMem minimumWidth
    freeMem naturalWidth
    return (minimumWidth', naturalWidth')

data CellAreaContextGetPreferredWidthMethodInfo
instance (signature ~ (m (Int32,Int32)), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextGetPreferredWidthMethodInfo a signature where
    overloadedMethod _ = cellAreaContextGetPreferredWidth

-- method CellAreaContext::get_preferred_width_for_height
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "height", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a proposed height for allocation", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minimum_width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the minimum width,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything},Arg {argCName = "natural_width", argType = TBasicType TInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "location to store the natural width,\n    or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_get_preferred_width_for_height" gtk_cell_area_context_get_preferred_width_for_height :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Int32 ->                                -- height : TBasicType TInt
    Ptr Int32 ->                            -- minimum_width : TBasicType TInt
    Ptr Int32 ->                            -- natural_width : TBasicType TInt
    IO ()

{- |
Gets the accumulative preferred width for /@height@/ for all rows which
have been requested for the same said /@height@/ with this context.

After 'GI.Gtk.Objects.CellAreaContext.cellAreaContextReset' is called and\/or before ever
requesting the size of a 'GI.Gtk.Objects.CellArea.CellArea', the returned values are -1.

@since 3.0
-}
cellAreaContextGetPreferredWidthForHeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> Int32
    {- ^ /@height@/: a proposed height for allocation -}
    -> m (Int32,Int32)
cellAreaContextGetPreferredWidthForHeight context height = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    minimumWidth <- allocMem :: IO (Ptr Int32)
    naturalWidth <- allocMem :: IO (Ptr Int32)
    gtk_cell_area_context_get_preferred_width_for_height context' height minimumWidth naturalWidth
    minimumWidth' <- peek minimumWidth
    naturalWidth' <- peek naturalWidth
    touchManagedPtr context
    freeMem minimumWidth
    freeMem naturalWidth
    return (minimumWidth', naturalWidth')

data CellAreaContextGetPreferredWidthForHeightMethodInfo
instance (signature ~ (Int32 -> m (Int32,Int32)), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextGetPreferredWidthForHeightMethodInfo a signature where
    overloadedMethod _ = cellAreaContextGetPreferredWidthForHeight

-- method CellAreaContext::push_preferred_height
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minimum_height", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the proposed new minimum height for @context", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "natural_height", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the proposed new natural height for @context", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_push_preferred_height" gtk_cell_area_context_push_preferred_height :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Int32 ->                                -- minimum_height : TBasicType TInt
    Int32 ->                                -- natural_height : TBasicType TInt
    IO ()

{- |
Causes the minimum and\/or natural height to grow if the new
proposed sizes exceed the current minimum and natural height.

This is used by 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' implementations during
the request process over a series of 'GI.Gtk.Interfaces.TreeModel.TreeModel' rows to
progressively push the requested height over a series of
'GI.Gtk.Objects.CellArea.cellAreaGetPreferredHeight' requests.

@since 3.0
-}
cellAreaContextPushPreferredHeight ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> Int32
    {- ^ /@minimumHeight@/: the proposed new minimum height for /@context@/ -}
    -> Int32
    {- ^ /@naturalHeight@/: the proposed new natural height for /@context@/ -}
    -> m ()
cellAreaContextPushPreferredHeight context minimumHeight naturalHeight = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    gtk_cell_area_context_push_preferred_height context' minimumHeight naturalHeight
    touchManagedPtr context
    return ()

data CellAreaContextPushPreferredHeightMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextPushPreferredHeightMethodInfo a signature where
    overloadedMethod _ = cellAreaContextPushPreferredHeight

-- method CellAreaContext::push_preferred_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "minimum_width", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the proposed new minimum width for @context", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "natural_width", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the proposed new natural width for @context", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_push_preferred_width" gtk_cell_area_context_push_preferred_width :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    Int32 ->                                -- minimum_width : TBasicType TInt
    Int32 ->                                -- natural_width : TBasicType TInt
    IO ()

{- |
Causes the minimum and\/or natural width to grow if the new
proposed sizes exceed the current minimum and natural width.

This is used by 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' implementations during
the request process over a series of 'GI.Gtk.Interfaces.TreeModel.TreeModel' rows to
progressively push the requested width over a series of
'GI.Gtk.Objects.CellArea.cellAreaGetPreferredWidth' requests.

@since 3.0
-}
cellAreaContextPushPreferredWidth ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> Int32
    {- ^ /@minimumWidth@/: the proposed new minimum width for /@context@/ -}
    -> Int32
    {- ^ /@naturalWidth@/: the proposed new natural width for /@context@/ -}
    -> m ()
cellAreaContextPushPreferredWidth context minimumWidth naturalWidth = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    gtk_cell_area_context_push_preferred_width context' minimumWidth naturalWidth
    touchManagedPtr context
    return ()

data CellAreaContextPushPreferredWidthMethodInfo
instance (signature ~ (Int32 -> Int32 -> m ()), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextPushPreferredWidthMethodInfo a signature where
    overloadedMethod _ = cellAreaContextPushPreferredWidth

-- method CellAreaContext::reset
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "context", argType = TInterface (Name {namespace = "Gtk", name = "CellAreaContext"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkCellAreaContext", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_area_context_reset" gtk_cell_area_context_reset :: 
    Ptr CellAreaContext ->                  -- context : TInterface (Name {namespace = "Gtk", name = "CellAreaContext"})
    IO ()

{- |
Resets any previously cached request and allocation
data.

When underlying 'GI.Gtk.Interfaces.TreeModel.TreeModel' data changes its
important to reset the context if the content
size is allowed to shrink. If the content size
is only allowed to grow (this is usually an option
for views rendering large data stores as a measure
of optimization), then only the row that changed
or was inserted needs to be (re)requested with
'GI.Gtk.Objects.CellArea.cellAreaGetPreferredWidth'.

When the new overall size of the context requires
that the allocated size changes (or whenever this
allocation changes at all), the variable row
sizes need to be re-requested for every row.

For instance, if the rows are displayed all with
the same width from top to bottom then a change
in the allocated width necessitates a recalculation
of all the displayed row heights using
'GI.Gtk.Objects.CellArea.cellAreaGetPreferredHeightForWidth'.

Since 3.0
-}
cellAreaContextReset ::
    (B.CallStack.HasCallStack, MonadIO m, IsCellAreaContext a) =>
    a
    {- ^ /@context@/: a 'GI.Gtk.Objects.CellAreaContext.CellAreaContext' -}
    -> m ()
cellAreaContextReset context = liftIO $ do
    context' <- unsafeManagedPtrCastPtr context
    gtk_cell_area_context_reset context'
    touchManagedPtr context
    return ()

data CellAreaContextResetMethodInfo
instance (signature ~ (m ()), MonadIO m, IsCellAreaContext a) => O.MethodInfo CellAreaContextResetMethodInfo a signature where
    overloadedMethod _ = cellAreaContextReset