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

The 'GI.Wnck.Structs.WorkspaceLayout.WorkspaceLayout' struct contains information about the layout of
'GI.Wnck.Objects.Workspace.Workspace' on a 'GI.Wnck.Objects.Screen.Screen', and the exact position of a specific
'GI.Wnck.Objects.Workspace.Workspace'.

/Since: 2.12/
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Wnck.Structs.WorkspaceLayout
    (

-- * Exported types
    WorkspaceLayout(..)                     ,
    newZeroWorkspaceLayout                  ,
    noWorkspaceLayout                       ,


 -- * Properties
-- ** cols #attr:cols#
{- | number of columns in the layout grid.
-}
    getWorkspaceLayoutCols                  ,
    setWorkspaceLayoutCols                  ,
#if ENABLE_OVERLOADING
    workspaceLayout_cols                    ,
#endif


-- ** currentCol #attr:currentCol#
{- | column of the specific 'GI.Wnck.Objects.Workspace.Workspace', starting from 0.
-}
    getWorkspaceLayoutCurrentCol            ,
    setWorkspaceLayoutCurrentCol            ,
#if ENABLE_OVERLOADING
    workspaceLayout_currentCol              ,
#endif


-- ** currentRow #attr:currentRow#
{- | row of the specific 'GI.Wnck.Objects.Workspace.Workspace', starting from 0.
-}
    getWorkspaceLayoutCurrentRow            ,
    setWorkspaceLayoutCurrentRow            ,
#if ENABLE_OVERLOADING
    workspaceLayout_currentRow              ,
#endif


-- ** grid #attr:grid#
{- | array of size /@gridArea@/ containing the index (starting from 0) of
the 'GI.Wnck.Objects.Workspace.Workspace' for each position in the layout grid, or -1 if the
position does not correspond to any 'GI.Wnck.Objects.Workspace.Workspace'.
-}
    getWorkspaceLayoutGrid                  ,
    setWorkspaceLayoutGrid                  ,
#if ENABLE_OVERLOADING
    workspaceLayout_grid                    ,
#endif


-- ** gridArea #attr:gridArea#
{- | size of the grid containing all 'GI.Wnck.Objects.Workspace.Workspace'. This can be
bigger than the number of 'GI.Wnck.Objects.Workspace.Workspace' because the grid might not be
filled.
-}
    getWorkspaceLayoutGridArea              ,
    setWorkspaceLayoutGridArea              ,
#if ENABLE_OVERLOADING
    workspaceLayout_gridArea                ,
#endif


-- ** rows #attr:rows#
{- | number of rows in the layout grid.
-}
    getWorkspaceLayoutRows                  ,
    setWorkspaceLayoutRows                  ,
#if ENABLE_OVERLOADING
    workspaceLayout_rows                    ,
#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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL


-- | Memory-managed wrapper type.
newtype WorkspaceLayout = WorkspaceLayout (ManagedPtr WorkspaceLayout)
instance WrappedPtr WorkspaceLayout where
    wrappedPtrCalloc = callocBytes 32
    wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> wrapPtr WorkspaceLayout)
    wrappedPtrFree = Just ptr_to_g_free

-- | Construct a `WorkspaceLayout` struct initialized to zero.
newZeroWorkspaceLayout :: MonadIO m => m WorkspaceLayout
newZeroWorkspaceLayout = liftIO $ wrappedPtrCalloc >>= wrapPtr WorkspaceLayout

instance tag ~ 'AttrSet => Constructible WorkspaceLayout tag where
    new _ attrs = do
        o <- newZeroWorkspaceLayout
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `WorkspaceLayout`.
noWorkspaceLayout :: Maybe WorkspaceLayout
noWorkspaceLayout = Nothing

{- |
Get the value of the “@rows@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' workspaceLayout #rows
@
-}
getWorkspaceLayoutRows :: MonadIO m => WorkspaceLayout -> m Int32
getWorkspaceLayoutRows s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Int32
    return val

{- |
Set the value of the “@rows@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' workspaceLayout [ #rows 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWorkspaceLayoutRows :: MonadIO m => WorkspaceLayout -> Int32 -> m ()
setWorkspaceLayoutRows s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: Int32)

