{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.Gtk.Structs.StockItem
    ( 

-- * Exported types
    StockItem(..)                           ,
    newZeroStockItem                        ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [free]("GI.Gtk.Structs.StockItem#g:method:free").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveStockItemMethod                  ,
#endif

-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    StockItemFreeMethodInfo                 ,
#endif
    stockItemFree                           ,




 -- * Properties


-- ** keyval #attr:keyval#
-- | Keyboard accelerator

    getStockItemKeyval                      ,
    setStockItemKeyval                      ,
#if defined(ENABLE_OVERLOADING)
    stockItem_keyval                        ,
#endif


-- ** label #attr:label#
-- | User visible label.

    clearStockItemLabel                     ,
    getStockItemLabel                       ,
    setStockItemLabel                       ,
#if defined(ENABLE_OVERLOADING)
    stockItem_label                         ,
#endif


-- ** modifier #attr:modifier#
-- | Modifier type for keyboard accelerator

    getStockItemModifier                    ,
    setStockItemModifier                    ,
#if defined(ENABLE_OVERLOADING)
    stockItem_modifier                      ,
#endif


-- ** stockId #attr:stockId#
-- | Identifier.

    clearStockItemStockId                   ,
    getStockItemStockId                     ,
    setStockItemStockId                     ,
#if defined(ENABLE_OVERLOADING)
    stockItem_stockId                       ,
#endif


-- ** translationDomain #attr:translationDomain#
-- | Translation domain of the menu or toolbar item

    clearStockItemTranslationDomain         ,
    getStockItemTranslationDomain           ,
    setStockItemTranslationDomain           ,
#if defined(ENABLE_OVERLOADING)
    stockItem_translationDomain             ,
#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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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
import qualified GHC.Records as R

import qualified GI.Gdk.Flags as Gdk.Flags

-- | Memory-managed wrapper type.
newtype StockItem = StockItem (SP.ManagedPtr StockItem)
    deriving (StockItem -> StockItem -> Bool
(StockItem -> StockItem -> Bool)
-> (StockItem -> StockItem -> Bool) -> Eq StockItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StockItem -> StockItem -> Bool
== :: StockItem -> StockItem -> Bool
$c/= :: StockItem -> StockItem -> Bool
/= :: StockItem -> StockItem -> Bool
Eq)

instance SP.ManagedPtrNewtype StockItem where
    toManagedPtr :: StockItem -> ManagedPtr StockItem
toManagedPtr (StockItem ManagedPtr StockItem
p) = ManagedPtr StockItem
p

instance BoxedPtr StockItem where
    boxedPtrCopy :: StockItem -> IO StockItem
boxedPtrCopy = \StockItem
p -> StockItem -> (Ptr StockItem -> IO StockItem) -> IO StockItem
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr StockItem
p (Int -> Ptr StockItem -> IO (Ptr StockItem)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
32 (Ptr StockItem -> IO (Ptr StockItem))
-> (Ptr StockItem -> IO StockItem) -> Ptr StockItem -> IO StockItem
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr StockItem -> StockItem)
-> Ptr StockItem -> IO StockItem
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr StockItem -> StockItem
StockItem)
    boxedPtrFree :: StockItem -> IO ()
boxedPtrFree = \StockItem
x -> StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr StockItem
x Ptr StockItem -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr StockItem where
    boxedPtrCalloc :: IO (Ptr StockItem)
boxedPtrCalloc = Int -> IO (Ptr StockItem)
forall a. Int -> IO (Ptr a)
callocBytes Int
32


-- | Construct a `StockItem` struct initialized to zero.
newZeroStockItem :: MonadIO m => m StockItem
newZeroStockItem :: forall (m :: * -> *). MonadIO m => m StockItem
newZeroStockItem = IO StockItem -> m StockItem
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO StockItem -> m StockItem) -> IO StockItem -> m StockItem
forall a b. (a -> b) -> a -> b
$ IO (Ptr StockItem)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr StockItem)
-> (Ptr StockItem -> IO StockItem) -> IO StockItem
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr StockItem -> StockItem)
-> Ptr StockItem -> IO StockItem
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr StockItem -> StockItem
StockItem

instance tag ~ 'AttrSet => Constructible StockItem tag where
    new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr StockItem -> StockItem)
-> [AttrOp StockItem tag] -> m StockItem
new ManagedPtr StockItem -> StockItem
_ [AttrOp StockItem tag]
attrs = do
        StockItem
