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

-- * Exported types
    SpaceDrawer(..)                         ,
    IsSpaceDrawer                           ,
    toSpaceDrawer                           ,
    noSpaceDrawer                           ,


 -- * Methods
-- ** bindMatrixSetting #method:bindMatrixSetting#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerBindMatrixSettingMethodInfo  ,
#endif
    spaceDrawerBindMatrixSetting            ,


-- ** getEnableMatrix #method:getEnableMatrix#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerGetEnableMatrixMethodInfo    ,
#endif
    spaceDrawerGetEnableMatrix              ,


-- ** getMatrix #method:getMatrix#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerGetMatrixMethodInfo          ,
#endif
    spaceDrawerGetMatrix                    ,


-- ** getTypesForLocations #method:getTypesForLocations#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerGetTypesForLocationsMethodInfo,
#endif
    spaceDrawerGetTypesForLocations         ,


-- ** new #method:new#
    spaceDrawerNew                          ,


-- ** setEnableMatrix #method:setEnableMatrix#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerSetEnableMatrixMethodInfo    ,
#endif
    spaceDrawerSetEnableMatrix              ,


-- ** setMatrix #method:setMatrix#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerSetMatrixMethodInfo          ,
#endif
    spaceDrawerSetMatrix                    ,


-- ** setTypesForLocations #method:setTypesForLocations#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerSetTypesForLocationsMethodInfo,
#endif
    spaceDrawerSetTypesForLocations         ,




 -- * Properties
-- ** enableMatrix #attr:enableMatrix#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerEnableMatrixPropertyInfo     ,
#endif
    constructSpaceDrawerEnableMatrix        ,
    getSpaceDrawerEnableMatrix              ,
    setSpaceDrawerEnableMatrix              ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    spaceDrawerEnableMatrix                 ,
#endif


-- ** matrix #attr:matrix#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    SpaceDrawerMatrixPropertyInfo           ,
#endif
    clearSpaceDrawerMatrix                  ,
    constructSpaceDrawerMatrix              ,
    getSpaceDrawerMatrix                    ,
    setSpaceDrawerMatrix                    ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    spaceDrawerMatrix                       ,
#endif




    ) 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 qualified GI.Gio.Flags as Gio.Flags
import qualified GI.Gio.Objects.Settings as Gio.Settings
import {-# SOURCE #-} qualified GI.GtkSource.Flags as GtkSource.Flags

newtype SpaceDrawer = SpaceDrawer (ManagedPtr SpaceDrawer)
foreign import ccall "gtk_source_space_drawer_get_type"
    c_gtk_source_space_drawer_get_type :: IO GType

instance GObject SpaceDrawer where
    gobjectType _ = c_gtk_source_space_drawer_get_type
    

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

toSpaceDrawer :: (MonadIO m, IsSpaceDrawer o) => o -> m SpaceDrawer
toSpaceDrawer = liftIO . unsafeCastTo SpaceDrawer

noSpaceDrawer :: Maybe SpaceDrawer
noSpaceDrawer = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveSpaceDrawerMethod (t :: Symbol) (o :: *) :: * where
    ResolveSpaceDrawerMethod "bindMatrixSetting" o = SpaceDrawerBindMatrixSettingMethodInfo
    ResolveSpaceDrawerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveSpaceDrawerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveSpaceDrawerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveSpaceDrawerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveSpaceDrawerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveSpaceDrawerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveSpaceDrawerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveSpaceDrawerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveSpaceDrawerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveSpaceDrawerMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveSpaceDrawerMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveSpaceDrawerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveSpaceDrawerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveSpaceDrawerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveSpaceDrawerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveSpaceDrawerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveSpaceDrawerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveSpaceDrawerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveSpaceDrawerMethod "getEnableMatrix" o = SpaceDrawerGetEnableMatrixMethodInfo
    ResolveSpaceDrawerMethod "getMatrix" o = SpaceDrawerGetMatrixMethodInfo
    ResolveSpaceDrawerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveSpaceDrawerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveSpaceDrawerMethod "getTypesForLocations" o = SpaceDrawerGetTypesForLocationsMethodInfo
    ResolveSpaceDrawerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveSpaceDrawerMethod "setEnableMatrix" o = SpaceDrawerSetEnableMatrixMethodInfo
    ResolveSpaceDrawerMethod "setMatrix" o = SpaceDrawerSetMatrixMethodInfo
    ResolveSpaceDrawerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveSpaceDrawerMethod "setTypesForLocations" o = SpaceDrawerSetTypesForLocationsMethodInfo
    ResolveSpaceDrawerMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSpaceDrawerMethod t SpaceDrawer, O.MethodInfo info SpaceDrawer p) => O.IsLabel t (SpaceDrawer -> 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

-- VVV Prop "enable-matrix"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Just False,Just False)

