{- |
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.Structs.StockItem
    ( 

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


 -- * Methods
-- ** stockItemFree
    stockItemFree                           ,




 -- * Properties
-- ** Keyval
    stockItemReadKeyval                     ,


-- ** Label
    stockItemReadLabel                      ,


-- ** Modifier
    stockItemReadModifier                   ,


-- ** StockId
    stockItemReadStockId                    ,


-- ** TranslationDomain
    stockItemReadTranslationDomain          ,




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

newtype StockItem = StockItem (ForeignPtr StockItem)
noStockItem :: Maybe StockItem
noStockItem = Nothing

stockItemReadStockId :: StockItem -> IO T.Text
stockItemReadStockId s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CString
    val' <- cstringToText val
    return val'

stockItemReadLabel :: StockItem -> IO T.Text
stockItemReadLabel s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    val' <- cstringToText val
    return val'

stockItemReadModifier :: StockItem -> IO [Gdk.ModifierType]
stockItemReadModifier s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO CUInt
    let val' = wordToGFlags val
    return val'

stockItemReadKeyval :: StockItem -> IO Word32
stockItemReadKeyval s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Word32
    return val

stockItemReadTranslationDomain :: StockItem -> IO T.Text
stockItemReadTranslationDomain s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO CString
    val' <- cstringToText val
    return val'

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

foreign import ccall "gtk_stock_item_free" gtk_stock_item_free :: 
    Ptr StockItem ->                        -- _obj : TInterface "Gtk" "StockItem"
    IO ()

{-# DEPRECATED stockItemFree ["(Since version 3.10)"]#-}
stockItemFree ::
    (MonadIO m) =>
    StockItem ->                            -- _obj
    m ()
stockItemFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    gtk_stock_item_free _obj'
    touchManagedPtr _obj
    return ()