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

module GI.Gtk.Interfaces.CellLayout
    ( 

-- * Exported types
    CellLayout(..)                          ,
    noCellLayout                            ,
    CellLayoutK                             ,
    toCellLayout                            ,


 -- * Methods
-- ** cellLayoutAddAttribute
    cellLayoutAddAttribute                  ,


-- ** cellLayoutClear
    cellLayoutClear                         ,


-- ** cellLayoutClearAttributes
    cellLayoutClearAttributes               ,


-- ** cellLayoutGetArea
    cellLayoutGetArea                       ,


-- ** cellLayoutGetCells
    cellLayoutGetCells                      ,


-- ** cellLayoutPackEnd
    cellLayoutPackEnd                       ,


-- ** cellLayoutPackStart
    cellLayoutPackStart                     ,


-- ** cellLayoutReorder
    cellLayoutReorder                       ,


-- ** cellLayoutSetCellDataFunc
    cellLayoutSetCellDataFunc               ,




    ) 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
import qualified GI.GObject as GObject

-- interface CellLayout 

newtype CellLayout = CellLayout (ForeignPtr CellLayout)
noCellLayout :: Maybe CellLayout
noCellLayout = Nothing

type instance AttributeList CellLayout = CellLayoutAttributeList
type CellLayoutAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList CellLayout = CellLayoutSignalList
type CellLayoutSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

foreign import ccall "gtk_cell_layout_get_type"
    c_gtk_cell_layout_get_type :: IO GType

type instance ParentTypes CellLayout = CellLayoutParentTypes
type CellLayoutParentTypes = '[GObject.Object]

instance GObject CellLayout where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_cell_layout_get_type
    

class GObject o => CellLayoutK o
instance (GObject o, IsDescendantOf CellLayout o) => CellLayoutK o

toCellLayout :: CellLayoutK o => o -> IO CellLayout
toCellLayout = unsafeCastTo CellLayout

-- method CellLayout::add_attribute
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "column", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "attribute", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "column", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_add_attribute" gtk_cell_layout_add_attribute :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    Ptr CellRenderer ->                     -- cell : TInterface "Gtk" "CellRenderer"
    CString ->                              -- attribute : TBasicType TUTF8
    Int32 ->                                -- column : TBasicType TInt32
    IO ()


cellLayoutAddAttribute ::
    (MonadIO m, CellLayoutK a, CellRendererK b) =>
    a ->                                    -- _obj
    b ->                                    -- cell
    T.Text ->                               -- attribute
    Int32 ->                                -- column
    m ()
cellLayoutAddAttribute _obj cell attribute column = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cell' = unsafeManagedPtrCastPtr cell
    attribute' <- textToCString attribute
    gtk_cell_layout_add_attribute _obj' cell' attribute' column
    touchManagedPtr _obj
    touchManagedPtr cell
    freeMem attribute'
    return ()

-- method CellLayout::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_clear" gtk_cell_layout_clear :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    IO ()


cellLayoutClear ::
    (MonadIO m, CellLayoutK a) =>
    a ->                                    -- _obj
    m ()
cellLayoutClear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_cell_layout_clear _obj'
    touchManagedPtr _obj
    return ()

-- method CellLayout::clear_attributes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_clear_attributes" gtk_cell_layout_clear_attributes :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    Ptr CellRenderer ->                     -- cell : TInterface "Gtk" "CellRenderer"
    IO ()


cellLayoutClearAttributes ::
    (MonadIO m, CellLayoutK a, CellRendererK b) =>
    a ->                                    -- _obj
    b ->                                    -- cell
    m ()
cellLayoutClearAttributes _obj cell = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cell' = unsafeManagedPtrCastPtr cell
    gtk_cell_layout_clear_attributes _obj' cell'
    touchManagedPtr _obj
    touchManagedPtr cell
    return ()

-- method CellLayout::get_area
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "CellArea"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_get_area" gtk_cell_layout_get_area :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    IO (Ptr CellArea)


cellLayoutGetArea ::
    (MonadIO m, CellLayoutK a) =>
    a ->                                    -- _obj
    m CellArea
cellLayoutGetArea _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_cell_layout_get_area _obj'
    checkUnexpectedReturnNULL "gtk_cell_layout_get_area" result
    result' <- (newObject CellArea) result
    touchManagedPtr _obj
    return result'

-- method CellLayout::get_cells
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Gtk" "CellRenderer")
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_get_cells" gtk_cell_layout_get_cells :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    IO (Ptr (GList (Ptr CellRenderer)))


