#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.StockItem
(
StockItem(..) ,
newZeroStockItem ,
noStockItem ,
#if ENABLE_OVERLOADING
StockItemFreeMethodInfo ,
#endif
stockItemFree ,
getStockItemKeyval ,
setStockItemKeyval ,
#if ENABLE_OVERLOADING
stockItem_keyval ,
#endif
clearStockItemLabel ,
getStockItemLabel ,
setStockItemLabel ,
#if ENABLE_OVERLOADING
stockItem_label ,
#endif
getStockItemModifier ,
setStockItemModifier ,
#if ENABLE_OVERLOADING
stockItem_modifier ,
#endif
clearStockItemStockId ,
getStockItemStockId ,
setStockItemStockId ,
#if ENABLE_OVERLOADING
stockItem_stockId ,
#endif
clearStockItemTranslationDomain ,
getStockItemTranslationDomain ,
setStockItemTranslationDomain ,
#if 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.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.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.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.Gdk.Flags as Gdk.Flags
newtype StockItem = StockItem (ManagedPtr StockItem)
instance WrappedPtr StockItem where
wrappedPtrCalloc = callocBytes 32
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> wrapPtr StockItem)
wrappedPtrFree = Just ptr_to_g_free
newZeroStockItem :: MonadIO m => m StockItem
newZeroStockItem = liftIO $ wrappedPtrCalloc >>= wrapPtr StockItem
instance tag ~ 'AttrSet => Constructible StockItem tag where
new _ attrs = do
o <- newZeroStockItem
GI.Attributes.set o attrs
return o
noStockItem :: Maybe StockItem
noStockItem = Nothing
getStockItemStockId :: MonadIO m => StockItem -> m (Maybe T.Text)
getStockItemStockId s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setStockItemStockId :: MonadIO m => StockItem -> CString -> m ()
setStockItemStockId s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: CString)
clearStockItemStockId :: MonadIO m => StockItem -> m ()
clearStockItemStockId s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data StockItemStockIdFieldInfo
instance AttrInfo StockItemStockIdFieldInfo where
type AttrAllowedOps StockItemStockIdFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint StockItemStockIdFieldInfo = (~) CString
type AttrBaseTypeConstraint StockItemStockIdFieldInfo = (~) StockItem
type AttrGetType StockItemStockIdFieldInfo = Maybe T.Text
type AttrLabel StockItemStockIdFieldInfo = "stock_id"
type AttrOrigin StockItemStockIdFieldInfo = StockItem
attrGet _ = getStockItemStockId
attrSet _ = setStockItemStockId
attrConstruct = undefined
attrClear _ = clearStockItemStockId
stockItem_stockId :: AttrLabelProxy "stockId"
stockItem_stockId = AttrLabelProxy
#endif
getStockItemLabel :: MonadIO m => StockItem -> m (Maybe T.Text)
getStockItemLabel s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setStockItemLabel :: MonadIO m => StockItem -> CString -> m ()
setStockItemLabel s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: CString)
clearStockItemLabel :: MonadIO m => StockItem -> m ()
clearStockItemLabel s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data StockItemLabelFieldInfo
instance AttrInfo StockItemLabelFieldInfo where
type AttrAllowedOps StockItemLabelFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint StockItemLabelFieldInfo = (~) CString
type AttrBaseTypeConstraint StockItemLabelFieldInfo = (~) StockItem
type AttrGetType StockItemLabelFieldInfo = Maybe T.Text
type AttrLabel StockItemLabelFieldInfo = "label"
type AttrOrigin StockItemLabelFieldInfo = StockItem
attrGet _ = getStockItemLabel
attrSet _ = setStockItemLabel
attrConstruct = undefined
attrClear _ = clearStockItemLabel
stockItem_label :: AttrLabelProxy "label"
stockItem_label = AttrLabelProxy
#endif
getStockItemModifier :: MonadIO m => StockItem -> m [Gdk.Flags.ModifierType]
getStockItemModifier s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CUInt
let val' = wordToGFlags val
return val'
setStockItemModifier :: MonadIO m => StockItem -> [Gdk.Flags.ModifierType] -> m ()
setStockItemModifier s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = gflagsToWord val
poke (ptr `plusPtr` 16) (val' :: CUInt)
#if ENABLE_OVERLOADING
data StockItemModifierFieldInfo
instance AttrInfo StockItemModifierFieldInfo where
type AttrAllowedOps StockItemModifierFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint StockItemModifierFieldInfo = (~) [Gdk.Flags.ModifierType]
type AttrBaseTypeConstraint StockItemModifierFieldInfo = (~) StockItem
type AttrGetType StockItemModifierFieldInfo = [Gdk.Flags.ModifierType]
type AttrLabel StockItemModifierFieldInfo = "modifier"
type AttrOrigin StockItemModifierFieldInfo = StockItem
attrGet _ = getStockItemModifier
attrSet _ = setStockItemModifier
attrConstruct = undefined
attrClear _ = undefined
stockItem_modifier :: AttrLabelProxy "modifier"
stockItem_modifier = AttrLabelProxy
#endif
getStockItemKeyval :: MonadIO m => StockItem -> m Word32
getStockItemKeyval s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 20) :: IO Word32
return val
setStockItemKeyval :: MonadIO m => StockItem -> Word32 -> m ()
setStockItemKeyval s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 20) (val :: Word32)
#if ENABLE_OVERLOADING
data StockItemKeyvalFieldInfo
instance AttrInfo StockItemKeyvalFieldInfo where
type AttrAllowedOps StockItemKeyvalFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint StockItemKeyvalFieldInfo = (~) Word32
type AttrBaseTypeConstraint StockItemKeyvalFieldInfo = (~) StockItem
type AttrGetType StockItemKeyvalFieldInfo = Word32
type AttrLabel StockItemKeyvalFieldInfo = "keyval"
type AttrOrigin StockItemKeyvalFieldInfo = StockItem
attrGet _ = getStockItemKeyval
attrSet _ = setStockItemKeyval
attrConstruct = undefined
attrClear _ = undefined
stockItem_keyval :: AttrLabelProxy "keyval"
stockItem_keyval = AttrLabelProxy
#endif
getStockItemTranslationDomain :: MonadIO m => StockItem -> m (Maybe T.Text)
getStockItemTranslationDomain s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setStockItemTranslationDomain :: MonadIO m => StockItem -> CString -> m ()
setStockItemTranslationDomain s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: CString)
clearStockItemTranslationDomain :: MonadIO m => StockItem -> m ()
clearStockItemTranslationDomain s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data StockItemTranslationDomainFieldInfo
instance AttrInfo StockItemTranslationDomainFieldInfo where
type AttrAllowedOps StockItemTranslationDomainFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint StockItemTranslationDomainFieldInfo = (~) CString
type AttrBaseTypeConstraint StockItemTranslationDomainFieldInfo = (~) StockItem
type AttrGetType StockItemTranslationDomainFieldInfo = Maybe T.Text
type AttrLabel StockItemTranslationDomainFieldInfo = "translation_domain"
type AttrOrigin StockItemTranslationDomainFieldInfo = StockItem
attrGet _ = getStockItemTranslationDomain
attrSet _ = setStockItemTranslationDomain
attrConstruct = undefined
attrClear _ = clearStockItemTranslationDomain
stockItem_translationDomain :: AttrLabelProxy "translationDomain"
stockItem_translationDomain = AttrLabelProxy
#endif
#if 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, *)])
#endif
foreign import ccall "gtk_stock_item_free" gtk_stock_item_free ::
Ptr StockItem ->
IO ()
{-# DEPRECATED stockItemFree ["(Since version 3.10)"] #-}
stockItemFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
StockItem
-> m ()
stockItemFree item = liftIO $ do
item' <- unsafeManagedPtrGetPtr item
gtk_stock_item_free item'
touchManagedPtr item
return ()
#if ENABLE_OVERLOADING
data StockItemFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo StockItemFreeMethodInfo StockItem signature where
overloadedMethod _ = stockItemFree
#endif
#if ENABLE_OVERLOADING
type family ResolveStockItemMethod (t :: Symbol) (o :: *) :: * where
ResolveStockItemMethod "free" o = StockItemFreeMethodInfo
ResolveStockItemMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveStockItemMethod t StockItem, O.MethodInfo info StockItem p) => O.IsLabelProxy t (StockItem -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveStockItemMethod t StockItem, O.MethodInfo info StockItem p) => O.IsLabel t (StockItem -> 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