{- |
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.Objects.SizeGroup
    ( 

-- * Exported types
    SizeGroup(..)                           ,
    SizeGroupK                              ,
    toSizeGroup                             ,
    noSizeGroup                             ,


 -- * Methods
-- ** sizeGroupAddWidget
    sizeGroupAddWidget                      ,


-- ** sizeGroupGetIgnoreHidden
    sizeGroupGetIgnoreHidden                ,


-- ** sizeGroupGetMode
    sizeGroupGetMode                        ,


-- ** sizeGroupGetWidgets
    sizeGroupGetWidgets                     ,


-- ** sizeGroupNew
    sizeGroupNew                            ,


-- ** sizeGroupRemoveWidget
    sizeGroupRemoveWidget                   ,


-- ** sizeGroupSetIgnoreHidden
    sizeGroupSetIgnoreHidden                ,


-- ** sizeGroupSetMode
    sizeGroupSetMode                        ,




 -- * Properties
-- ** IgnoreHidden
    SizeGroupIgnoreHiddenPropertyInfo       ,
    constructSizeGroupIgnoreHidden          ,
    getSizeGroupIgnoreHidden                ,
    setSizeGroupIgnoreHidden                ,


-- ** Mode
    SizeGroupModePropertyInfo               ,
    constructSizeGroupMode                  ,
    getSizeGroupMode                        ,
    setSizeGroupMode                        ,




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

newtype SizeGroup = SizeGroup (ForeignPtr SizeGroup)
foreign import ccall "gtk_size_group_get_type"
    c_gtk_size_group_get_type :: IO GType

type instance ParentTypes SizeGroup = SizeGroupParentTypes
type SizeGroupParentTypes = '[GObject.Object, Buildable]

instance GObject SizeGroup where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_size_group_get_type
    

class GObject o => SizeGroupK o
instance (GObject o, IsDescendantOf SizeGroup o) => SizeGroupK o

toSizeGroup :: SizeGroupK o => o -> IO SizeGroup
toSizeGroup = unsafeCastTo SizeGroup

noSizeGroup :: Maybe SizeGroup
noSizeGroup = Nothing

-- VVV Prop "ignore-hidden"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getSizeGroupIgnoreHidden :: (MonadIO m, SizeGroupK o) => o -> m Bool
getSizeGroupIgnoreHidden obj = liftIO $ getObjectPropertyBool obj "ignore-hidden"

setSizeGroupIgnoreHidden :: (MonadIO m, SizeGroupK o) => o -> Bool -> m ()
setSizeGroupIgnoreHidden obj val = liftIO $ setObjectPropertyBool obj "ignore-hidden" val

constructSizeGroupIgnoreHidden :: Bool -> IO ([Char], GValue)
constructSizeGroupIgnoreHidden val = constructObjectPropertyBool "ignore-hidden" val

data SizeGroupIgnoreHiddenPropertyInfo
instance AttrInfo SizeGroupIgnoreHiddenPropertyInfo where
    type AttrAllowedOps SizeGroupIgnoreHiddenPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SizeGroupIgnoreHiddenPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SizeGroupIgnoreHiddenPropertyInfo = SizeGroupK
    type AttrGetType SizeGroupIgnoreHiddenPropertyInfo = Bool
    type AttrLabel SizeGroupIgnoreHiddenPropertyInfo = "SizeGroup::ignore-hidden"
    attrGet _ = getSizeGroupIgnoreHidden
    attrSet _ = setSizeGroupIgnoreHidden
    attrConstruct _ = constructSizeGroupIgnoreHidden

-- VVV Prop "mode"
   -- Type: TInterface "Gtk" "SizeGroupMode"
   -- Flags: [PropertyReadable,PropertyWritable]

getSizeGroupMode :: (MonadIO m, SizeGroupK o) => o -> m SizeGroupMode
getSizeGroupMode obj = liftIO $ getObjectPropertyEnum obj "mode"

setSizeGroupMode :: (MonadIO m, SizeGroupK o) => o -> SizeGroupMode -> m ()
setSizeGroupMode obj val = liftIO $ setObjectPropertyEnum obj "mode" val

constructSizeGroupMode :: SizeGroupMode -> IO ([Char], GValue)
constructSizeGroupMode val = constructObjectPropertyEnum "mode" val

data SizeGroupModePropertyInfo
instance AttrInfo SizeGroupModePropertyInfo where
    type AttrAllowedOps SizeGroupModePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SizeGroupModePropertyInfo = (~) SizeGroupMode
    type AttrBaseTypeConstraint SizeGroupModePropertyInfo = SizeGroupK
    type AttrGetType SizeGroupModePropertyInfo = SizeGroupMode
    type AttrLabel SizeGroupModePropertyInfo = "SizeGroup::mode"
    attrGet _ = getSizeGroupMode
    attrSet _ = setSizeGroupMode
    attrConstruct _ = constructSizeGroupMode

type instance AttributeList SizeGroup = SizeGroupAttributeList
type SizeGroupAttributeList = ('[ '("ignore-hidden", SizeGroupIgnoreHiddenPropertyInfo), '("mode", SizeGroupModePropertyInfo)] :: [(Symbol, *)])

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

-- method SizeGroup::new
-- method type : Constructor
-- Args : [Arg {argName = "mode", argType = TInterface "Gtk" "SizeGroupMode", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "mode", argType = TInterface "Gtk" "SizeGroupMode", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "SizeGroup"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_size_group_new" gtk_size_group_new :: 
    CUInt ->                                -- mode : TInterface "Gtk" "SizeGroupMode"
    IO (Ptr SizeGroup)


sizeGroupNew ::
    (MonadIO m) =>
    SizeGroupMode ->                        -- mode
    m SizeGroup
sizeGroupNew mode = liftIO $ do
    let mode' = (fromIntegral . fromEnum) mode
    result <- gtk_size_group_new mode'
    checkUnexpectedReturnNULL "gtk_size_group_new" result
    result' <- (wrapObject SizeGroup) result
    return result'

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

foreign import ccall "gtk_size_group_add_widget" gtk_size_group_add_widget :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    Ptr Widget ->                           -- widget : TInterface "Gtk" "Widget"
    IO ()


sizeGroupAddWidget ::
    (MonadIO m, SizeGroupK a, WidgetK b) =>
    a ->                                    -- _obj
    b ->                                    -- widget
    m ()
sizeGroupAddWidget _obj widget = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let widget' = unsafeManagedPtrCastPtr widget
    gtk_size_group_add_widget _obj' widget'
    touchManagedPtr _obj
    touchManagedPtr widget
    return ()

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

foreign import ccall "gtk_size_group_get_ignore_hidden" gtk_size_group_get_ignore_hidden :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    IO CInt


sizeGroupGetIgnoreHidden ::
    (MonadIO m, SizeGroupK a) =>
    a ->                                    -- _obj
    m Bool
sizeGroupGetIgnoreHidden _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_size_group_get_ignore_hidden _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_size_group_get_mode" gtk_size_group_get_mode :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    IO CUInt


sizeGroupGetMode ::
    (MonadIO m, SizeGroupK a) =>
    a ->                                    -- _obj
    m SizeGroupMode
sizeGroupGetMode _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_size_group_get_mode _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_size_group_get_widgets" gtk_size_group_get_widgets :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    IO (Ptr (GSList (Ptr Widget)))


sizeGroupGetWidgets ::
    (MonadIO m, SizeGroupK a) =>
    a ->                                    -- _obj
    m [Widget]
sizeGroupGetWidgets _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_size_group_get_widgets _obj'
    checkUnexpectedReturnNULL "gtk_size_group_get_widgets" result
    result' <- unpackGSList result
    result'' <- mapM (newObject Widget) result'
    touchManagedPtr _obj
    return result''

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

foreign import ccall "gtk_size_group_remove_widget" gtk_size_group_remove_widget :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    Ptr Widget ->                           -- widget : TInterface "Gtk" "Widget"
    IO ()


sizeGroupRemoveWidget ::
    (MonadIO m, SizeGroupK a, WidgetK b) =>
    a ->                                    -- _obj
    b ->                                    -- widget
    m ()
sizeGroupRemoveWidget _obj widget = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let widget' = unsafeManagedPtrCastPtr widget
    gtk_size_group_remove_widget _obj' widget'
    touchManagedPtr _obj
    touchManagedPtr widget
    return ()

-- method SizeGroup::set_ignore_hidden
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SizeGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_hidden", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SizeGroup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_hidden", 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_size_group_set_ignore_hidden" gtk_size_group_set_ignore_hidden :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    CInt ->                                 -- ignore_hidden : TBasicType TBoolean
    IO ()


sizeGroupSetIgnoreHidden ::
    (MonadIO m, SizeGroupK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- ignore_hidden
    m ()
sizeGroupSetIgnoreHidden _obj ignore_hidden = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let ignore_hidden' = (fromIntegral . fromEnum) ignore_hidden
    gtk_size_group_set_ignore_hidden _obj' ignore_hidden'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_size_group_set_mode" gtk_size_group_set_mode :: 
    Ptr SizeGroup ->                        -- _obj : TInterface "Gtk" "SizeGroup"
    CUInt ->                                -- mode : TInterface "Gtk" "SizeGroupMode"
    IO ()


sizeGroupSetMode ::
    (MonadIO m, SizeGroupK a) =>
    a ->                                    -- _obj
    SizeGroupMode ->                        -- mode
    m ()
sizeGroupSetMode _obj mode = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let mode' = (fromIntegral . fromEnum) mode
    gtk_size_group_set_mode _obj' mode'
    touchManagedPtr _obj
    return ()