cellLayoutGetCells ::
    (MonadIO m, CellLayoutK a) =>
    a ->                                    -- _obj
    m [CellRenderer]
cellLayoutGetCells _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_cell_layout_get_cells _obj'
    checkUnexpectedReturnNULL "gtk_cell_layout_get_cells" result
    result' <- unpackGList result
    result'' <- mapM (newObject CellRenderer) result'
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method CellLayout::pack_end
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "expand", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "expand", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_pack_end" gtk_cell_layout_pack_end :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    Ptr CellRenderer ->                     -- cell : TInterface "Gtk" "CellRenderer"
    CInt ->                                 -- expand : TBasicType TBoolean
    IO ()


cellLayoutPackEnd ::
    (MonadIO m, CellLayoutK a, CellRendererK b) =>
    a ->                                    -- _obj
    b ->                                    -- cell
    Bool ->                                 -- expand
    m ()
cellLayoutPackEnd _obj cell expand = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cell' = unsafeManagedPtrCastPtr cell
    let expand' = (fromIntegral . fromEnum) expand
    gtk_cell_layout_pack_end _obj' cell' expand'
    touchManagedPtr _obj
    touchManagedPtr cell
    return ()

-- method CellLayout::pack_start
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "expand", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "expand", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_pack_start" gtk_cell_layout_pack_start :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    Ptr CellRenderer ->                     -- cell : TInterface "Gtk" "CellRenderer"
    CInt ->                                 -- expand : TBasicType TBoolean
    IO ()


cellLayoutPackStart ::
    (MonadIO m, CellLayoutK a, CellRendererK b) =>
    a ->                                    -- _obj
    b ->                                    -- cell
    Bool ->                                 -- expand
    m ()
cellLayoutPackStart _obj cell expand = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cell' = unsafeManagedPtrCastPtr cell
    let expand' = (fromIntegral . fromEnum) expand
    gtk_cell_layout_pack_start _obj' cell' expand'
    touchManagedPtr _obj
    touchManagedPtr cell
    return ()

-- method CellLayout::reorder
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "position", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_reorder" gtk_cell_layout_reorder :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    Ptr CellRenderer ->                     -- cell : TInterface "Gtk" "CellRenderer"
    Int32 ->                                -- position : TBasicType TInt32
    IO ()


cellLayoutReorder ::
    (MonadIO m, CellLayoutK a, CellRendererK b) =>
    a ->                                    -- _obj
    b ->                                    -- cell
    Int32 ->                                -- position
    m ()
cellLayoutReorder _obj cell position = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cell' = unsafeManagedPtrCastPtr cell
    gtk_cell_layout_reorder _obj' cell' position
    touchManagedPtr _obj
    touchManagedPtr cell
    return ()

-- method CellLayout::set_cell_data_func
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "Gtk" "CellLayoutDataFunc", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing},Arg {argName = "func_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "destroy", argType = TInterface "GLib" "DestroyNotify", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "CellLayout", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cell", argType = TInterface "Gtk" "CellRenderer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "func", argType = TInterface "Gtk" "CellLayoutDataFunc", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeNotified, argClosure = 3, argDestroy = 4, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_cell_layout_set_cell_data_func" gtk_cell_layout_set_cell_data_func :: 
    Ptr CellLayout ->                       -- _obj : TInterface "Gtk" "CellLayout"
    Ptr CellRenderer ->                     -- cell : TInterface "Gtk" "CellRenderer"
    FunPtr CellLayoutDataFuncC ->           -- func : TInterface "Gtk" "CellLayoutDataFunc"
    Ptr () ->                               -- func_data : TBasicType TVoid
    FunPtr GLib.DestroyNotifyC ->           -- destroy : TInterface "GLib" "DestroyNotify"
    IO ()


cellLayoutSetCellDataFunc ::
    (MonadIO m, CellLayoutK a, CellRendererK b) =>
    a ->                                    -- _obj
    b ->                                    -- cell
    Maybe (CellLayoutDataFunc) ->           -- func
    m ()
cellLayoutSetCellDataFunc _obj cell func = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cell' = unsafeManagedPtrCastPtr cell
    maybeFunc <- case func of
        Nothing -> return (castPtrToFunPtr nullPtr)
        Just jFunc -> do
            jFunc' <- mkCellLayoutDataFunc (cellLayoutDataFuncWrapper Nothing jFunc)
            return jFunc'
    let func_data = castFunPtrToPtr maybeFunc
    let destroy = safeFreeFunPtrPtr
    gtk_cell_layout_set_cell_data_func _obj' cell' maybeFunc func_data destroy
    touchManagedPtr _obj
    touchManagedPtr cell
    return ()