getSpaceDrawerEnableMatrix :: (MonadIO m, IsSpaceDrawer o) => o -> m Bool
getSpaceDrawerEnableMatrix obj = liftIO $ getObjectPropertyBool obj "enable-matrix"

setSpaceDrawerEnableMatrix :: (MonadIO m, IsSpaceDrawer o) => o -> Bool -> m ()
setSpaceDrawerEnableMatrix obj val = liftIO $ setObjectPropertyBool obj "enable-matrix" val

constructSpaceDrawerEnableMatrix :: (IsSpaceDrawer o) => Bool -> IO (GValueConstruct o)
constructSpaceDrawerEnableMatrix val = constructObjectPropertyBool "enable-matrix" val

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerEnableMatrixPropertyInfo
instance AttrInfo SpaceDrawerEnableMatrixPropertyInfo where
    type AttrAllowedOps SpaceDrawerEnableMatrixPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SpaceDrawerEnableMatrixPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint SpaceDrawerEnableMatrixPropertyInfo = IsSpaceDrawer
    type AttrGetType SpaceDrawerEnableMatrixPropertyInfo = Bool
    type AttrLabel SpaceDrawerEnableMatrixPropertyInfo = "enable-matrix"
    type AttrOrigin SpaceDrawerEnableMatrixPropertyInfo = SpaceDrawer
    attrGet _ = getSpaceDrawerEnableMatrix
    attrSet _ = setSpaceDrawerEnableMatrix
    attrConstruct _ = constructSpaceDrawerEnableMatrix
    attrClear _ = undefined
#endif

-- VVV Prop "matrix"
   -- Type: TVariant
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Just True)

getSpaceDrawerMatrix :: (MonadIO m, IsSpaceDrawer o) => o -> m (Maybe GVariant)
getSpaceDrawerMatrix obj = liftIO $ getObjectPropertyVariant obj "matrix"

setSpaceDrawerMatrix :: (MonadIO m, IsSpaceDrawer o) => o -> GVariant -> m ()
setSpaceDrawerMatrix obj val = liftIO $ setObjectPropertyVariant obj "matrix" (Just val)

constructSpaceDrawerMatrix :: (IsSpaceDrawer o) => GVariant -> IO (GValueConstruct o)
constructSpaceDrawerMatrix val = constructObjectPropertyVariant "matrix" (Just val)

