{- |
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.Gio.Objects.MenuAttributeIter
    ( 

-- * Exported types
    MenuAttributeIter(..)                   ,
    MenuAttributeIterK                      ,
    toMenuAttributeIter                     ,
    noMenuAttributeIter                     ,


 -- * Methods
-- ** menuAttributeIterGetName
    menuAttributeIterGetName                ,


-- ** menuAttributeIterGetNext
    menuAttributeIterGetNext                ,


-- ** menuAttributeIterGetValue
    menuAttributeIterGetValue               ,


-- ** menuAttributeIterNext
    menuAttributeIterNext                   ,




    ) 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.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype MenuAttributeIter = MenuAttributeIter (ForeignPtr MenuAttributeIter)
foreign import ccall "g_menu_attribute_iter_get_type"
    c_g_menu_attribute_iter_get_type :: IO GType

type instance ParentTypes MenuAttributeIter = MenuAttributeIterParentTypes
type MenuAttributeIterParentTypes = '[GObject.Object]

instance GObject MenuAttributeIter where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_menu_attribute_iter_get_type
    

class GObject o => MenuAttributeIterK o
instance (GObject o, IsDescendantOf MenuAttributeIter o) => MenuAttributeIterK o

toMenuAttributeIter :: MenuAttributeIterK o => o -> IO MenuAttributeIter
toMenuAttributeIter = unsafeCastTo MenuAttributeIter

noMenuAttributeIter :: Maybe MenuAttributeIter
noMenuAttributeIter = Nothing

type instance AttributeList MenuAttributeIter = MenuAttributeIterAttributeList
type MenuAttributeIterAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList MenuAttributeIter = MenuAttributeIterSignalList
type MenuAttributeIterSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "g_menu_attribute_iter_get_name" g_menu_attribute_iter_get_name :: 
    Ptr MenuAttributeIter ->                -- _obj : TInterface "Gio" "MenuAttributeIter"
    IO CString


menuAttributeIterGetName ::
    (MonadIO m, MenuAttributeIterK a) =>
    a ->                                    -- _obj
    m T.Text
menuAttributeIterGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_menu_attribute_iter_get_name _obj'
    checkUnexpectedReturnNULL "g_menu_attribute_iter_get_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

-- method MenuAttributeIter::get_next
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuAttributeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "out_name", argType = TBasicType TUTF8, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TVariant, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuAttributeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_attribute_iter_get_next" g_menu_attribute_iter_get_next :: 
    Ptr MenuAttributeIter ->                -- _obj : TInterface "Gio" "MenuAttributeIter"
    Ptr CString ->                          -- out_name : TBasicType TUTF8
    Ptr (Ptr GVariant) ->                   -- value : TVariant
    IO CInt


menuAttributeIterGetNext ::
    (MonadIO m, MenuAttributeIterK a) =>
    a ->                                    -- _obj
    m (Bool,T.Text,GVariant)
menuAttributeIterGetNext _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    out_name <- allocMem :: IO (Ptr CString)
    value <- allocMem :: IO (Ptr (Ptr GVariant))
    result <- g_menu_attribute_iter_get_next _obj' out_name value
    let result' = (/= 0) result
    out_name' <- peek out_name
    out_name'' <- cstringToText out_name'
    value' <- peek value
    value'' <- wrapGVariantPtr value'
    touchManagedPtr _obj
    freeMem out_name
    freeMem value
    return (result', out_name'', value'')

-- method MenuAttributeIter::get_value
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuAttributeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "MenuAttributeIter", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_attribute_iter_get_value" g_menu_attribute_iter_get_value :: 
    Ptr MenuAttributeIter ->                -- _obj : TInterface "Gio" "MenuAttributeIter"
    IO (Ptr GVariant)


menuAttributeIterGetValue ::
    (MonadIO m, MenuAttributeIterK a) =>
    a ->                                    -- _obj
    m GVariant
menuAttributeIterGetValue _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_menu_attribute_iter_get_value _obj'
    checkUnexpectedReturnNULL "g_menu_attribute_iter_get_value" result
    result' <- wrapGVariantPtr result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_menu_attribute_iter_next" g_menu_attribute_iter_next :: 
    Ptr MenuAttributeIter ->                -- _obj : TInterface "Gio" "MenuAttributeIter"
    IO CInt


menuAttributeIterNext ::
    (MonadIO m, MenuAttributeIterK a) =>
    a ->                                    -- _obj
    m Bool
menuAttributeIterNext _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_menu_attribute_iter_next _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'