{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gio.Objects.MenuModel.MenuModel' represents the contents of a menu -- an ordered list of
-- menu items. The items are associated with actions, which can be
-- activated through them. Items can be grouped in sections, and may
-- have submenus associated with them. Both items and sections usually
-- have some representation data, such as labels or icons. The type of
-- the associated action (ie whether it is stateful, and what kind of
-- state it has) can influence the representation of the item.
-- 
-- The conceptual model of menus in t'GI.Gio.Objects.MenuModel.MenuModel' is hierarchical:
-- sections and submenus are again represented by @/GMenuModels/@.
-- Menus themselves do not define their own roles. Rather, the role
-- of a particular t'GI.Gio.Objects.MenuModel.MenuModel' is defined by the item that references
-- it (or, in the case of the \'root\' menu, is defined by the context
-- in which it is used).
-- 
-- As an example, consider the visible portions of this menu:
-- 
-- ## An example menu # {@/menu/@-example}
-- 
-- <<http://developer.gnome.org/gio/stable/menu-example.png>>
-- 
-- There are 8 \"menus\" visible in the screenshot: one menubar, two
-- submenus and 5 sections:
-- 
-- * the toplevel menubar (containing 4 items)
-- * the View submenu (containing 3 sections)
-- * the first section of the View submenu (containing 2 items)
-- * the second section of the View submenu (containing 1 item)
-- * the final section of the View submenu (containing 1 item)
-- * the Highlight Mode submenu (containing 2 sections)
-- * the Sources section (containing 2 items)
-- * the Markup section (containing 2 items)
-- 
-- 
-- The [example][menu-model] illustrates the conceptual connection between
-- these 8 menus. Each large block in the figure represents a menu and the
-- smaller blocks within the large block represent items in that menu. Some
-- items contain references to other menus.
-- 
-- ## A menu example # {@/menu/@-model}
-- 
-- <<http://developer.gnome.org/gio/stable/menu-model.png>>
-- 
-- Notice that the separators visible in the [example][menu-example]
-- appear nowhere in the [menu model][menu-model]. This is because
-- separators are not explicitly represented in the menu model. Instead,
-- a separator is inserted between any two non-empty sections of a menu.
-- Section items can have labels just like any other item. In that case,
-- a display system may show a section header instead of a separator.
-- 
-- The motivation for this abstract model of application controls is
-- that modern user interfaces tend to make these controls available
-- outside the application. Examples include global menus, jumplists,
-- dash boards, etc. To support such uses, it is necessary to \'export\'
-- information about actions and their representation in menus, which
-- is exactly what the [GActionGroup exporter][gio-GActionGroup-exporter]
-- and the [GMenuModel exporter][gio-GMenuModel-exporter] do for
-- t'GI.Gio.Interfaces.ActionGroup.ActionGroup' and t'GI.Gio.Objects.MenuModel.MenuModel'. The client-side counterparts to
-- make use of the exported information are t'GI.Gio.Objects.DBusActionGroup.DBusActionGroup' and
-- t'GI.Gio.Objects.DBusMenuModel.DBusMenuModel'.
-- 
-- The API of t'GI.Gio.Objects.MenuModel.MenuModel' is very generic, with iterators for the
-- attributes and links of an item, see 'GI.Gio.Objects.MenuModel.menuModelIterateItemAttributes'
-- and 'GI.Gio.Objects.MenuModel.menuModelIterateItemLinks'. The \'standard\' attributes and
-- link types have predefined names: 'GI.Gio.Constants.MENU_ATTRIBUTE_LABEL',
-- 'GI.Gio.Constants.MENU_ATTRIBUTE_ACTION', 'GI.Gio.Constants.MENU_ATTRIBUTE_TARGET', 'GI.Gio.Constants.MENU_LINK_SECTION'
-- and 'GI.Gio.Constants.MENU_LINK_SUBMENU'.
-- 
-- Items in a t'GI.Gio.Objects.MenuModel.MenuModel' represent active controls if they refer to
-- an action that can get activated when the user interacts with the
-- menu item. The reference to the action is encoded by the string id
-- in the 'GI.Gio.Constants.MENU_ATTRIBUTE_ACTION' attribute. An action id uniquely
-- identifies an action in an action group. Which action group(s) provide
-- actions depends on the context in which the menu model is used.
-- E.g. when the model is exported as the application menu of a
-- @/GtkApplication/@, actions can be application-wide or window-specific
-- (and thus come from two different action groups). By convention, the
-- application-wide actions have names that start with \"app.\", while the
-- names of window-specific actions start with \"win.\".
-- 
-- While a wide variety of stateful actions is possible, the following
-- is the minimum that is expected to be supported by all users of exported
-- menu information:
-- 
-- * an action with no parameter type and no state
-- * an action with no parameter type and boolean state
-- * an action with string parameter type and string state
-- 
-- 
-- == Stateless
-- 
-- A stateless action typically corresponds to an ordinary menu item.
-- 
-- Selecting such a menu item will activate the action (with no parameter).
-- 
-- == Boolean State
-- 
-- An action with a boolean state will most typically be used with a \"toggle\"
-- or \"switch\" menu item. The state can be set directly, but activating the
-- action (with no parameter) results in the state being toggled.
-- 
-- Selecting a toggle menu item will activate the action. The menu item should
-- be rendered as \"checked\" when the state is true.
-- 
-- == String Parameter and State
-- 
-- Actions with string parameters and state will most typically be used to
-- represent an enumerated choice over the items available for a group of
-- radio menu items. Activating the action with a string parameter is
-- equivalent to setting that parameter as the state.
-- 
-- Radio menu items, in addition to being associated with the action, will
-- have a target value. Selecting that menu item will result in activation
-- of the action with the target value as the parameter. The menu item should
-- be rendered as \"selected\" when the state of the action is equal to the
-- target value of the menu item.
-- 
-- /Since: 2.32/

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

module GI.Gio.Objects.MenuModel
    ( 

-- * Exported types
    MenuModel(..)                           ,
    IsMenuModel                             ,
    toMenuModel                             ,
    noMenuModel                             ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveMenuModelMethod                  ,
#endif


-- ** getItemAttributeValue #method:getItemAttributeValue#

#if defined(ENABLE_OVERLOADING)
    MenuModelGetItemAttributeValueMethodInfo,
#endif
    menuModelGetItemAttributeValue          ,


-- ** getItemLink #method:getItemLink#

#if defined(ENABLE_OVERLOADING)
    MenuModelGetItemLinkMethodInfo          ,
#endif
    menuModelGetItemLink                    ,


-- ** getNItems #method:getNItems#

#if defined(ENABLE_OVERLOADING)
    MenuModelGetNItemsMethodInfo            ,
#endif
    menuModelGetNItems                      ,


-- ** isMutable #method:isMutable#

#if defined(ENABLE_OVERLOADING)
    MenuModelIsMutableMethodInfo            ,
#endif
    menuModelIsMutable                      ,


-- ** itemsChanged #method:itemsChanged#

#if defined(ENABLE_OVERLOADING)
    MenuModelItemsChangedMethodInfo         ,
#endif
    menuModelItemsChanged                   ,


-- ** iterateItemAttributes #method:iterateItemAttributes#

#if defined(ENABLE_OVERLOADING)
    MenuModelIterateItemAttributesMethodInfo,
#endif
    menuModelIterateItemAttributes          ,


-- ** iterateItemLinks #method:iterateItemLinks#

#if defined(ENABLE_OVERLOADING)
    MenuModelIterateItemLinksMethodInfo     ,
#endif
    menuModelIterateItemLinks               ,




 -- * Signals
-- ** itemsChanged #signal:itemsChanged#

    C_MenuModelItemsChangedCallback         ,
    MenuModelItemsChangedCallback           ,
#if defined(ENABLE_OVERLOADING)
    MenuModelItemsChangedSignalInfo         ,
#endif
    afterMenuModelItemsChanged              ,
    genClosure_MenuModelItemsChanged        ,
    mk_MenuModelItemsChangedCallback        ,
    noMenuModelItemsChangedCallback         ,
    onMenuModelItemsChanged                 ,
    wrap_MenuModelItemsChangedCallback      ,




    ) 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.GI.Base.Signals as B.Signals
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

import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuAttributeIter as Gio.MenuAttributeIter
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuLinkIter as Gio.MenuLinkIter

-- | Memory-managed wrapper type.
newtype MenuModel = MenuModel (ManagedPtr MenuModel)
    deriving (MenuModel -> MenuModel -> Bool
(MenuModel -> MenuModel -> Bool)
-> (MenuModel -> MenuModel -> Bool) -> Eq MenuModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MenuModel -> MenuModel -> Bool
$c/= :: MenuModel -> MenuModel -> Bool
== :: MenuModel -> MenuModel -> Bool
$c== :: MenuModel -> MenuModel -> Bool
Eq)
foreign import ccall "g_menu_model_get_type"
    c_g_menu_model_get_type :: IO GType

instance GObject MenuModel where
    gobjectType :: IO GType
gobjectType = IO GType
c_g_menu_model_get_type
    

-- | Convert 'MenuModel' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue MenuModel where
    toGValue :: MenuModel -> IO GValue
toGValue o :: MenuModel
o = do
        GType
gtype <- IO GType
c_g_menu_model_get_type
        MenuModel -> (Ptr MenuModel -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr MenuModel
o (GType
-> (GValue -> Ptr MenuModel -> IO ()) -> Ptr MenuModel -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr MenuModel -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO MenuModel
fromGValue gv :: GValue
gv = do
        Ptr MenuModel
ptr <- GValue -> IO (Ptr MenuModel)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr MenuModel)
        (ManagedPtr MenuModel -> MenuModel)
-> Ptr MenuModel -> IO MenuModel
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr MenuModel -> MenuModel
MenuModel Ptr MenuModel
ptr
        
    

-- | Type class for types which can be safely cast to `MenuModel`, for instance with `toMenuModel`.
class (GObject o, O.IsDescendantOf MenuModel o) => IsMenuModel o
instance (GObject o, O.IsDescendantOf MenuModel o) => IsMenuModel o

instance O.HasParentTypes MenuModel
type instance O.ParentTypes MenuModel = '[GObject.Object.Object]

-- | Cast to `MenuModel`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toMenuModel :: (MonadIO m, IsMenuModel o) => o -> m MenuModel
toMenuModel :: o -> m MenuModel
toMenuModel = IO MenuModel -> m MenuModel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MenuModel -> m MenuModel)
-> (o -> IO MenuModel) -> o -> m MenuModel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr MenuModel -> MenuModel) -> o -> IO MenuModel
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr MenuModel -> MenuModel
MenuModel