clearSpaceDrawerMatrix :: (MonadIO m, IsSpaceDrawer o) => o -> m ()
clearSpaceDrawerMatrix obj = liftIO $ setObjectPropertyVariant obj "matrix" (Nothing :: Maybe GVariant)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerMatrixPropertyInfo
instance AttrInfo SpaceDrawerMatrixPropertyInfo where
    type AttrAllowedOps SpaceDrawerMatrixPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SpaceDrawerMatrixPropertyInfo = (~) GVariant
    type AttrBaseTypeConstraint SpaceDrawerMatrixPropertyInfo = IsSpaceDrawer
    type AttrGetType SpaceDrawerMatrixPropertyInfo = (Maybe GVariant)
    type AttrLabel SpaceDrawerMatrixPropertyInfo = "matrix"
    type AttrOrigin SpaceDrawerMatrixPropertyInfo = SpaceDrawer
    attrGet _ = getSpaceDrawerMatrix
    attrSet _ = setSpaceDrawerMatrix
    attrConstruct _ = constructSpaceDrawerMatrix
    attrClear _ = clearSpaceDrawerMatrix
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList SpaceDrawer
type instance O.AttributeList SpaceDrawer = SpaceDrawerAttributeList
type SpaceDrawerAttributeList = ('[ '("enableMatrix", SpaceDrawerEnableMatrixPropertyInfo), '("matrix", SpaceDrawerMatrixPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
spaceDrawerEnableMatrix :: AttrLabelProxy "enableMatrix"
spaceDrawerEnableMatrix = AttrLabelProxy

spaceDrawerMatrix :: AttrLabelProxy "matrix"
spaceDrawerMatrix = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type instance O.SignalList SpaceDrawer = SpaceDrawerSignalList
type SpaceDrawerSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method SpaceDrawer::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_new" gtk_source_space_drawer_new :: 
    IO (Ptr SpaceDrawer)

{- |
Creates a new 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer' object. Useful for storing space drawing
settings independently of a 'GI.GtkSource.Objects.View.View'.

@since 3.24
-}
spaceDrawerNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m SpaceDrawer
    {- ^ __Returns:__ a new 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
spaceDrawerNew  = liftIO $ do
    result <- gtk_source_space_drawer_new
    checkUnexpectedReturnNULL "spaceDrawerNew" result
    result' <- (wrapObject SpaceDrawer) result
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif

-- method SpaceDrawer::bind_matrix_setting
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer object.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "settings", argType = TInterface (Name {namespace = "Gio", name = "Settings"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GSettings object.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the @settings key to bind.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "Gio", name = "SettingsBindFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags for the binding.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_bind_matrix_setting" gtk_source_space_drawer_bind_matrix_setting :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    Ptr Gio.Settings.Settings ->            -- settings : TInterface (Name {namespace = "Gio", name = "Settings"})
    CString ->                              -- key : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "Gio", name = "SettingsBindFlags"})
    IO ()

{- |
Binds the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property to a 'GI.Gio.Objects.Settings.Settings' key.

The 'GI.Gio.Objects.Settings.Settings' key must be of the same type as the
'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property, that is, @\"au\"@.

The 'GI.Gio.Objects.Settings.settingsBind' function cannot be used, because the default GIO
mapping functions don\'t support 'GVariant' properties (maybe it will be
supported by a future GIO version, in which case this function can be
deprecated).

@since 3.24
-}
spaceDrawerBindMatrixSetting ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a, Gio.Settings.IsSettings b) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer' object. -}
    -> b
    {- ^ /@settings@/: a 'GI.Gio.Objects.Settings.Settings' object. -}
    -> T.Text
    {- ^ /@key@/: the /@settings@/ key to bind. -}
    -> [Gio.Flags.SettingsBindFlags]
    {- ^ /@flags@/: flags for the binding. -}
    -> m ()
spaceDrawerBindMatrixSetting drawer settings key flags = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    settings' <- unsafeManagedPtrCastPtr settings
    key' <- textToCString key
    let flags' = gflagsToWord flags
    gtk_source_space_drawer_bind_matrix_setting drawer' settings' key' flags'
    touchManagedPtr drawer
    touchManagedPtr settings
    freeMem key'
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerBindMatrixSettingMethodInfo
instance (signature ~ (b -> T.Text -> [Gio.Flags.SettingsBindFlags] -> m ()), MonadIO m, IsSpaceDrawer a, Gio.Settings.IsSettings b) => O.MethodInfo SpaceDrawerBindMatrixSettingMethodInfo a signature where
    overloadedMethod _ = spaceDrawerBindMatrixSetting

#endif

-- method SpaceDrawer::get_enable_matrix
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_get_enable_matrix" gtk_source_space_drawer_get_enable_matrix :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    IO CInt

{- |
/No description available in the introspection data./

@since 3.24
-}
spaceDrawerGetEnableMatrix ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
    -> m Bool
    {- ^ __Returns:__ whether the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property is enabled. -}