#if ENABLE_OVERLOADING
data WorkspaceLayoutRowsFieldInfo
instance AttrInfo WorkspaceLayoutRowsFieldInfo where
    type AttrAllowedOps WorkspaceLayoutRowsFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint WorkspaceLayoutRowsFieldInfo = (~) Int32
    type AttrBaseTypeConstraint WorkspaceLayoutRowsFieldInfo = (~) WorkspaceLayout
    type AttrGetType WorkspaceLayoutRowsFieldInfo = Int32
    type AttrLabel WorkspaceLayoutRowsFieldInfo = "rows"
    type AttrOrigin WorkspaceLayoutRowsFieldInfo = WorkspaceLayout
    attrGet _ = getWorkspaceLayoutRows
    attrSet _ = setWorkspaceLayoutRows
    attrConstruct = undefined
    attrClear _ = undefined

workspaceLayout_rows :: AttrLabelProxy "rows"
workspaceLayout_rows = AttrLabelProxy

#endif


{- |
Get the value of the “@cols@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' workspaceLayout #cols
@
-}
getWorkspaceLayoutCols :: MonadIO m => WorkspaceLayout -> m Int32
getWorkspaceLayoutCols s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO Int32
    return val

{- |
Set the value of the “@cols@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' workspaceLayout [ #cols 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWorkspaceLayoutCols :: MonadIO m => WorkspaceLayout -> Int32 -> m ()
setWorkspaceLayoutCols s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (val :: Int32)

#if ENABLE_OVERLOADING
data WorkspaceLayoutColsFieldInfo
instance AttrInfo WorkspaceLayoutColsFieldInfo where
    type AttrAllowedOps WorkspaceLayoutColsFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint WorkspaceLayoutColsFieldInfo = (~) Int32
    type AttrBaseTypeConstraint WorkspaceLayoutColsFieldInfo = (~) WorkspaceLayout
    type AttrGetType WorkspaceLayoutColsFieldInfo = Int32
    type AttrLabel WorkspaceLayoutColsFieldInfo = "cols"
    type AttrOrigin WorkspaceLayoutColsFieldInfo = WorkspaceLayout
    attrGet _ = getWorkspaceLayoutCols
    attrSet _ = setWorkspaceLayoutCols
    attrConstruct = undefined
    attrClear _ = undefined

workspaceLayout_cols :: AttrLabelProxy "cols"
workspaceLayout_cols = AttrLabelProxy

#endif


{- |
Get the value of the “@grid@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' workspaceLayout #grid
@
-}
getWorkspaceLayoutGrid :: MonadIO m => WorkspaceLayout -> m Int32
getWorkspaceLayoutGrid s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Int32
    return val

{- |
Set the value of the “@grid@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' workspaceLayout [ #grid 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWorkspaceLayoutGrid :: MonadIO m => WorkspaceLayout -> Int32 -> m ()
setWorkspaceLayoutGrid s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: Int32)

#if ENABLE_OVERLOADING
data WorkspaceLayoutGridFieldInfo
instance AttrInfo WorkspaceLayoutGridFieldInfo where
    type AttrAllowedOps WorkspaceLayoutGridFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint WorkspaceLayoutGridFieldInfo = (~) Int32
    type AttrBaseTypeConstraint WorkspaceLayoutGridFieldInfo = (~) WorkspaceLayout
    type AttrGetType WorkspaceLayoutGridFieldInfo = Int32
    type AttrLabel WorkspaceLayoutGridFieldInfo = "grid"
    type AttrOrigin WorkspaceLayoutGridFieldInfo = WorkspaceLayout
    attrGet _ = getWorkspaceLayoutGrid
    attrSet _ = setWorkspaceLayoutGrid
    attrConstruct = undefined
    attrClear _ = undefined

workspaceLayout_grid :: AttrLabelProxy "grid"
workspaceLayout_grid = AttrLabelProxy

#endif


{- |
Get the value of the “@grid_area@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' workspaceLayout #gridArea
@
-}
getWorkspaceLayoutGridArea :: MonadIO m => WorkspaceLayout -> m Int32
getWorkspaceLayoutGridArea s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Int32
    return val

{- |
Set the value of the “@grid_area@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' workspaceLayout [ #gridArea 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWorkspaceLayoutGridArea :: MonadIO m => WorkspaceLayout -> Int32 -> m ()
setWorkspaceLayoutGridArea s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Int32)

#if ENABLE_OVERLOADING
data WorkspaceLayoutGridAreaFieldInfo
instance AttrInfo WorkspaceLayoutGridAreaFieldInfo where
    type AttrAllowedOps WorkspaceLayoutGridAreaFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint WorkspaceLayoutGridAreaFieldInfo = (~) Int32
    type AttrBaseTypeConstraint WorkspaceLayoutGridAreaFieldInfo = (~) WorkspaceLayout
    type AttrGetType WorkspaceLayoutGridAreaFieldInfo = Int32
    type AttrLabel WorkspaceLayoutGridAreaFieldInfo = "grid_area"
    type AttrOrigin WorkspaceLayoutGridAreaFieldInfo = WorkspaceLayout
    attrGet _ = getWorkspaceLayoutGridArea
    attrSet _ = setWorkspaceLayoutGridArea
    attrConstruct = undefined
    attrClear _ = undefined

workspaceLayout_gridArea :: AttrLabelProxy "gridArea"
workspaceLayout_gridArea = AttrLabelProxy

#endif


{- |
Get the value of the “@current_row@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' workspaceLayout #currentRow
@
-}
getWorkspaceLayoutCurrentRow :: MonadIO m => WorkspaceLayout -> m Int32
getWorkspaceLayoutCurrentRow s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Int32
    return val

{- |
Set the value of the “@current_row@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' workspaceLayout [ #currentRow 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWorkspaceLayoutCurrentRow :: MonadIO m => WorkspaceLayout -> Int32 -> m ()
setWorkspaceLayoutCurrentRow s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 20) (val :: Int32)

#if ENABLE_OVERLOADING
data WorkspaceLayoutCurrentRowFieldInfo
instance AttrInfo WorkspaceLayoutCurrentRowFieldInfo where
    type AttrAllowedOps WorkspaceLayoutCurrentRowFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint WorkspaceLayoutCurrentRowFieldInfo = (~) Int32
    type AttrBaseTypeConstraint WorkspaceLayoutCurrentRowFieldInfo = (~) WorkspaceLayout
    type AttrGetType WorkspaceLayoutCurrentRowFieldInfo = Int32
    type AttrLabel WorkspaceLayoutCurrentRowFieldInfo = "current_row"
    type AttrOrigin WorkspaceLayoutCurrentRowFieldInfo = WorkspaceLayout
    attrGet _ = getWorkspaceLayoutCurrentRow
    attrSet _ = setWorkspaceLayoutCurrentRow
    attrConstruct = undefined
    attrClear _ = undefined

workspaceLayout_currentRow :: AttrLabelProxy "currentRow"
workspaceLayout_currentRow = AttrLabelProxy

#endif


{- |
Get the value of the “@current_col@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' workspaceLayout #currentCol
@
-}
getWorkspaceLayoutCurrentCol :: MonadIO m => WorkspaceLayout -> m Int32
getWorkspaceLayoutCurrentCol s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO Int32
    return val

{- |
Set the value of the “@current_col@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' workspaceLayout [ #currentCol 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWorkspaceLayoutCurrentCol :: MonadIO m => WorkspaceLayout -> Int32 -> m ()
setWorkspaceLayoutCurrentCol s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (val :: Int32)

#if ENABLE_OVERLOADING
data WorkspaceLayoutCurrentColFieldInfo
instance AttrInfo WorkspaceLayoutCurrentColFieldInfo where
    type AttrAllowedOps WorkspaceLayoutCurrentColFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint WorkspaceLayoutCurrentColFieldInfo = (~) Int32
    type AttrBaseTypeConstraint WorkspaceLayoutCurrentColFieldInfo = (~) WorkspaceLayout
    type AttrGetType WorkspaceLayoutCurrentColFieldInfo = Int32
    type AttrLabel WorkspaceLayoutCurrentColFieldInfo = "current_col"
    type AttrOrigin WorkspaceLayoutCurrentColFieldInfo = WorkspaceLayout
    attrGet _ = getWorkspaceLayoutCurrentCol
    attrSet _ = setWorkspaceLayoutCurrentCol
    attrConstruct = undefined
    attrClear _ = undefined

workspaceLayout_currentCol :: AttrLabelProxy "currentCol"
workspaceLayout_currentCol = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList WorkspaceLayout
type instance O.AttributeList WorkspaceLayout = WorkspaceLayoutAttributeList
type WorkspaceLayoutAttributeList = ('[ '("rows", WorkspaceLayoutRowsFieldInfo), '("cols", WorkspaceLayoutColsFieldInfo), '("grid", WorkspaceLayoutGridFieldInfo), '("gridArea", WorkspaceLayoutGridAreaFieldInfo), '("currentRow", WorkspaceLayoutCurrentRowFieldInfo), '("currentCol", WorkspaceLayoutCurrentColFieldInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
type family ResolveWorkspaceLayoutMethod (t :: Symbol) (o :: *) :: * where
    ResolveWorkspaceLayoutMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveWorkspaceLayoutMethod t WorkspaceLayout, O.MethodInfo info WorkspaceLayout p) => OL.IsLabel t (WorkspaceLayout -> 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