o <- m StockItem
forall (m :: * -> *). MonadIO m => m StockItem
newZeroStockItem
        StockItem -> [AttrOp StockItem 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set StockItem
o [AttrOp StockItem tag]
[AttrOp StockItem 'AttrSet]
attrs
        StockItem -> m StockItem
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return StockItem
o


-- | Get the value of the “@stock_id@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' stockItem #stockId
-- @
getStockItemStockId :: MonadIO m => StockItem -> m (Maybe T.Text)
getStockItemStockId :: forall (m :: * -> *). MonadIO m => StockItem -> m (Maybe Text)
getStockItemStockId StockItem
s = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

-- | Set the value of the “@stock_id@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' stockItem [ #stockId 'Data.GI.Base.Attributes.:=' value ]
-- @
setStockItemStockId :: MonadIO m => StockItem -> CString -> m ()
setStockItemStockId :: forall (m :: * -> *). MonadIO m => StockItem -> CString -> m ()
setStockItemStockId StockItem
s CString
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CString
val :: CString)

-- | Set the value of the “@stock_id@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #stockId
-- @
clearStockItemStockId :: MonadIO m => StockItem -> m ()
clearStockItemStockId :: forall (m :: * -> *). MonadIO m => StockItem -> m ()
clearStockItemStockId StockItem
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data StockItemStockIdFieldInfo
instance AttrInfo StockItemStockIdFieldInfo where
    type AttrBaseTypeConstraint StockItemStockIdFieldInfo = (~) StockItem
    type AttrAllowedOps StockItemStockIdFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StockItemStockIdFieldInfo = (~) CString
    type AttrTransferTypeConstraint StockItemStockIdFieldInfo = (~)CString
    type AttrTransferType StockItemStockIdFieldInfo = CString
    type AttrGetType StockItemStockIdFieldInfo = Maybe T.Text
    type AttrLabel StockItemStockIdFieldInfo = "stock_id"
    type AttrOrigin StockItemStockIdFieldInfo = StockItem
    attrGet = getStockItemStockId
    attrSet = setStockItemStockId
    attrConstruct = undefined
    attrClear = clearStockItemStockId
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Structs.StockItem.stockId"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Structs-StockItem.html#g:attr:stockId"
        })

stockItem_stockId :: AttrLabelProxy "stockId"
stockItem_stockId = AttrLabelProxy

#endif


-- | Get the value of the “@label@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' stockItem #label
-- @
getStockItemLabel :: MonadIO m => StockItem -> m (Maybe T.Text)
getStockItemLabel :: forall (m :: * -> *). MonadIO m => StockItem -> m (Maybe Text)
getStockItemLabel StockItem
s = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

-- | Set the value of the “@label@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' stockItem [ #label 'Data.GI.Base.Attributes.:=' value ]
-- @
setStockItemLabel :: MonadIO m => StockItem -> CString -> m ()
setStockItemLabel :: forall (m :: * -> *). MonadIO m => StockItem -> CString -> m ()
setStockItemLabel StockItem
s CString
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
val :: CString)

-- | Set the value of the “@label@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #label
-- @
clearStockItemLabel :: MonadIO m => StockItem -> m ()
clearStockItemLabel :: forall (m :: * -> *). MonadIO m => StockItem -> m ()
clearStockItemLabel StockItem
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data StockItemLabelFieldInfo
instance AttrInfo StockItemLabelFieldInfo where
    type AttrBaseTypeConstraint StockItemLabelFieldInfo = (~) StockItem
    type AttrAllowedOps StockItemLabelFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StockItemLabelFieldInfo = (~) CString
    type AttrTransferTypeConstraint StockItemLabelFieldInfo = (~)CString
    type AttrTransferType StockItemLabelFieldInfo = CString
    type AttrGetType StockItemLabelFieldInfo = Maybe T.Text
    type AttrLabel StockItemLabelFieldInfo = "label"
    type AttrOrigin StockItemLabelFieldInfo = StockItem
    attrGet = getStockItemLabel
    attrSet = setStockItemLabel
    attrConstruct = undefined
    attrClear = clearStockItemLabel
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Structs.StockItem.label"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Structs-StockItem.html#g:attr:label"
        })

stockItem_label :: AttrLabelProxy "label"
stockItem_label = AttrLabelProxy

#endif