spaceDrawerGetEnableMatrix drawer = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    result <- gtk_source_space_drawer_get_enable_matrix drawer'
    let result' = (/= 0) result
    touchManagedPtr drawer
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerGetEnableMatrixMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsSpaceDrawer a) => O.MethodInfo SpaceDrawerGetEnableMatrixMethodInfo a signature where
    overloadedMethod _ = spaceDrawerGetEnableMatrix

#endif

-- method SpaceDrawer::get_matrix
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_get_matrix" gtk_source_space_drawer_get_matrix :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    IO (Ptr GVariant)

{- |
Gets the value of the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property, as a 'GVariant'.
An empty array can be returned in case the matrix is a zero matrix.

The 'GI.GtkSource.Objects.SpaceDrawer.spaceDrawerGetTypesForLocations' function may be more
convenient to use.

@since 3.24
-}
spaceDrawerGetMatrix ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
    -> m GVariant
    {- ^ __Returns:__ the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ value as a new floating 'GVariant'
  instance. -}
spaceDrawerGetMatrix drawer = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    result <- gtk_source_space_drawer_get_matrix drawer'
    checkUnexpectedReturnNULL "spaceDrawerGetMatrix" result
    result' <- wrapGVariantPtr result
    touchManagedPtr drawer
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerGetMatrixMethodInfo
instance (signature ~ (m GVariant), MonadIO m, IsSpaceDrawer a) => O.MethodInfo SpaceDrawerGetMatrixMethodInfo a signature where
    overloadedMethod _ = spaceDrawerGetMatrix

#endif

-- method SpaceDrawer::get_types_for_locations
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locations", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceLocationFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "one or several #GtkSourceSpaceLocationFlags.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GtkSource", name = "SpaceTypeFlags"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_get_types_for_locations" gtk_source_space_drawer_get_types_for_locations :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    CUInt ->                                -- locations : TInterface (Name {namespace = "GtkSource", name = "SpaceLocationFlags"})
    IO CUInt

{- |
If only one location is specified, this function returns what kind of
white spaces are drawn at that location. The value is retrieved from the
'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property.

If several locations are specified, this function returns the logical AND for
those locations. Which means that if a certain kind of white space is present
in the return value, then that kind of white space is drawn at all the
specified /@locations@/.

@since 3.24
-}
spaceDrawerGetTypesForLocations ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
    -> [GtkSource.Flags.SpaceLocationFlags]
    {- ^ /@locations@/: one or several 'GI.GtkSource.Flags.SpaceLocationFlags'. -}
    -> m [GtkSource.Flags.SpaceTypeFlags]
    {- ^ __Returns:__ a combination of 'GI.GtkSource.Flags.SpaceTypeFlags'. -}
spaceDrawerGetTypesForLocations drawer locations = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    let locations' = gflagsToWord locations
    result <- gtk_source_space_drawer_get_types_for_locations drawer' locations'
    let result' = wordToGFlags result
    touchManagedPtr drawer
    return result'

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerGetTypesForLocationsMethodInfo
instance (signature ~ ([GtkSource.Flags.SpaceLocationFlags] -> m [GtkSource.Flags.SpaceTypeFlags]), MonadIO m, IsSpaceDrawer a) => O.MethodInfo SpaceDrawerGetTypesForLocationsMethodInfo a signature where
    overloadedMethod _ = spaceDrawerGetTypesForLocations

#endif

-- method SpaceDrawer::set_enable_matrix
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "enable_matrix", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the new value.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_set_enable_matrix" gtk_source_space_drawer_set_enable_matrix :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    CInt ->                                 -- enable_matrix : TBasicType TBoolean
    IO ()

{- |
Sets whether the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property is enabled.

@since 3.24
-}
spaceDrawerSetEnableMatrix ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
    -> Bool
    {- ^ /@enableMatrix@/: the new value. -}
    -> m ()
spaceDrawerSetEnableMatrix drawer enableMatrix = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    let enableMatrix' = (fromIntegral . fromEnum) enableMatrix
    gtk_source_space_drawer_set_enable_matrix drawer' enableMatrix'
    touchManagedPtr drawer
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerSetEnableMatrixMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsSpaceDrawer a) => O.MethodInfo SpaceDrawerSetEnableMatrixMethodInfo a signature where
    overloadedMethod _ = spaceDrawerSetEnableMatrix