-- | A convenience alias for `Nothing` :: `Maybe` `MenuModel`.
noMenuModel :: Maybe MenuModel
noMenuModel :: Maybe MenuModel
noMenuModel = Maybe MenuModel
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
type family ResolveMenuModelMethod (t :: Symbol) (o :: *) :: * where
    ResolveMenuModelMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveMenuModelMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveMenuModelMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveMenuModelMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveMenuModelMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveMenuModelMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveMenuModelMethod "isMutable" o = MenuModelIsMutableMethodInfo
    ResolveMenuModelMethod "itemsChanged" o = MenuModelItemsChangedMethodInfo
    ResolveMenuModelMethod "iterateItemAttributes" o = MenuModelIterateItemAttributesMethodInfo
    ResolveMenuModelMethod "iterateItemLinks" o = MenuModelIterateItemLinksMethodInfo
    ResolveMenuModelMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveMenuModelMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveMenuModelMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveMenuModelMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveMenuModelMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveMenuModelMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveMenuModelMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveMenuModelMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveMenuModelMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveMenuModelMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveMenuModelMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveMenuModelMethod "getItemAttributeValue" o = MenuModelGetItemAttributeValueMethodInfo
    ResolveMenuModelMethod "getItemLink" o = MenuModelGetItemLinkMethodInfo
    ResolveMenuModelMethod "getNItems" o = MenuModelGetNItemsMethodInfo
    ResolveMenuModelMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveMenuModelMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveMenuModelMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveMenuModelMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveMenuModelMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveMenuModelMethod l o = O.MethodResolutionFailed l o

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