-- | Get the value of the “@modifier@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' stockItem #modifier
-- @
getStockItemModifier :: MonadIO m => StockItem -> m [Gdk.Flags.ModifierType]
getStockItemModifier :: forall (m :: * -> *). MonadIO m => StockItem -> m [ModifierType]
getStockItemModifier StockItem
s = IO [ModifierType] -> m [ModifierType]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [ModifierType] -> m [ModifierType])
-> IO [ModifierType] -> m [ModifierType]
forall a b. (a -> b) -> a -> b
$ StockItem
-> (Ptr StockItem -> IO [ModifierType]) -> IO [ModifierType]
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO [ModifierType]) -> IO [ModifierType])
-> (Ptr StockItem -> IO [ModifierType]) -> IO [ModifierType]
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    CUInt
val <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CUInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO CUInt
    let val' :: [ModifierType]
val' = CUInt -> [ModifierType]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
val
    [ModifierType] -> IO [ModifierType]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [ModifierType]
val'

-- | Set the value of the “@modifier@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' stockItem [ #modifier 'Data.GI.Base.Attributes.:=' value ]
-- @
setStockItemModifier :: MonadIO m => StockItem -> [Gdk.Flags.ModifierType] -> m ()
setStockItemModifier :: forall (m :: * -> *).
MonadIO m =>
StockItem -> [ModifierType] -> m ()
setStockItemModifier StockItem
s [ModifierType]
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    let val' :: CUInt
val' = [ModifierType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ModifierType]
val
    Ptr CUInt -> CUInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CUInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (CUInt
val' :: CUInt)

#if defined(ENABLE_OVERLOADING)
data StockItemModifierFieldInfo
instance AttrInfo StockItemModifierFieldInfo where
    type AttrBaseTypeConstraint StockItemModifierFieldInfo = (~) StockItem
    type AttrAllowedOps StockItemModifierFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint StockItemModifierFieldInfo = (~) [Gdk.Flags.ModifierType]
    type AttrTransferTypeConstraint StockItemModifierFieldInfo = (~)[Gdk.Flags.ModifierType]
    type AttrTransferType StockItemModifierFieldInfo = [Gdk.Flags.ModifierType]
    type AttrGetType StockItemModifierFieldInfo = [Gdk.Flags.ModifierType]
    type AttrLabel StockItemModifierFieldInfo = "modifier"
    type AttrOrigin StockItemModifierFieldInfo = StockItem
    attrGet = getStockItemModifier
    attrSet = setStockItemModifier
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Structs.StockItem.modifier"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Structs-StockItem.html#g:attr:modifier"
        })

stockItem_modifier :: AttrLabelProxy "modifier"
stockItem_modifier = AttrLabelProxy

#endif


-- | Get the value of the “@keyval@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' stockItem #keyval
-- @
getStockItemKeyval :: MonadIO m => StockItem -> m Word32
getStockItemKeyval :: forall (m :: * -> *). MonadIO m => StockItem -> m Word32
getStockItemKeyval StockItem
s = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO Word32) -> IO Word32)
-> (Ptr StockItem -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20) :: IO Word32
    Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

-- | Set the value of the “@keyval@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' stockItem [ #keyval 'Data.GI.Base.Attributes.:=' value ]
-- @
setStockItemKeyval :: MonadIO m => StockItem -> Word32 -> m ()
setStockItemKeyval :: forall (m :: * -> *). MonadIO m => StockItem -> Word32 -> m ()
setStockItemKeyval StockItem
s Word32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20) (Word32
val :: Word32)

#if defined(ENABLE_OVERLOADING)
data StockItemKeyvalFieldInfo
instance AttrInfo StockItemKeyvalFieldInfo where
    type AttrBaseTypeConstraint StockItemKeyvalFieldInfo = (~) StockItem
    type AttrAllowedOps StockItemKeyvalFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint StockItemKeyvalFieldInfo = (~) Word32
    type AttrTransferTypeConstraint StockItemKeyvalFieldInfo = (~)Word32
    type AttrTransferType StockItemKeyvalFieldInfo = Word32
    type AttrGetType StockItemKeyvalFieldInfo = Word32
    type AttrLabel StockItemKeyvalFieldInfo = "keyval"
    type AttrOrigin StockItemKeyvalFieldInfo = StockItem
    attrGet = getStockItemKeyval
    attrSet = setStockItemKeyval
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Structs.StockItem.keyval"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Structs-StockItem.html#g:attr:keyval"
        })

stockItem_keyval :: AttrLabelProxy "keyval"
stockItem_keyval = AttrLabelProxy

#endif


-- | Get the value of the “@translation_domain@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' stockItem #translationDomain
-- @
getStockItemTranslationDomain :: MonadIO m => StockItem -> m (Maybe T.Text)
getStockItemTranslationDomain :: forall (m :: * -> *). MonadIO m => StockItem -> m (Maybe Text)
getStockItemTranslationDomain StockItem
s = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr StockItem -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