#endif

-- method SpaceDrawer::set_matrix
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "matrix", argType = TVariant, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the new matrix value, or %NULL.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_set_matrix" gtk_source_space_drawer_set_matrix :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    Ptr GVariant ->                         -- matrix : TVariant
    IO ()

{- |
Sets a new value to the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property, as a
'GVariant'. If /@matrix@/ is 'Nothing', then an empty array is set.

If /@matrix@/ is floating, it is consumed.

The 'GI.GtkSource.Objects.SpaceDrawer.spaceDrawerSetTypesForLocations' function may be more
convenient to use.

@since 3.24
-}
spaceDrawerSetMatrix ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
    -> Maybe (GVariant)
    {- ^ /@matrix@/: the new matrix value, or 'Nothing'. -}
    -> m ()
spaceDrawerSetMatrix drawer matrix = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    maybeMatrix <- case matrix of
        Nothing -> return nullPtr
        Just jMatrix -> do
            jMatrix' <- unsafeManagedPtrGetPtr jMatrix
            return jMatrix'
    gtk_source_space_drawer_set_matrix drawer' maybeMatrix
    touchManagedPtr drawer
    whenJust matrix touchManagedPtr
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerSetMatrixMethodInfo
instance (signature ~ (Maybe (GVariant) -> m ()), MonadIO m, IsSpaceDrawer a) => O.MethodInfo SpaceDrawerSetMatrixMethodInfo a signature where
    overloadedMethod _ = spaceDrawerSetMatrix

#endif

-- method SpaceDrawer::set_types_for_locations
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "drawer", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkSourceSpaceDrawer.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "locations", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceLocationFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "one or several #GtkSourceSpaceLocationFlags.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "types", argType = TInterface (Name {namespace = "GtkSource", name = "SpaceTypeFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a combination of #GtkSourceSpaceTypeFlags.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_source_space_drawer_set_types_for_locations" gtk_source_space_drawer_set_types_for_locations :: 
    Ptr SpaceDrawer ->                      -- drawer : TInterface (Name {namespace = "GtkSource", name = "SpaceDrawer"})
    CUInt ->                                -- locations : TInterface (Name {namespace = "GtkSource", name = "SpaceLocationFlags"})
    CUInt ->                                -- types : TInterface (Name {namespace = "GtkSource", name = "SpaceTypeFlags"})
    IO ()

{- |
Modifies the 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer':@/matrix/@ property at the specified
/@locations@/.

@since 3.24
-}
spaceDrawerSetTypesForLocations ::
    (B.CallStack.HasCallStack, MonadIO m, IsSpaceDrawer a) =>
    a
    {- ^ /@drawer@/: a 'GI.GtkSource.Objects.SpaceDrawer.SpaceDrawer'. -}
    -> [GtkSource.Flags.SpaceLocationFlags]
    {- ^ /@locations@/: one or several 'GI.GtkSource.Flags.SpaceLocationFlags'. -}
    -> [GtkSource.Flags.SpaceTypeFlags]
    {- ^ /@types@/: a combination of 'GI.GtkSource.Flags.SpaceTypeFlags'. -}
    -> m ()
spaceDrawerSetTypesForLocations drawer locations types = liftIO $ do
    drawer' <- unsafeManagedPtrCastPtr drawer
    let locations' = gflagsToWord locations
    let types' = gflagsToWord types
    gtk_source_space_drawer_set_types_for_locations drawer' locations' types'
    touchManagedPtr drawer
    return ()

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data SpaceDrawerSetTypesForLocationsMethodInfo
instance (signature ~ ([GtkSource.Flags.SpaceLocationFlags] -> [GtkSource.Flags.SpaceTypeFlags] -> m ()), MonadIO m, IsSpaceDrawer a) => O.MethodInfo SpaceDrawerSetTypesForLocationsMethodInfo a signature where
    overloadedMethod _ = spaceDrawerSetTypesForLocations

#endif