#endif

-- signal MenuModel::items-changed
-- | Emitted when a change has occured to the menu.
-- 
-- The only changes that can occur to a menu is that items are removed
-- or added.  Items may not change (except by being removed and added
-- back in the same location).  This signal is capable of describing
-- both of those changes (at the same time).
-- 
-- The signal means that starting at the index /@position@/, /@removed@/
-- items were removed and /@added@/ items were added in their place.  If
-- /@removed@/ is zero then only items were added.  If /@added@/ is zero
-- then only items were removed.
-- 
-- As an example, if the menu contains items a, b, c, d (in that
-- order) and the signal (2, 1, 3) occurs then the new composition of
-- the menu will be a, b, _, _, _, d (with each _ representing some
-- new item).
-- 
-- Signal handlers may query the model (particularly the added items)
-- and expect to see the results of the modification that is being
-- reported.  The signal is emitted after the modification.
type MenuModelItemsChangedCallback =
    Int32
    -- ^ /@position@/: the position of the change
    -> Int32
    -- ^ /@removed@/: the number of items removed
    -> Int32
    -- ^ /@added@/: the number of items added
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `MenuModelItemsChangedCallback`@.
noMenuModelItemsChangedCallback :: Maybe MenuModelItemsChangedCallback
noMenuModelItemsChangedCallback :: Maybe MenuModelItemsChangedCallback
noMenuModelItemsChangedCallback = Maybe MenuModelItemsChangedCallback
forall a. Maybe a
Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_MenuModelItemsChangedCallback =
    Ptr () ->                               -- object
    Int32 ->
    Int32 ->
    Int32 ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_MenuModelItemsChangedCallback`.
foreign import ccall "wrapper"
    mk_MenuModelItemsChangedCallback :: C_MenuModelItemsChangedCallback -> IO (FunPtr C_MenuModelItemsChangedCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_MenuModelItemsChanged :: MonadIO m => MenuModelItemsChangedCallback -> m (GClosure C_MenuModelItemsChangedCallback)
genClosure_MenuModelItemsChanged :: MenuModelItemsChangedCallback
-> m (GClosure C_MenuModelItemsChangedCallback)
genClosure_MenuModelItemsChanged cb :: MenuModelItemsChangedCallback
cb = IO (GClosure C_MenuModelItemsChangedCallback)
-> m (GClosure C_MenuModelItemsChangedCallback)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_MenuModelItemsChangedCallback)
 -> m (GClosure C_MenuModelItemsChangedCallback))
-> IO (GClosure C_MenuModelItemsChangedCallback)
-> m (GClosure C_MenuModelItemsChangedCallback)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_MenuModelItemsChangedCallback
cb' = MenuModelItemsChangedCallback -> C_MenuModelItemsChangedCallback
wrap_MenuModelItemsChangedCallback MenuModelItemsChangedCallback
cb
    C_MenuModelItemsChangedCallback
-> IO (FunPtr C_MenuModelItemsChangedCallback)
mk_MenuModelItemsChangedCallback C_MenuModelItemsChangedCallback
cb' IO (FunPtr C_MenuModelItemsChangedCallback)
-> (FunPtr C_MenuModelItemsChangedCallback
    -> IO (GClosure C_MenuModelItemsChangedCallback))
-> IO (GClosure C_MenuModelItemsChangedCallback)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_MenuModelItemsChangedCallback
-> IO (GClosure C_MenuModelItemsChangedCallback)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `MenuModelItemsChangedCallback` into a `C_MenuModelItemsChangedCallback`.
wrap_MenuModelItemsChangedCallback ::
    MenuModelItemsChangedCallback ->
    C_MenuModelItemsChangedCallback
wrap_MenuModelItemsChangedCallback :: MenuModelItemsChangedCallback -> C_MenuModelItemsChangedCallback
wrap_MenuModelItemsChangedCallback _cb :: MenuModelItemsChangedCallback
_cb _ position :: Int32
position removed :: Int32
removed added :: Int32
added _ = do
    MenuModelItemsChangedCallback
_cb  Int32
position Int32
removed Int32
added


-- | Connect a signal handler for the [itemsChanged](#signal:itemsChanged) signal, to be run before the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.on' menuModel #itemsChanged callback
-- @
-- 
-- 
onMenuModelItemsChanged :: (IsMenuModel a, MonadIO m) => a -> MenuModelItemsChangedCallback -> m SignalHandlerId
onMenuModelItemsChanged :: a -> MenuModelItemsChangedCallback -> m SignalHandlerId
onMenuModelItemsChanged obj :: a
obj cb :: MenuModelItemsChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_MenuModelItemsChangedCallback
cb' = MenuModelItemsChangedCallback -> C_MenuModelItemsChangedCallback
wrap_MenuModelItemsChangedCallback MenuModelItemsChangedCallback
cb
    FunPtr C_MenuModelItemsChangedCallback
cb'' <- C_MenuModelItemsChangedCallback
-> IO (FunPtr C_MenuModelItemsChangedCallback)
mk_MenuModelItemsChangedCallback C_MenuModelItemsChangedCallback
cb'
    a
-> Text
-> FunPtr C_MenuModelItemsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "items-changed" FunPtr C_MenuModelItemsChangedCallback
cb'' SignalConnectMode
SignalConnectBefore Maybe Text
forall a. Maybe a
Nothing

-- | Connect a signal handler for the [itemsChanged](#signal:itemsChanged) signal, to be run after the default handler.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Signals.after' menuModel #itemsChanged callback
-- @
-- 
-- 
afterMenuModelItemsChanged :: (IsMenuModel a, MonadIO m) => a -> MenuModelItemsChangedCallback -> m SignalHandlerId
afterMenuModelItemsChanged :: a -> MenuModelItemsChangedCallback -> m SignalHandlerId
afterMenuModelItemsChanged obj :: a
obj cb :: MenuModelItemsChangedCallback
cb = IO SignalHandlerId -> m SignalHandlerId
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO SignalHandlerId -> m SignalHandlerId)
-> IO SignalHandlerId -> m SignalHandlerId
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: C_MenuModelItemsChangedCallback
cb' = MenuModelItemsChangedCallback -> C_MenuModelItemsChangedCallback
wrap_MenuModelItemsChangedCallback MenuModelItemsChangedCallback
cb
    FunPtr C_MenuModelItemsChangedCallback
cb'' <- C_MenuModelItemsChangedCallback
-> IO (FunPtr C_MenuModelItemsChangedCallback)
mk_MenuModelItemsChangedCallback C_MenuModelItemsChangedCallback
cb'
    a
-> Text
-> FunPtr C_MenuModelItemsChangedCallback
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
forall o a.
GObject o =>
o
-> Text
-> FunPtr a
-> SignalConnectMode
-> Maybe Text
-> IO SignalHandlerId
connectSignalFunPtr a
obj "items-changed" FunPtr C_MenuModelItemsChangedCallback
cb'' SignalConnectMode
SignalConnectAfter Maybe Text
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
data MenuModelItemsChangedSignalInfo
instance SignalInfo MenuModelItemsChangedSignalInfo where
    type HaskellCallbackType MenuModelItemsChangedSignalInfo = MenuModelItemsChangedCallback
    connectSignal obj cb connectMode detail = do
        let cb' = wrap_MenuModelItemsChangedCallback cb
        cb'' <- mk_MenuModelItemsChangedCallback cb'
        connectSignalFunPtr obj "items-changed" cb'' connectMode detail

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList MenuModel
type instance O.AttributeList MenuModel = MenuModelAttributeList
type MenuModelAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList MenuModel = MenuModelSignalList
type MenuModelSignalList = ('[ '("itemsChanged", MenuModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method MenuModel::get_item_attribute_value
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_index"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index of the item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attribute"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the attribute to query"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "expected_type"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "VariantType" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the expected type of the attribute, or\n    %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_get_item_attribute_value" g_menu_model_get_item_attribute_value :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    Int32 ->                                -- item_index : TBasicType TInt
    CString ->                              -- attribute : TBasicType TUTF8
    Ptr GLib.VariantType.VariantType ->     -- expected_type : TInterface (Name {namespace = "GLib", name = "VariantType"})
    IO (Ptr GVariant)

-- | Queries the item at position /@itemIndex@/ in /@model@/ for the attribute
-- specified by /@attribute@/.
-- 
-- If /@expectedType@/ is non-'P.Nothing' then it specifies the expected type of
-- the attribute.  If it is 'P.Nothing' then any type will be accepted.
-- 
-- If the attribute exists and matches /@expectedType@/ (or if the
-- expected type is unspecified) then the value is returned.
-- 
-- If the attribute does not exist, or does not match the expected type
-- then 'P.Nothing' is returned.
-- 
-- /Since: 2.32/
menuModelGetItemAttributeValue ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> Int32
    -- ^ /@itemIndex@/: the index of the item
    -> T.Text
    -- ^ /@attribute@/: the attribute to query
    -> Maybe (GLib.VariantType.VariantType)
    -- ^ /@expectedType@/: the expected type of the attribute, or
    --     'P.Nothing'
    -> m GVariant
    -- ^ __Returns:__ the value of the attribute
menuModelGetItemAttributeValue :: a -> Int32 -> Text -> Maybe VariantType -> m GVariant
menuModelGetItemAttributeValue model :: a
model itemIndex :: Int32
itemIndex attribute :: Text
attribute expectedType :: Maybe VariantType
expectedType = IO GVariant -> m GVariant
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GVariant -> m GVariant) -> IO GVariant -> m GVariant
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    CString
attribute' <- Text -> IO CString
textToCString Text
attribute
    Ptr VariantType
maybeExpectedType <- case Maybe VariantType
expectedType of
        Nothing -> Ptr VariantType -> IO (Ptr VariantType)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr VariantType
forall a. Ptr a
nullPtr
        Just jExpectedType :: VariantType
jExpectedType -> do
            Ptr VariantType
jExpectedType' <- VariantType -> IO (Ptr VariantType)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr VariantType
jExpectedType
            Ptr VariantType -> IO (Ptr VariantType)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr VariantType
jExpectedType'
    Ptr GVariant
result <- Ptr MenuModel
-> Int32 -> CString -> Ptr VariantType -> IO (Ptr GVariant)
g_menu_model_get_item_attribute_value Ptr MenuModel
model' Int32
itemIndex CString
attribute' Ptr VariantType
maybeExpectedType
    Text -> Ptr GVariant -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "menuModelGetItemAttributeValue" Ptr GVariant
result
    GVariant
result' <- Ptr GVariant -> IO GVariant
B.GVariant.wrapGVariantPtr Ptr GVariant
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    Maybe VariantType -> (VariantType -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe VariantType
expectedType VariantType -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
attribute'
    GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result'

#if defined(ENABLE_OVERLOADING)
data MenuModelGetItemAttributeValueMethodInfo
instance (signature ~ (Int32 -> T.Text -> Maybe (GLib.VariantType.VariantType) -> m GVariant), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelGetItemAttributeValueMethodInfo a signature where
    overloadedMethod = menuModelGetItemAttributeValue

#endif

-- method MenuModel::get_item_link
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_index"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index of the item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "link"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the link to query" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gio" , name = "MenuModel" })
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_get_item_link" g_menu_model_get_item_link :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    Int32 ->                                -- item_index : TBasicType TInt
    CString ->                              -- link : TBasicType TUTF8
    IO (Ptr MenuModel)

-- | Queries the item at position /@itemIndex@/ in /@model@/ for the link
-- specified by /@link@/.
-- 
-- If the link exists, the linked t'GI.Gio.Objects.MenuModel.MenuModel' is returned.  If the link
-- does not exist, 'P.Nothing' is returned.
-- 
-- /Since: 2.32/
menuModelGetItemLink ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> Int32
    -- ^ /@itemIndex@/: the index of the item
    -> T.Text
    -- ^ /@link@/: the link to query
    -> m MenuModel
    -- ^ __Returns:__ the linked t'GI.Gio.Objects.MenuModel.MenuModel', or 'P.Nothing'
menuModelGetItemLink :: a -> Int32 -> Text -> m MenuModel
menuModelGetItemLink model :: a
model itemIndex :: Int32
itemIndex link :: Text
link = IO MenuModel -> m MenuModel
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MenuModel -> m MenuModel) -> IO MenuModel -> m MenuModel
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    CString
link' <- Text -> IO CString
textToCString Text
link
    Ptr MenuModel
result <- Ptr MenuModel -> Int32 -> CString -> IO (Ptr MenuModel)
g_menu_model_get_item_link Ptr MenuModel
model' Int32
itemIndex CString
link'
    Text -> Ptr MenuModel -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "menuModelGetItemLink" Ptr MenuModel
result
    MenuModel
result' <- ((ManagedPtr MenuModel -> MenuModel)
-> Ptr MenuModel -> IO MenuModel
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr MenuModel -> MenuModel
MenuModel) Ptr MenuModel
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
link'
    MenuModel -> IO MenuModel
forall (m :: * -> *) a. Monad m => a -> m a
return MenuModel
result'

#if defined(ENABLE_OVERLOADING)
data MenuModelGetItemLinkMethodInfo
instance (signature ~ (Int32 -> T.Text -> m MenuModel), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelGetItemLinkMethodInfo a signature where
    overloadedMethod = menuModelGetItemLink

#endif

-- method MenuModel::get_n_items
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_get_n_items" g_menu_model_get_n_items :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    IO Int32

-- | Query the number of items in /@model@/.
-- 
-- /Since: 2.32/
menuModelGetNItems ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> m Int32
    -- ^ __Returns:__ the number of items
menuModelGetNItems :: a -> m Int32
menuModelGetNItems model :: a
model = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    Int32
result <- Ptr MenuModel -> IO Int32
g_menu_model_get_n_items Ptr MenuModel
model'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result

#if defined(ENABLE_OVERLOADING)
data MenuModelGetNItemsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelGetNItemsMethodInfo a signature where
    overloadedMethod = menuModelGetNItems

#endif

-- method MenuModel::is_mutable
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_is_mutable" g_menu_model_is_mutable :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    IO CInt

-- | Queries if /@model@/ is mutable.
-- 
-- An immutable t'GI.Gio.Objects.MenuModel.MenuModel' will never emit the [itemsChanged]("GI.Gio.Objects.MenuModel#signal:itemsChanged")
-- signal. Consumers of the model may make optimisations accordingly.
-- 
-- /Since: 2.32/
menuModelIsMutable ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the model is mutable (ie: \"items-changed\" may be
    --     emitted).
menuModelIsMutable :: a -> m Bool
menuModelIsMutable model :: a
model = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    CInt
result <- Ptr MenuModel -> IO CInt
g_menu_model_is_mutable Ptr MenuModel
model'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data MenuModelIsMutableMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelIsMutableMethodInfo a signature where
    overloadedMethod = menuModelIsMutable

#endif

-- method MenuModel::items_changed
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "position"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the position of the change"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "removed"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of items removed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "added"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the number of items added"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_items_changed" g_menu_model_items_changed :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    Int32 ->                                -- position : TBasicType TInt
    Int32 ->                                -- removed : TBasicType TInt
    Int32 ->                                -- added : TBasicType TInt
    IO ()

-- | Requests emission of the [itemsChanged]("GI.Gio.Objects.MenuModel#signal:itemsChanged") signal on /@model@/.
-- 
-- This function should never be called except by t'GI.Gio.Objects.MenuModel.MenuModel'
-- subclasses.  Any other calls to this function will very likely lead
-- to a violation of the interface of the model.
-- 
-- The implementation should update its internal representation of the
-- menu before emitting the signal.  The implementation should further
-- expect to receive queries about the new state of the menu (and
-- particularly added menu items) while signal handlers are running.
-- 
-- The implementation must dispatch this call directly from a mainloop
-- entry and not in response to calls -- particularly those from the
-- t'GI.Gio.Objects.MenuModel.MenuModel' API.  Said another way: the menu must not change while
-- user code is running without returning to the mainloop.
-- 
-- /Since: 2.32/
menuModelItemsChanged ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> Int32
    -- ^ /@position@/: the position of the change
    -> Int32
    -- ^ /@removed@/: the number of items removed
    -> Int32
    -- ^ /@added@/: the number of items added
    -> m ()
menuModelItemsChanged :: a -> Int32 -> Int32 -> Int32 -> m ()
menuModelItemsChanged model :: a
model position :: Int32
position removed :: Int32
removed added :: Int32
added = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    Ptr MenuModel -> MenuModelItemsChangedCallback
g_menu_model_items_changed Ptr MenuModel
model' Int32
position Int32
removed Int32
added
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data MenuModelItemsChangedMethodInfo
instance (signature ~ (Int32 -> Int32 -> Int32 -> m ()), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelItemsChangedMethodInfo a signature where
    overloadedMethod = menuModelItemsChanged

#endif

-- method MenuModel::iterate_item_attributes
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_index"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index of the item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "Gio" , name = "MenuAttributeIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_iterate_item_attributes" g_menu_model_iterate_item_attributes :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    Int32 ->                                -- item_index : TBasicType TInt
    IO (Ptr Gio.MenuAttributeIter.MenuAttributeIter)

-- | Creates a t'GI.Gio.Objects.MenuAttributeIter.MenuAttributeIter' to iterate over the attributes of
-- the item at position /@itemIndex@/ in /@model@/.
-- 
-- You must free the iterator with 'GI.GObject.Objects.Object.objectUnref' when you are done.
-- 
-- /Since: 2.32/
menuModelIterateItemAttributes ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> Int32
    -- ^ /@itemIndex@/: the index of the item
    -> m Gio.MenuAttributeIter.MenuAttributeIter
    -- ^ __Returns:__ a new t'GI.Gio.Objects.MenuAttributeIter.MenuAttributeIter'
menuModelIterateItemAttributes :: a -> Int32 -> m MenuAttributeIter
menuModelIterateItemAttributes model :: a
model itemIndex :: Int32
itemIndex = IO MenuAttributeIter -> m MenuAttributeIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MenuAttributeIter -> m MenuAttributeIter)
-> IO MenuAttributeIter -> m MenuAttributeIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    Ptr MenuAttributeIter
result <- Ptr MenuModel -> Int32 -> IO (Ptr MenuAttributeIter)
g_menu_model_iterate_item_attributes Ptr MenuModel
model' Int32
itemIndex
    Text -> Ptr MenuAttributeIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "menuModelIterateItemAttributes" Ptr MenuAttributeIter
result
    MenuAttributeIter
result' <- ((ManagedPtr MenuAttributeIter -> MenuAttributeIter)
-> Ptr MenuAttributeIter -> IO MenuAttributeIter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr MenuAttributeIter -> MenuAttributeIter
Gio.MenuAttributeIter.MenuAttributeIter) Ptr MenuAttributeIter
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    MenuAttributeIter -> IO MenuAttributeIter
forall (m :: * -> *) a. Monad m => a -> m a
return MenuAttributeIter
result'

#if defined(ENABLE_OVERLOADING)
data MenuModelIterateItemAttributesMethodInfo
instance (signature ~ (Int32 -> m Gio.MenuAttributeIter.MenuAttributeIter), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelIterateItemAttributesMethodInfo a signature where
    overloadedMethod = menuModelIterateItemAttributes

#endif

-- method MenuModel::iterate_item_links
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "model"
--           , argType =
--               TInterface Name { namespace = "Gio" , name = "MenuModel" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GMenuModel" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_index"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the index of the item"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gio" , name = "MenuLinkIter" })
-- throws : False
-- Skip return : False

foreign import ccall "g_menu_model_iterate_item_links" g_menu_model_iterate_item_links :: 
    Ptr MenuModel ->                        -- model : TInterface (Name {namespace = "Gio", name = "MenuModel"})
    Int32 ->                                -- item_index : TBasicType TInt
    IO (Ptr Gio.MenuLinkIter.MenuLinkIter)

-- | Creates a t'GI.Gio.Objects.MenuLinkIter.MenuLinkIter' to iterate over the links of the item at
-- position /@itemIndex@/ in /@model@/.
-- 
-- You must free the iterator with 'GI.GObject.Objects.Object.objectUnref' when you are done.
-- 
-- /Since: 2.32/
menuModelIterateItemLinks ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuModel a) =>
    a
    -- ^ /@model@/: a t'GI.Gio.Objects.MenuModel.MenuModel'
    -> Int32
    -- ^ /@itemIndex@/: the index of the item
    -> m Gio.MenuLinkIter.MenuLinkIter
    -- ^ __Returns:__ a new t'GI.Gio.Objects.MenuLinkIter.MenuLinkIter'
menuModelIterateItemLinks :: a -> Int32 -> m MenuLinkIter
menuModelIterateItemLinks model :: a
model itemIndex :: Int32
itemIndex = IO MenuLinkIter -> m MenuLinkIter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MenuLinkIter -> m MenuLinkIter)
-> IO MenuLinkIter -> m MenuLinkIter
forall a b. (a -> b) -> a -> b
$ do
    Ptr MenuModel
model' <- a -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
model
    Ptr MenuLinkIter
result <- Ptr MenuModel -> Int32 -> IO (Ptr MenuLinkIter)
g_menu_model_iterate_item_links Ptr MenuModel
model' Int32
itemIndex
    Text -> Ptr MenuLinkIter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "menuModelIterateItemLinks" Ptr MenuLinkIter
result
    MenuLinkIter
result' <- ((ManagedPtr MenuLinkIter -> MenuLinkIter)
-> Ptr MenuLinkIter -> IO MenuLinkIter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr MenuLinkIter -> MenuLinkIter
Gio.MenuLinkIter.MenuLinkIter) Ptr MenuLinkIter
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
model
    MenuLinkIter -> IO MenuLinkIter
forall (m :: * -> *) a. Monad m => a -> m a
return MenuLinkIter
result'

#if defined(ENABLE_OVERLOADING)
data MenuModelIterateItemLinksMethodInfo
instance (signature ~ (Int32 -> m Gio.MenuLinkIter.MenuLinkIter), MonadIO m, IsMenuModel a) => O.MethodInfo MenuModelIterateItemLinksMethodInfo a signature where
    overloadedMethod = menuModelIterateItemLinks

#endif