-- | Set the value of the “@translation_domain@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' stockItem [ #translationDomain 'Data.GI.Base.Attributes.:=' value ]
-- @
setStockItemTranslationDomain :: MonadIO m => StockItem -> CString -> m ()
setStockItemTranslationDomain :: forall (m :: * -> *). MonadIO m => StockItem -> CString -> m ()
setStockItemTranslationDomain StockItem
s CString
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) (CString
val :: CString)

-- | Set the value of the “@translation_domain@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #translationDomain
-- @
clearStockItemTranslationDomain :: MonadIO m => StockItem -> m ()
clearStockItemTranslationDomain :: forall (m :: * -> *). MonadIO m => StockItem -> m ()
clearStockItemTranslationDomain StockItem
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ StockItem -> (Ptr StockItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr StockItem
s ((Ptr StockItem -> IO ()) -> IO ())
-> (Ptr StockItem -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr StockItem
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr StockItem
ptr Ptr StockItem -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data StockItemTranslationDomainFieldInfo
instance AttrInfo StockItemTranslationDomainFieldInfo where
    type AttrBaseTypeConstraint StockItemTranslationDomainFieldInfo = (~) StockItem
    type AttrAllowedOps StockItemTranslationDomainFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint StockItemTranslationDomainFieldInfo = (~) CString
    type AttrTransferTypeConstraint StockItemTranslationDomainFieldInfo = (~)CString
    type AttrTransferType StockItemTranslationDomainFieldInfo = CString
    type AttrGetType StockItemTranslationDomainFieldInfo = Maybe T.Text
    type AttrLabel StockItemTranslationDomainFieldInfo = "translation_domain"
    type AttrOrigin StockItemTranslationDomainFieldInfo = StockItem
    attrGet = getStockItemTranslationDomain
    attrSet = setStockItemTranslationDomain
    attrConstruct = undefined
    attrClear = clearStockItemTranslationDomain
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Structs.StockItem.translationDomain"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Structs-StockItem.html#g:attr:translationDomain"
        })

stockItem_translationDomain :: AttrLabelProxy "translationDomain"
stockItem_translationDomain = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList StockItem
type instance O.AttributeList StockItem = StockItemAttributeList
type StockItemAttributeList = ('[ '("stockId", StockItemStockIdFieldInfo), '("label", StockItemLabelFieldInfo), '("modifier", StockItemModifierFieldInfo), '("keyval", StockItemKeyvalFieldInfo), '("translationDomain", StockItemTranslationDomainFieldInfo)] :: [(Symbol, DK.Type)])
#endif

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

foreign import ccall "gtk_stock_item_free" gtk_stock_item_free :: 
    Ptr StockItem ->                        -- item : TInterface (Name {namespace = "Gtk", name = "StockItem"})
    IO ()

{-# DEPRECATED stockItemFree ["(Since version 3.10)"] #-}
-- | Frees a stock item allocated on the heap, such as one returned by
-- @/gtk_stock_item_copy()/@. Also frees the fields inside the stock item,
-- if they are not 'P.Nothing'.
stockItemFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    StockItem
    -- ^ /@item@/: a t'GI.Gtk.Structs.StockItem.StockItem'
    -> m ()
stockItemFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
StockItem -> m ()
stockItemFree StockItem
item = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr StockItem
item' <- StockItem -> IO (Ptr StockItem)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr StockItem
item
    Ptr StockItem -> IO ()
gtk_stock_item_free Ptr StockItem
item'
    StockItem -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr StockItem
item
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data StockItemFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod StockItemFreeMethodInfo StockItem signature where
    overloadedMethod = stockItemFree

instance O.OverloadedMethodInfo StockItemFreeMethodInfo StockItem where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Structs.StockItem.stockItemFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Structs-StockItem.html#v:stockItemFree"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveStockItemMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveStockItemMethod "free" o = StockItemFreeMethodInfo
    ResolveStockItemMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveStockItemMethod t StockItem, O.OverloadedMethod info StockItem p) => OL.IsLabel t (StockItem -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveStockItemMethod t StockItem, O.OverloadedMethod info StockItem p, R.HasField t StockItem p) => R.HasField t StockItem p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveStockItemMethod t StockItem, O.OverloadedMethodInfo info StockItem) => OL.IsLabel t (O.MethodProxy info StockItem) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif