{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

A 'GI.Gtk.Objects.UIManager.UIManager' constructs a user interface (menus and toolbars) from
one or more UI definitions, which reference actions from one or more
action groups.

# UI Definitions # {@/XML/@-UI}

The UI definitions are specified in an XML format which can be
roughly described by the following DTD.

> Do not confuse the GtkUIManager UI Definitions described here with
> the similarly named [GtkBuilder UI Definitions][BUILDER-UI].

>
><!ELEMENT ui          (menubar|toolbar|popup|accelerator)* >
><!ELEMENT menubar     (menuitem|separator|placeholder|menu)* >
><!ELEMENT menu        (menuitem|separator|placeholder|menu)* >
><!ELEMENT popup       (menuitem|separator|placeholder|menu)* >
><!ELEMENT toolbar     (toolitem|separator|placeholder)* >
><!ELEMENT placeholder (menuitem|toolitem|separator|placeholder|menu)* >
><!ELEMENT menuitem     EMPTY >
><!ELEMENT toolitem     (menu?) >
><!ELEMENT separator    EMPTY >
><!ELEMENT accelerator  EMPTY >
><!ATTLIST menubar      name                      #IMPLIED
>                       action                    #IMPLIED >
><!ATTLIST toolbar      name                      #IMPLIED
>                       action                    #IMPLIED >
><!ATTLIST popup        name                      #IMPLIED
>                       action                    #IMPLIED
>                       accelerators (true|false) #IMPLIED >
><!ATTLIST placeholder  name                      #IMPLIED
>                       action                    #IMPLIED >
><!ATTLIST separator    name                      #IMPLIED
>                       action                    #IMPLIED
>                       expand       (true|false) #IMPLIED >
><!ATTLIST menu         name                      #IMPLIED
>                       action                    #REQUIRED
>                       position     (top|bot)    #IMPLIED >
><!ATTLIST menuitem     name                      #IMPLIED
>                       action                    #REQUIRED
>                       position     (top|bot)    #IMPLIED
>                       always-show-image (true|false) #IMPLIED >
><!ATTLIST toolitem     name                      #IMPLIED
>                       action                    #REQUIRED
>                       position     (top|bot)    #IMPLIED >
><!ATTLIST accelerator  name                      #IMPLIED
>                       action                    #REQUIRED >


There are some additional restrictions beyond those specified in the
DTD, e.g. every toolitem must have a toolbar in its anchestry and
every menuitem must have a menubar or popup in its anchestry. Since
a 'GI.GLib.Structs.MarkupParser.MarkupParser' is used to parse the UI description, it must not only
be valid XML, but valid markup.

If a name is not specified, it defaults to the action. If an action is
not specified either, the element name is used. The name and action
attributes must not contain “\/” characters after parsing (since that
would mess up path lookup) and must be usable as XML attributes when
enclosed in doublequotes, thus they must not “\"” characters or references
to the &quot; entity.

= A UI definition 

>
><ui>
>  <menubar>
>    <menu name="FileMenu" action="FileMenuAction">
>      <menuitem name="New" action="New2Action" />
>      <placeholder name="FileMenuAdditions" />
>    </menu>
>    <menu name="JustifyMenu" action="JustifyMenuAction">
>      <menuitem name="Left" action="justify-left"/>
>      <menuitem name="Centre" action="justify-center"/>
>      <menuitem name="Right" action="justify-right"/>
>      <menuitem name="Fill" action="justify-fill"/>
>    </menu>
>  </menubar>
>  <toolbar action="toolbar1">
>    <placeholder name="JustifyToolItems">
>      <separator/>
>      <toolitem name="Left" action="justify-left"/>
>      <toolitem name="Centre" action="justify-center"/>
>      <toolitem name="Right" action="justify-right"/>
>      <toolitem name="Fill" action="justify-fill"/>
>      <separator/>
>    </placeholder>
>  </toolbar>
></ui>


The constructed widget hierarchy is very similar to the element tree
of the XML, with the exception that placeholders are merged into their
parents. The correspondence of XML elements to widgets should be
almost obvious:

* menubar


   a 'GI.Gtk.Objects.MenuBar.MenuBar'

* toolbar


   a 'GI.Gtk.Objects.Toolbar.Toolbar'

* popup


   a toplevel 'GI.Gtk.Objects.Menu.Menu'

* menu


   a 'GI.Gtk.Objects.Menu.Menu' attached to a menuitem

* menuitem


   a 'GI.Gtk.Objects.MenuItem.MenuItem' subclass, the exact type depends on the action

* toolitem


   a 'GI.Gtk.Objects.ToolItem.ToolItem' subclass, the exact type depends on the
   action. Note that toolitem elements may contain a menu element,
   but only if their associated action specifies a
   'GI.Gtk.Objects.MenuToolButton.MenuToolButton' as proxy.

* separator


   a 'GI.Gtk.Objects.SeparatorMenuItem.SeparatorMenuItem' or 'GI.Gtk.Objects.SeparatorToolItem.SeparatorToolItem'

* accelerator


   a keyboard accelerator

The “position” attribute determines where a constructed widget is positioned
wrt. to its siblings in the partially constructed tree. If it is
“top”, the widget is prepended, otherwise it is appended.

# UI Merging # {@/UI/@-Merging}

The most remarkable feature of 'GI.Gtk.Objects.UIManager.UIManager' is that it can overlay a set
of menuitems and toolitems over another one, and demerge them later.

Merging is done based on the names of the XML elements. Each element is
identified by a path which consists of the names of its anchestors, separated
by slashes. For example, the menuitem named “Left” in the example above
has the path @\/ui\/menubar\/JustifyMenu\/Left@ and the
toolitem with the same name has path
@\/ui\/toolbar1\/JustifyToolItems\/Left@.

= Accelerators 

Every action has an accelerator path. Accelerators are installed together
with menuitem proxies, but they can also be explicitly added with
\<accelerator> elements in the UI definition. This makes it possible to
have accelerators for actions even if they have no visible proxies.

# Smart Separators # {@/Smart/@-Separators}

The separators created by 'GI.Gtk.Objects.UIManager.UIManager' are “smart”, i.e. they do not show up
in the UI unless they end up between two visible menu or tool items. Separators
which are located at the very beginning or end of the menu or toolbar
containing them, or multiple separators next to each other, are hidden. This
is a useful feature, since the merging of UI elements from multiple sources
can make it hard or impossible to determine in advance whether a separator
will end up in such an unfortunate position.

For separators in toolbars, you can set @expand=\"true\"@ to
turn them from a small, visible separator to an expanding, invisible one.
Toolitems following an expanding separator are effectively right-aligned.

= Empty Menus

Submenus pose similar problems to separators inconnection with merging. It is
impossible to know in advance whether they will end up empty after merging.
'GI.Gtk.Objects.UIManager.UIManager' offers two ways to treat empty submenus:

* make them disappear by hiding the menu item they’re attached to
* add an insensitive “Empty” item


The behaviour is chosen based on the “hide_if_empty” property of the action
to which the submenu is associated.

# GtkUIManager as GtkBuildable # {'GI.Gtk.Objects.UIManager.UIManager'-BUILDER-UI}

The GtkUIManager implementation of the GtkBuildable interface accepts
GtkActionGroup objects as \<child> elements in UI definitions.

A GtkUIManager UI definition as described above can be embedded in
an GtkUIManager \<object> element in a GtkBuilder UI definition.

The widgets that are constructed by a GtkUIManager can be embedded in
other parts of the constructed user interface with the help of the
“constructor” attribute. See the example below.

== An embedded GtkUIManager UI definition

>
><object class="GtkUIManager" id="uiman">
>  <child>
>    <object class="GtkActionGroup" id="actiongroup">
>      <child>
>        <object class="GtkAction" id="file">
>          <property name="label">_File</property>
>        </object>
>      </child>
>    </object>
>  </child>
>  <ui>
>    <menubar name="menubar1">
>      <menu action="file">
>      </menu>
>    </menubar>
>  </ui>
></object>
><object class="GtkWindow" id="main-window">
>  <child>
>    <object class="GtkMenuBar" id="menubar1" constructor="uiman"/>
>  </child>
></object>

-}

module GI.Gtk.Objects.UIManager
    ( 

-- * Exported types
    UIManager(..)                           ,
    IsUIManager                             ,
    toUIManager                             ,
    noUIManager                             ,


 -- * Methods
-- ** addUi #method:addUi#
    UIManagerAddUiMethodInfo                ,
    uIManagerAddUi                          ,


-- ** addUiFromFile #method:addUiFromFile#
    UIManagerAddUiFromFileMethodInfo        ,
    uIManagerAddUiFromFile                  ,


-- ** addUiFromResource #method:addUiFromResource#
    UIManagerAddUiFromResourceMethodInfo    ,
    uIManagerAddUiFromResource              ,


-- ** addUiFromString #method:addUiFromString#
    UIManagerAddUiFromStringMethodInfo      ,
    uIManagerAddUiFromString                ,


-- ** ensureUpdate #method:ensureUpdate#
    UIManagerEnsureUpdateMethodInfo         ,
    uIManagerEnsureUpdate                   ,


-- ** getAccelGroup #method:getAccelGroup#
    UIManagerGetAccelGroupMethodInfo        ,
    uIManagerGetAccelGroup                  ,


-- ** getAction #method:getAction#
    UIManagerGetActionMethodInfo            ,
    uIManagerGetAction                      ,


-- ** getActionGroups #method:getActionGroups#
    UIManagerGetActionGroupsMethodInfo      ,
    uIManagerGetActionGroups                ,


-- ** getAddTearoffs #method:getAddTearoffs#
    UIManagerGetAddTearoffsMethodInfo       ,
    uIManagerGetAddTearoffs                 ,


-- ** getToplevels #method:getToplevels#
    UIManagerGetToplevelsMethodInfo         ,
    uIManagerGetToplevels                   ,


-- ** getUi #method:getUi#
    UIManagerGetUiMethodInfo                ,
    uIManagerGetUi                          ,


-- ** getWidget #method:getWidget#
    UIManagerGetWidgetMethodInfo            ,
    uIManagerGetWidget                      ,


-- ** insertActionGroup #method:insertActionGroup#
    UIManagerInsertActionGroupMethodInfo    ,
    uIManagerInsertActionGroup              ,


-- ** new #method:new#
    uIManagerNew                            ,


-- ** newMergeId #method:newMergeId#
    UIManagerNewMergeIdMethodInfo           ,
    uIManagerNewMergeId                     ,


-- ** removeActionGroup #method:removeActionGroup#
    UIManagerRemoveActionGroupMethodInfo    ,
    uIManagerRemoveActionGroup              ,


-- ** removeUi #method:removeUi#
    UIManagerRemoveUiMethodInfo             ,
    uIManagerRemoveUi                       ,


-- ** setAddTearoffs #method:setAddTearoffs#
    UIManagerSetAddTearoffsMethodInfo       ,
    uIManagerSetAddTearoffs                 ,




 -- * Properties
-- ** addTearoffs #attr:addTearoffs#
    UIManagerAddTearoffsPropertyInfo        ,
    constructUIManagerAddTearoffs           ,
    getUIManagerAddTearoffs                 ,
    setUIManagerAddTearoffs                 ,
    uIManagerAddTearoffs                    ,


-- ** ui #attr:ui#
    UIManagerUiPropertyInfo                 ,
    getUIManagerUi                          ,
    uIManagerUi                             ,




 -- * Signals
-- ** actionsChanged #signal:actionsChanged#
    C_UIManagerActionsChangedCallback       ,
    UIManagerActionsChangedCallback         ,
    UIManagerActionsChangedSignalInfo       ,
    afterUIManagerActionsChanged            ,
    genClosure_UIManagerActionsChanged      ,
    mk_UIManagerActionsChangedCallback      ,
    noUIManagerActionsChangedCallback       ,
    onUIManagerActionsChanged               ,
    wrap_UIManagerActionsChangedCallback    ,


-- ** addWidget #signal:addWidget#
    C_UIManagerAddWidgetCallback            ,
    UIManagerAddWidgetCallback              ,
    UIManagerAddWidgetSignalInfo            ,
    afterUIManagerAddWidget                 ,
    genClosure_UIManagerAddWidget           ,
    mk_UIManagerAddWidgetCallback           ,
    noUIManagerAddWidgetCallback            ,
    onUIManagerAddWidget                    ,
    wrap_UIManagerAddWidgetCallback         ,


-- ** connectProxy #signal:connectProxy#
    C_UIManagerConnectProxyCallback         ,
    UIManagerConnectProxyCallback           ,
    UIManagerConnectProxySignalInfo         ,
    afterUIManagerConnectProxy              ,
    genClosure_UIManagerConnectProxy        ,
    mk_UIManagerConnectProxyCallback        ,
    noUIManagerConnectProxyCallback         ,
    onUIManagerConnectProxy                 ,
    wrap_UIManagerConnectProxyCallback      ,


-- ** disconnectProxy #signal:disconnectProxy#
    C_UIManagerDisconnectProxyCallback      ,
    UIManagerDisconnectProxyCallback        ,
    UIManagerDisconnectProxySignalInfo      ,
    afterUIManagerDisconnectProxy           ,
    genClosure_UIManagerDisconnectProxy     ,
    mk_UIManagerDisconnectProxyCallback     ,
    noUIManagerDisconnectProxyCallback      ,
    onUIManagerDisconnectProxy              ,
    wrap_UIManagerDisconnectProxyCallback   ,


-- ** postActivate #signal:postActivate#
    C_UIManagerPostActivateCallback         ,
    UIManagerPostActivateCallback           ,
    UIManagerPostActivateSignalInfo         ,
    afterUIManagerPostActivate              ,
    genClosure_UIManagerPostActivate        ,
    mk_UIManagerPostActivateCallback        ,
    noUIManagerPostActivateCallback         ,
    onUIManagerPostActivate                 ,
    wrap_UIManagerPostActivateCallback      ,


-- ** preActivate #signal:preActivate#
    C_UIManagerPreActivateCallback          ,
    UIManagerPreActivateCallback            ,
    UIManagerPreActivateSignalInfo          ,
    afterUIManagerPreActivate               ,
    genClosure_UIManagerPreActivate         ,
    mk_UIManagerPreActivateCallback         ,
    noUIManagerPreActivateCallback          ,
    onUIManagerPreActivate                  ,
    wrap_UIManagerPreActivateCallback       ,




    ) 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.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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Flags as Gtk.Flags
import {-# SOURCE #-} qualified GI.Gtk.Interfaces.Buildable as Gtk.Buildable
import {-# SOURCE #-} qualified GI.Gtk.Objects.AccelGroup as Gtk.AccelGroup
import {-# SOURCE #-} qualified GI.Gtk.Objects.Action as Gtk.Action
import {-# SOURCE #-} qualified GI.Gtk.Objects.ActionGroup as Gtk.ActionGroup
import {-# SOURCE #-} qualified GI.Gtk.Objects.Widget as Gtk.Widget

newtype UIManager = UIManager (ManagedPtr UIManager)
foreign import ccall "gtk_ui_manager_get_type"
    c_gtk_ui_manager_get_type :: IO GType

instance GObject UIManager where
    gobjectType _ = c_gtk_ui_manager_get_type
    

class GObject o => IsUIManager o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError UIManager a) =>
    IsUIManager a
#endif
instance IsUIManager UIManager
instance GObject.Object.IsObject UIManager
instance Gtk.Buildable.IsBuildable UIManager

toUIManager :: IsUIManager o => o -> IO UIManager
toUIManager = unsafeCastTo UIManager

noUIManager :: Maybe UIManager
noUIManager = Nothing

type family ResolveUIManagerMethod (t :: Symbol) (o :: *) :: * where
    ResolveUIManagerMethod "addChild" o = Gtk.Buildable.BuildableAddChildMethodInfo
    ResolveUIManagerMethod "addUi" o = UIManagerAddUiMethodInfo
    ResolveUIManagerMethod "addUiFromFile" o = UIManagerAddUiFromFileMethodInfo
    ResolveUIManagerMethod "addUiFromResource" o = UIManagerAddUiFromResourceMethodInfo
    ResolveUIManagerMethod "addUiFromString" o = UIManagerAddUiFromStringMethodInfo
    ResolveUIManagerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveUIManagerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveUIManagerMethod "constructChild" o = Gtk.Buildable.BuildableConstructChildMethodInfo
    ResolveUIManagerMethod "customFinished" o = Gtk.Buildable.BuildableCustomFinishedMethodInfo
    ResolveUIManagerMethod "customTagEnd" o = Gtk.Buildable.BuildableCustomTagEndMethodInfo
    ResolveUIManagerMethod "customTagStart" o = Gtk.Buildable.BuildableCustomTagStartMethodInfo
    ResolveUIManagerMethod "ensureUpdate" o = UIManagerEnsureUpdateMethodInfo
    ResolveUIManagerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveUIManagerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveUIManagerMethod "insertActionGroup" o = UIManagerInsertActionGroupMethodInfo
    ResolveUIManagerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveUIManagerMethod "newMergeId" o = UIManagerNewMergeIdMethodInfo
    ResolveUIManagerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveUIManagerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveUIManagerMethod "parserFinished" o = Gtk.Buildable.BuildableParserFinishedMethodInfo
    ResolveUIManagerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveUIManagerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveUIManagerMethod "removeActionGroup" o = UIManagerRemoveActionGroupMethodInfo
    ResolveUIManagerMethod "removeUi" o = UIManagerRemoveUiMethodInfo
    ResolveUIManagerMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveUIManagerMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveUIManagerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveUIManagerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveUIManagerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveUIManagerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveUIManagerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveUIManagerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveUIManagerMethod "getAccelGroup" o = UIManagerGetAccelGroupMethodInfo
    ResolveUIManagerMethod "getAction" o = UIManagerGetActionMethodInfo
    ResolveUIManagerMethod "getActionGroups" o = UIManagerGetActionGroupsMethodInfo
    ResolveUIManagerMethod "getAddTearoffs" o = UIManagerGetAddTearoffsMethodInfo
    ResolveUIManagerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveUIManagerMethod "getInternalChild" o = Gtk.Buildable.BuildableGetInternalChildMethodInfo
    ResolveUIManagerMethod "getName" o = Gtk.Buildable.BuildableGetNameMethodInfo
    ResolveUIManagerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveUIManagerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveUIManagerMethod "getToplevels" o = UIManagerGetToplevelsMethodInfo
    ResolveUIManagerMethod "getUi" o = UIManagerGetUiMethodInfo
    ResolveUIManagerMethod "getWidget" o = UIManagerGetWidgetMethodInfo
    ResolveUIManagerMethod "setAddTearoffs" o = UIManagerSetAddTearoffsMethodInfo
    ResolveUIManagerMethod "setBuildableProperty" o = Gtk.Buildable.BuildableSetBuildablePropertyMethodInfo
    ResolveUIManagerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveUIManagerMethod "setName" o = Gtk.Buildable.BuildableSetNameMethodInfo
    ResolveUIManagerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveUIManagerMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveUIManagerMethod t UIManager, O.MethodInfo info UIManager p) => O.IsLabelProxy t (UIManager -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveUIManagerMethod t UIManager, O.MethodInfo info UIManager p) => O.IsLabel t (UIManager -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- signal UIManager::actions-changed
{-# DEPRECATED UIManagerActionsChangedCallback ["(Since version 3.10)"] #-}
type UIManagerActionsChangedCallback =
    IO ()

noUIManagerActionsChangedCallback :: Maybe UIManagerActionsChangedCallback
noUIManagerActionsChangedCallback = Nothing

type C_UIManagerActionsChangedCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_UIManagerActionsChangedCallback :: C_UIManagerActionsChangedCallback -> IO (FunPtr C_UIManagerActionsChangedCallback)

genClosure_UIManagerActionsChanged :: UIManagerActionsChangedCallback -> IO Closure
genClosure_UIManagerActionsChanged cb = do
    let cb' = wrap_UIManagerActionsChangedCallback cb
    mk_UIManagerActionsChangedCallback cb' >>= newCClosure


wrap_UIManagerActionsChangedCallback ::
    UIManagerActionsChangedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_UIManagerActionsChangedCallback _cb _ _ = do
    _cb 


onUIManagerActionsChanged :: (GObject a, MonadIO m) => a -> UIManagerActionsChangedCallback -> m SignalHandlerId
onUIManagerActionsChanged obj cb = liftIO $ connectUIManagerActionsChanged obj cb SignalConnectBefore
afterUIManagerActionsChanged :: (GObject a, MonadIO m) => a -> UIManagerActionsChangedCallback -> m SignalHandlerId
afterUIManagerActionsChanged obj cb = connectUIManagerActionsChanged obj cb SignalConnectAfter

connectUIManagerActionsChanged :: (GObject a, MonadIO m) =>
                                  a -> UIManagerActionsChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectUIManagerActionsChanged obj cb after = liftIO $ do
    let cb' = wrap_UIManagerActionsChangedCallback cb
    cb'' <- mk_UIManagerActionsChangedCallback cb'
    connectSignalFunPtr obj "actions-changed" cb'' after

-- signal UIManager::add-widget
{-# DEPRECATED UIManagerAddWidgetCallback ["(Since version 3.10)"] #-}
type UIManagerAddWidgetCallback =
    Gtk.Widget.Widget ->
    IO ()

noUIManagerAddWidgetCallback :: Maybe UIManagerAddWidgetCallback
noUIManagerAddWidgetCallback = Nothing

type C_UIManagerAddWidgetCallback =
    Ptr () ->                               -- object
    Ptr Gtk.Widget.Widget ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_UIManagerAddWidgetCallback :: C_UIManagerAddWidgetCallback -> IO (FunPtr C_UIManagerAddWidgetCallback)

genClosure_UIManagerAddWidget :: UIManagerAddWidgetCallback -> IO Closure
genClosure_UIManagerAddWidget cb = do
    let cb' = wrap_UIManagerAddWidgetCallback cb
    mk_UIManagerAddWidgetCallback cb' >>= newCClosure


wrap_UIManagerAddWidgetCallback ::
    UIManagerAddWidgetCallback ->
    Ptr () ->
    Ptr Gtk.Widget.Widget ->
    Ptr () ->
    IO ()
wrap_UIManagerAddWidgetCallback _cb _ widget _ = do
    widget' <- (newObject Gtk.Widget.Widget) widget
    _cb  widget'


onUIManagerAddWidget :: (GObject a, MonadIO m) => a -> UIManagerAddWidgetCallback -> m SignalHandlerId
onUIManagerAddWidget obj cb = liftIO $ connectUIManagerAddWidget obj cb SignalConnectBefore
afterUIManagerAddWidget :: (GObject a, MonadIO m) => a -> UIManagerAddWidgetCallback -> m SignalHandlerId
afterUIManagerAddWidget obj cb = connectUIManagerAddWidget obj cb SignalConnectAfter

connectUIManagerAddWidget :: (GObject a, MonadIO m) =>
                             a -> UIManagerAddWidgetCallback -> SignalConnectMode -> m SignalHandlerId
connectUIManagerAddWidget obj cb after = liftIO $ do
    let cb' = wrap_UIManagerAddWidgetCallback cb
    cb'' <- mk_UIManagerAddWidgetCallback cb'
    connectSignalFunPtr obj "add-widget" cb'' after

-- signal UIManager::connect-proxy
{-# DEPRECATED UIManagerConnectProxyCallback ["(Since version 3.10)"] #-}
type UIManagerConnectProxyCallback =
    Gtk.Action.Action ->
    Gtk.Widget.Widget ->
    IO ()

noUIManagerConnectProxyCallback :: Maybe UIManagerConnectProxyCallback
noUIManagerConnectProxyCallback = Nothing

type C_UIManagerConnectProxyCallback =
    Ptr () ->                               -- object
    Ptr Gtk.Action.Action ->
    Ptr Gtk.Widget.Widget ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_UIManagerConnectProxyCallback :: C_UIManagerConnectProxyCallback -> IO (FunPtr C_UIManagerConnectProxyCallback)

genClosure_UIManagerConnectProxy :: UIManagerConnectProxyCallback -> IO Closure
genClosure_UIManagerConnectProxy cb = do
    let cb' = wrap_UIManagerConnectProxyCallback cb
    mk_UIManagerConnectProxyCallback cb' >>= newCClosure


wrap_UIManagerConnectProxyCallback ::
    UIManagerConnectProxyCallback ->
    Ptr () ->
    Ptr Gtk.Action.Action ->
    Ptr Gtk.Widget.Widget ->
    Ptr () ->
    IO ()
wrap_UIManagerConnectProxyCallback _cb _ action proxy _ = do
    action' <- (newObject Gtk.Action.Action) action
    proxy' <- (newObject Gtk.Widget.Widget) proxy
    _cb  action' proxy'


onUIManagerConnectProxy :: (GObject a, MonadIO m) => a -> UIManagerConnectProxyCallback -> m SignalHandlerId
onUIManagerConnectProxy obj cb = liftIO $ connectUIManagerConnectProxy obj cb SignalConnectBefore
afterUIManagerConnectProxy :: (GObject a, MonadIO m) => a -> UIManagerConnectProxyCallback -> m SignalHandlerId
afterUIManagerConnectProxy obj cb = connectUIManagerConnectProxy obj cb SignalConnectAfter

connectUIManagerConnectProxy :: (GObject a, MonadIO m) =>
                                a -> UIManagerConnectProxyCallback -> SignalConnectMode -> m SignalHandlerId
connectUIManagerConnectProxy obj cb after = liftIO $ do
    let cb' = wrap_UIManagerConnectProxyCallback cb
    cb'' <- mk_UIManagerConnectProxyCallback cb'
    connectSignalFunPtr obj "connect-proxy" cb'' after

-- signal UIManager::disconnect-proxy
{-# DEPRECATED UIManagerDisconnectProxyCallback ["(Since version 3.10)"] #-}
type UIManagerDisconnectProxyCallback =
    Gtk.Action.Action ->
    Gtk.Widget.Widget ->
    IO ()

noUIManagerDisconnectProxyCallback :: Maybe UIManagerDisconnectProxyCallback
noUIManagerDisconnectProxyCallback = Nothing

type C_UIManagerDisconnectProxyCallback =
    Ptr () ->                               -- object
    Ptr Gtk.Action.Action ->
    Ptr Gtk.Widget.Widget ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_UIManagerDisconnectProxyCallback :: C_UIManagerDisconnectProxyCallback -> IO (FunPtr C_UIManagerDisconnectProxyCallback)

genClosure_UIManagerDisconnectProxy :: UIManagerDisconnectProxyCallback -> IO Closure
genClosure_UIManagerDisconnectProxy cb = do
    let cb' = wrap_UIManagerDisconnectProxyCallback cb
    mk_UIManagerDisconnectProxyCallback cb' >>= newCClosure


wrap_UIManagerDisconnectProxyCallback ::
    UIManagerDisconnectProxyCallback ->
    Ptr () ->
    Ptr Gtk.Action.Action ->
    Ptr Gtk.Widget.Widget ->
    Ptr () ->
    IO ()
wrap_UIManagerDisconnectProxyCallback _cb _ action proxy _ = do
    action' <- (newObject Gtk.Action.Action) action
    proxy' <- (newObject Gtk.Widget.Widget) proxy
    _cb  action' proxy'


onUIManagerDisconnectProxy :: (GObject a, MonadIO m) => a -> UIManagerDisconnectProxyCallback -> m SignalHandlerId
onUIManagerDisconnectProxy obj cb = liftIO $ connectUIManagerDisconnectProxy obj cb SignalConnectBefore
afterUIManagerDisconnectProxy :: (GObject a, MonadIO m) => a -> UIManagerDisconnectProxyCallback -> m SignalHandlerId
afterUIManagerDisconnectProxy obj cb = connectUIManagerDisconnectProxy obj cb SignalConnectAfter

connectUIManagerDisconnectProxy :: (GObject a, MonadIO m) =>
                                   a -> UIManagerDisconnectProxyCallback -> SignalConnectMode -> m SignalHandlerId
connectUIManagerDisconnectProxy obj cb after = liftIO $ do
    let cb' = wrap_UIManagerDisconnectProxyCallback cb
    cb'' <- mk_UIManagerDisconnectProxyCallback cb'
    connectSignalFunPtr obj "disconnect-proxy" cb'' after

-- signal UIManager::post-activate
{-# DEPRECATED UIManagerPostActivateCallback ["(Since version 3.10)"] #-}
type UIManagerPostActivateCallback =
    Gtk.Action.Action ->
    IO ()

noUIManagerPostActivateCallback :: Maybe UIManagerPostActivateCallback
noUIManagerPostActivateCallback = Nothing

type C_UIManagerPostActivateCallback =
    Ptr () ->                               -- object
    Ptr Gtk.Action.Action ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_UIManagerPostActivateCallback :: C_UIManagerPostActivateCallback -> IO (FunPtr C_UIManagerPostActivateCallback)

genClosure_UIManagerPostActivate :: UIManagerPostActivateCallback -> IO Closure
genClosure_UIManagerPostActivate cb = do
    let cb' = wrap_UIManagerPostActivateCallback cb
    mk_UIManagerPostActivateCallback cb' >>= newCClosure


wrap_UIManagerPostActivateCallback ::
    UIManagerPostActivateCallback ->
    Ptr () ->
    Ptr Gtk.Action.Action ->
    Ptr () ->
    IO ()
wrap_UIManagerPostActivateCallback _cb _ action _ = do
    action' <- (newObject Gtk.Action.Action) action
    _cb  action'


onUIManagerPostActivate :: (GObject a, MonadIO m) => a -> UIManagerPostActivateCallback -> m SignalHandlerId
onUIManagerPostActivate obj cb = liftIO $ connectUIManagerPostActivate obj cb SignalConnectBefore
afterUIManagerPostActivate :: (GObject a, MonadIO m) => a -> UIManagerPostActivateCallback -> m SignalHandlerId
afterUIManagerPostActivate obj cb = connectUIManagerPostActivate obj cb SignalConnectAfter

connectUIManagerPostActivate :: (GObject a, MonadIO m) =>
                                a -> UIManagerPostActivateCallback -> SignalConnectMode -> m SignalHandlerId
connectUIManagerPostActivate obj cb after = liftIO $ do
    let cb' = wrap_UIManagerPostActivateCallback cb
    cb'' <- mk_UIManagerPostActivateCallback cb'
    connectSignalFunPtr obj "post-activate" cb'' after

-- signal UIManager::pre-activate
{-# DEPRECATED UIManagerPreActivateCallback ["(Since version 3.10)"] #-}
type UIManagerPreActivateCallback =
    Gtk.Action.Action ->
    IO ()

noUIManagerPreActivateCallback :: Maybe UIManagerPreActivateCallback
noUIManagerPreActivateCallback = Nothing

type C_UIManagerPreActivateCallback =
    Ptr () ->                               -- object
    Ptr Gtk.Action.Action ->
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_UIManagerPreActivateCallback :: C_UIManagerPreActivateCallback -> IO (FunPtr C_UIManagerPreActivateCallback)

genClosure_UIManagerPreActivate :: UIManagerPreActivateCallback -> IO Closure
genClosure_UIManagerPreActivate cb = do
    let cb' = wrap_UIManagerPreActivateCallback cb
    mk_UIManagerPreActivateCallback cb' >>= newCClosure


wrap_UIManagerPreActivateCallback ::
    UIManagerPreActivateCallback ->
    Ptr () ->
    Ptr Gtk.Action.Action ->
    Ptr () ->
    IO ()
wrap_UIManagerPreActivateCallback _cb _ action _ = do
    action' <- (newObject Gtk.Action.Action) action
    _cb  action'


onUIManagerPreActivate :: (GObject a, MonadIO m) => a -> UIManagerPreActivateCallback -> m SignalHandlerId
onUIManagerPreActivate obj cb = liftIO $ connectUIManagerPreActivate obj cb SignalConnectBefore
afterUIManagerPreActivate :: (GObject a, MonadIO m) => a -> UIManagerPreActivateCallback -> m SignalHandlerId
afterUIManagerPreActivate obj cb = connectUIManagerPreActivate obj cb SignalConnectAfter

connectUIManagerPreActivate :: (GObject a, MonadIO m) =>
                               a -> UIManagerPreActivateCallback -> SignalConnectMode -> m SignalHandlerId
connectUIManagerPreActivate obj cb after = liftIO $ do
    let cb' = wrap_UIManagerPreActivateCallback cb
    cb'' <- mk_UIManagerPreActivateCallback cb'
    connectSignalFunPtr obj "pre-activate" cb'' after

-- VVV Prop "add-tearoffs"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Just False)

getUIManagerAddTearoffs :: (MonadIO m, IsUIManager o) => o -> m Bool
getUIManagerAddTearoffs obj = liftIO $ getObjectPropertyBool obj "add-tearoffs"

setUIManagerAddTearoffs :: (MonadIO m, IsUIManager o) => o -> Bool -> m ()
setUIManagerAddTearoffs obj val = liftIO $ setObjectPropertyBool obj "add-tearoffs" val

constructUIManagerAddTearoffs :: (IsUIManager o) => Bool -> IO (GValueConstruct o)
constructUIManagerAddTearoffs val = constructObjectPropertyBool "add-tearoffs" val

data UIManagerAddTearoffsPropertyInfo
instance AttrInfo UIManagerAddTearoffsPropertyInfo where
    type AttrAllowedOps UIManagerAddTearoffsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint UIManagerAddTearoffsPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint UIManagerAddTearoffsPropertyInfo = IsUIManager
    type AttrGetType UIManagerAddTearoffsPropertyInfo = Bool
    type AttrLabel UIManagerAddTearoffsPropertyInfo = "add-tearoffs"
    type AttrOrigin UIManagerAddTearoffsPropertyInfo = UIManager
    attrGet _ = getUIManagerAddTearoffs
    attrSet _ = setUIManagerAddTearoffs
    attrConstruct _ = constructUIManagerAddTearoffs
    attrClear _ = undefined

-- VVV Prop "ui"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getUIManagerUi :: (MonadIO m, IsUIManager o) => o -> m (Maybe T.Text)
getUIManagerUi obj = liftIO $ getObjectPropertyString obj "ui"

data UIManagerUiPropertyInfo
instance AttrInfo UIManagerUiPropertyInfo where
    type AttrAllowedOps UIManagerUiPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint UIManagerUiPropertyInfo = (~) ()
    type AttrBaseTypeConstraint UIManagerUiPropertyInfo = IsUIManager
    type AttrGetType UIManagerUiPropertyInfo = (Maybe T.Text)
    type AttrLabel UIManagerUiPropertyInfo = "ui"
    type AttrOrigin UIManagerUiPropertyInfo = UIManager
    attrGet _ = getUIManagerUi
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList UIManager
type instance O.AttributeList UIManager = UIManagerAttributeList
type UIManagerAttributeList = ('[ '("addTearoffs", UIManagerAddTearoffsPropertyInfo), '("ui", UIManagerUiPropertyInfo)] :: [(Symbol, *)])

uIManagerAddTearoffs :: AttrLabelProxy "addTearoffs"
uIManagerAddTearoffs = AttrLabelProxy

uIManagerUi :: AttrLabelProxy "ui"
uIManagerUi = AttrLabelProxy

data UIManagerActionsChangedSignalInfo
instance SignalInfo UIManagerActionsChangedSignalInfo where
    type HaskellCallbackType UIManagerActionsChangedSignalInfo = UIManagerActionsChangedCallback
    connectSignal _ = connectUIManagerActionsChanged

data UIManagerAddWidgetSignalInfo
instance SignalInfo UIManagerAddWidgetSignalInfo where
    type HaskellCallbackType UIManagerAddWidgetSignalInfo = UIManagerAddWidgetCallback
    connectSignal _ = connectUIManagerAddWidget

data UIManagerConnectProxySignalInfo
instance SignalInfo UIManagerConnectProxySignalInfo where
    type HaskellCallbackType UIManagerConnectProxySignalInfo = UIManagerConnectProxyCallback
    connectSignal _ = connectUIManagerConnectProxy

data UIManagerDisconnectProxySignalInfo
instance SignalInfo UIManagerDisconnectProxySignalInfo where
    type HaskellCallbackType UIManagerDisconnectProxySignalInfo = UIManagerDisconnectProxyCallback
    connectSignal _ = connectUIManagerDisconnectProxy

data UIManagerPostActivateSignalInfo
instance SignalInfo UIManagerPostActivateSignalInfo where
    type HaskellCallbackType UIManagerPostActivateSignalInfo = UIManagerPostActivateCallback
    connectSignal _ = connectUIManagerPostActivate

data UIManagerPreActivateSignalInfo
instance SignalInfo UIManagerPreActivateSignalInfo where
    type HaskellCallbackType UIManagerPreActivateSignalInfo = UIManagerPreActivateCallback
    connectSignal _ = connectUIManagerPreActivate

type instance O.SignalList UIManager = UIManagerSignalList
type UIManagerSignalList = ('[ '("actionsChanged", UIManagerActionsChangedSignalInfo), '("addWidget", UIManagerAddWidgetSignalInfo), '("connectProxy", UIManagerConnectProxySignalInfo), '("disconnectProxy", UIManagerDisconnectProxySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("postActivate", UIManagerPostActivateSignalInfo), '("preActivate", UIManagerPreActivateSignalInfo)] :: [(Symbol, *)])

-- method UIManager::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "UIManager"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_new" gtk_ui_manager_new :: 
    IO (Ptr UIManager)

{-# DEPRECATED uIManagerNew ["(Since version 3.10)"] #-}
{- |
Creates a new ui manager object.

@since 2.4
-}
uIManagerNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m UIManager
    {- ^ __Returns:__ a new ui manager object. -}
uIManagerNew  = liftIO $ do
    result <- gtk_ui_manager_new
    checkUnexpectedReturnNULL "uIManagerNew" result
    result' <- (wrapObject UIManager) result
    return result'

-- method UIManager::add_ui
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "merge_id", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the merge id for the merged UI, see gtk_ui_manager_new_merge_id()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name for the added UI element", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the name of the action to be proxied, or %NULL to add a separator", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Gtk", name = "UIManagerItemType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of UI element to add.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "top", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "if %TRUE, the UI element is added before its siblings, otherwise it\n  is added after its siblings.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_add_ui" gtk_ui_manager_add_ui :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    Word32 ->                               -- merge_id : TBasicType TUInt
    CString ->                              -- path : TBasicType TUTF8
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- action : TBasicType TUTF8
    CUInt ->                                -- type : TInterface (Name {namespace = "Gtk", name = "UIManagerItemType"})
    CInt ->                                 -- top : TBasicType TBoolean
    IO ()

{-# DEPRECATED uIManagerAddUi ["(Since version 3.10)"] #-}
{- |
Adds a UI element to the current contents of /@manager@/.

If /@type@/ is 'GI.Gtk.Flags.UIManagerItemTypeAuto', GTK+ inserts a menuitem, toolitem or
separator if such an element can be inserted at the place determined by
/@path@/. Otherwise /@type@/ must indicate an element that can be inserted at
the place determined by /@path@/.

If /@path@/ points to a menuitem or toolitem, the new element will be inserted
before or after this item, depending on /@top@/.

@since 2.4
-}
uIManagerAddUi ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> Word32
    {- ^ /@mergeId@/: the merge id for the merged UI, see 'GI.Gtk.Objects.UIManager.uIManagerNewMergeId' -}
    -> T.Text
    {- ^ /@path@/: a path -}
    -> T.Text
    {- ^ /@name@/: the name for the added UI element -}
    -> Maybe (T.Text)
    {- ^ /@action@/: the name of the action to be proxied, or 'Nothing' to add a separator -}
    -> [Gtk.Flags.UIManagerItemType]
    {- ^ /@type@/: the type of UI element to add. -}
    -> Bool
    {- ^ /@top@/: if 'True', the UI element is added before its siblings, otherwise it
  is added after its siblings. -}
    -> m ()
uIManagerAddUi manager mergeId path name action type_ top = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    path' <- textToCString path
    name' <- textToCString name
    maybeAction <- case action of
        Nothing -> return nullPtr
        Just jAction -> do
            jAction' <- textToCString jAction
            return jAction'
    let type_' = gflagsToWord type_
    let top' = (fromIntegral . fromEnum) top
    gtk_ui_manager_add_ui manager' mergeId path' name' maybeAction type_' top'
    touchManagedPtr manager
    freeMem path'
    freeMem name'
    freeMem maybeAction
    return ()

data UIManagerAddUiMethodInfo
instance (signature ~ (Word32 -> T.Text -> T.Text -> Maybe (T.Text) -> [Gtk.Flags.UIManagerItemType] -> Bool -> m ()), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerAddUiMethodInfo a signature where
    overloadedMethod _ = uIManagerAddUi

-- method UIManager::add_ui_from_file
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "filename", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name of the file to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_ui_manager_add_ui_from_file" gtk_ui_manager_add_ui_from_file :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CString ->                              -- filename : TBasicType TFileName
    Ptr (Ptr GError) ->                     -- error
    IO Word32

{-# DEPRECATED uIManagerAddUiFromFile ["(Since version 3.10)"] #-}
{- |
Parses a file containing a [UI definition][XML-UI] and
merges it with the current contents of /@manager@/.

@since 2.4
-}
uIManagerAddUiFromFile ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> [Char]
    {- ^ /@filename@/: the name of the file to parse -}
    -> m Word32
    {- ^ __Returns:__ The merge id for the merged UI. The merge id can be used
  to unmerge the UI with 'GI.Gtk.Objects.UIManager.uIManagerRemoveUi'. If an error occurred,
  the return value is 0. /(Can throw 'Data.GI.Base.GError.GError')/ -}
uIManagerAddUiFromFile manager filename = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    filename' <- stringToCString filename
    onException (do
        result <- propagateGError $ gtk_ui_manager_add_ui_from_file manager' filename'
        touchManagedPtr manager
        freeMem filename'
        return result
     ) (do
        freeMem filename'
     )

data UIManagerAddUiFromFileMethodInfo
instance (signature ~ ([Char] -> m Word32), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerAddUiFromFileMethodInfo a signature where
    overloadedMethod _ = uIManagerAddUiFromFile

-- method UIManager::add_ui_from_resource
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "resource_path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the resource path of the file to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_ui_manager_add_ui_from_resource" gtk_ui_manager_add_ui_from_resource :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CString ->                              -- resource_path : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO Word32

{-# DEPRECATED uIManagerAddUiFromResource ["(Since version 3.10)"] #-}
{- |
Parses a resource file containing a [UI definition][XML-UI] and
merges it with the current contents of /@manager@/.

@since 3.4
-}
uIManagerAddUiFromResource ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> T.Text
    {- ^ /@resourcePath@/: the resource path of the file to parse -}
    -> m Word32
    {- ^ __Returns:__ The merge id for the merged UI. The merge id can be used
  to unmerge the UI with 'GI.Gtk.Objects.UIManager.uIManagerRemoveUi'. If an error occurred,
  the return value is 0. /(Can throw 'Data.GI.Base.GError.GError')/ -}
uIManagerAddUiFromResource manager resourcePath = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    resourcePath' <- textToCString resourcePath
    onException (do
        result <- propagateGError $ gtk_ui_manager_add_ui_from_resource manager' resourcePath'
        touchManagedPtr manager
        freeMem resourcePath'
        return result
     ) (do
        freeMem resourcePath'
     )

data UIManagerAddUiFromResourceMethodInfo
instance (signature ~ (T.Text -> m Word32), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerAddUiFromResourceMethodInfo a signature where
    overloadedMethod _ = uIManagerAddUiFromResource

-- method UIManager::add_ui_from_string
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "buffer", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the string to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @buffer (may be -1 if @buffer is nul-terminated)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : True
-- Skip return : False

foreign import ccall "gtk_ui_manager_add_ui_from_string" gtk_ui_manager_add_ui_from_string :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CString ->                              -- buffer : TBasicType TUTF8
    Int64 ->                                -- length : TBasicType TInt64
    Ptr (Ptr GError) ->                     -- error
    IO Word32

{-# DEPRECATED uIManagerAddUiFromString ["(Since version 3.10)"] #-}
{- |
Parses a string containing a [UI definition][XML-UI] and merges it with
the current contents of /@manager@/. An enclosing \<ui> element is added if
it is missing.

@since 2.4
-}
uIManagerAddUiFromString ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> T.Text
    {- ^ /@buffer@/: the string to parse -}
    -> Int64
    {- ^ /@length@/: the length of /@buffer@/ (may be -1 if /@buffer@/ is nul-terminated) -}
    -> m Word32
    {- ^ __Returns:__ The merge id for the merged UI. The merge id can be used
  to unmerge the UI with 'GI.Gtk.Objects.UIManager.uIManagerRemoveUi'. If an error occurred,
  the return value is 0. /(Can throw 'Data.GI.Base.GError.GError')/ -}
uIManagerAddUiFromString manager buffer length_ = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    buffer' <- textToCString buffer
    onException (do
        result <- propagateGError $ gtk_ui_manager_add_ui_from_string manager' buffer' length_
        touchManagedPtr manager
        freeMem buffer'
        return result
     ) (do
        freeMem buffer'
     )

data UIManagerAddUiFromStringMethodInfo
instance (signature ~ (T.Text -> Int64 -> m Word32), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerAddUiFromStringMethodInfo a signature where
    overloadedMethod _ = uIManagerAddUiFromString

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

foreign import ccall "gtk_ui_manager_ensure_update" gtk_ui_manager_ensure_update :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    IO ()

{-# DEPRECATED uIManagerEnsureUpdate ["(Since version 3.10)"] #-}
{- |
Makes sure that all pending updates to the UI have been completed.

This may occasionally be necessary, since 'GI.Gtk.Objects.UIManager.UIManager' updates the
UI in an idle function. A typical example where this function is
useful is to enforce that the menubar and toolbar have been added to
the main window before showing it:

=== /C code/
>
>gtk_container_add (GTK_CONTAINER (window), vbox);
>g_signal_connect (merge, "add-widget",
>                  G_CALLBACK (add_widget), vbox);
>gtk_ui_manager_add_ui_from_file (merge, "my-menus");
>gtk_ui_manager_add_ui_from_file (merge, "my-toolbars");
>gtk_ui_manager_ensure_update (merge);
>gtk_widget_show (window);

@since 2.4
-}
uIManagerEnsureUpdate ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> m ()
uIManagerEnsureUpdate manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    gtk_ui_manager_ensure_update manager'
    touchManagedPtr manager
    return ()

data UIManagerEnsureUpdateMethodInfo
instance (signature ~ (m ()), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerEnsureUpdateMethodInfo a signature where
    overloadedMethod _ = uIManagerEnsureUpdate

-- method UIManager::get_accel_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "AccelGroup"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_get_accel_group" gtk_ui_manager_get_accel_group :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    IO (Ptr Gtk.AccelGroup.AccelGroup)

{-# DEPRECATED uIManagerGetAccelGroup ["(Since version 3.10)"] #-}
{- |
Returns the 'GI.Gtk.Objects.AccelGroup.AccelGroup' associated with /@manager@/.

@since 2.4
-}
uIManagerGetAccelGroup ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> m Gtk.AccelGroup.AccelGroup
    {- ^ __Returns:__ the 'GI.Gtk.Objects.AccelGroup.AccelGroup'. -}
uIManagerGetAccelGroup manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gtk_ui_manager_get_accel_group manager'
    checkUnexpectedReturnNULL "uIManagerGetAccelGroup" result
    result' <- (newObject Gtk.AccelGroup.AccelGroup) result
    touchManagedPtr manager
    return result'

data UIManagerGetAccelGroupMethodInfo
instance (signature ~ (m Gtk.AccelGroup.AccelGroup), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetAccelGroupMethodInfo a signature where
    overloadedMethod _ = uIManagerGetAccelGroup

-- method UIManager::get_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "Action"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_get_action" gtk_ui_manager_get_action :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CString ->                              -- path : TBasicType TUTF8
    IO (Ptr Gtk.Action.Action)

{-# DEPRECATED uIManagerGetAction ["(Since version 3.10)"] #-}
{- |
Looks up an action by following a path. See 'GI.Gtk.Objects.UIManager.uIManagerGetWidget'
for more information about paths.

@since 2.4
-}
uIManagerGetAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> T.Text
    {- ^ /@path@/: a path -}
    -> m Gtk.Action.Action
    {- ^ __Returns:__ the action whose proxy widget is found by following the path,
    or 'Nothing' if no widget was found. -}
uIManagerGetAction manager path = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    path' <- textToCString path
    result <- gtk_ui_manager_get_action manager' path'
    checkUnexpectedReturnNULL "uIManagerGetAction" result
    result' <- (newObject Gtk.Action.Action) result
    touchManagedPtr manager
    freeMem path'
    return result'

data UIManagerGetActionMethodInfo
instance (signature ~ (T.Text -> m Gtk.Action.Action), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetActionMethodInfo a signature where
    overloadedMethod _ = uIManagerGetAction

-- method UIManager::get_action_groups
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGList (TInterface (Name {namespace = "Gtk", name = "ActionGroup"})))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_get_action_groups" gtk_ui_manager_get_action_groups :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    IO (Ptr (GList (Ptr Gtk.ActionGroup.ActionGroup)))

{-# DEPRECATED uIManagerGetActionGroups ["(Since version 3.10)"] #-}
{- |
Returns the list of action groups associated with /@manager@/.

@since 2.4
-}
uIManagerGetActionGroups ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> m [Gtk.ActionGroup.ActionGroup]
    {- ^ __Returns:__ a 'GI.GLib.Structs.List.List' of
  action groups. The list is owned by GTK+
  and should not be modified. -}
uIManagerGetActionGroups manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gtk_ui_manager_get_action_groups manager'
    result' <- unpackGList result
    result'' <- mapM (newObject Gtk.ActionGroup.ActionGroup) result'
    touchManagedPtr manager
    return result''

data UIManagerGetActionGroupsMethodInfo
instance (signature ~ (m [Gtk.ActionGroup.ActionGroup]), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetActionGroupsMethodInfo a signature where
    overloadedMethod _ = uIManagerGetActionGroups

-- method UIManager::get_add_tearoffs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager", 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 "gtk_ui_manager_get_add_tearoffs" gtk_ui_manager_get_add_tearoffs :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    IO CInt

{-# DEPRECATED uIManagerGetAddTearoffs ["(Since version 3.4)","Tearoff menus are deprecated and should not","    be used in newly written code."] #-}
{- |
Returns whether menus generated by this 'GI.Gtk.Objects.UIManager.UIManager'
will have tearoff menu items.

@since 2.4
-}
uIManagerGetAddTearoffs ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> m Bool
    {- ^ __Returns:__ whether tearoff menu items are added -}
uIManagerGetAddTearoffs manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gtk_ui_manager_get_add_tearoffs manager'
    let result' = (/= 0) result
    touchManagedPtr manager
    return result'

data UIManagerGetAddTearoffsMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetAddTearoffsMethodInfo a signature where
    overloadedMethod _ = uIManagerGetAddTearoffs

-- method UIManager::get_toplevels
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "types", argType = TInterface (Name {namespace = "Gtk", name = "UIManagerItemType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "specifies the types of toplevel widgets to include. Allowed\n  types are #GTK_UI_MANAGER_MENUBAR, #GTK_UI_MANAGER_TOOLBAR and\n  #GTK_UI_MANAGER_POPUP.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TGSList (TInterface (Name {namespace = "Gtk", name = "Widget"})))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_get_toplevels" gtk_ui_manager_get_toplevels :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CUInt ->                                -- types : TInterface (Name {namespace = "Gtk", name = "UIManagerItemType"})
    IO (Ptr (GSList (Ptr Gtk.Widget.Widget)))

{-# DEPRECATED uIManagerGetToplevels ["(Since version 3.10)"] #-}
{- |
Obtains a list of all toplevel widgets of the requested types.

@since 2.4
-}
uIManagerGetToplevels ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> [Gtk.Flags.UIManagerItemType]
    {- ^ /@types@/: specifies the types of toplevel widgets to include. Allowed
  types are @/GTK_UI_MANAGER_MENUBAR/@, @/GTK_UI_MANAGER_TOOLBAR/@ and
  @/GTK_UI_MANAGER_POPUP/@. -}
    -> m [Gtk.Widget.Widget]
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.SList.SList' of
all toplevel widgets of the requested types.  Free the returned list with @/g_slist_free()/@. -}
uIManagerGetToplevels manager types = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    let types' = gflagsToWord types
    result <- gtk_ui_manager_get_toplevels manager' types'
    result' <- unpackGSList result
    result'' <- mapM (newObject Gtk.Widget.Widget) result'
    g_slist_free result
    touchManagedPtr manager
    return result''

data UIManagerGetToplevelsMethodInfo
instance (signature ~ ([Gtk.Flags.UIManagerItemType] -> m [Gtk.Widget.Widget]), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetToplevelsMethodInfo a signature where
    overloadedMethod _ = uIManagerGetToplevels

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

foreign import ccall "gtk_ui_manager_get_ui" gtk_ui_manager_get_ui :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    IO CString

{-# DEPRECATED uIManagerGetUi ["(Since version 3.10)"] #-}
{- |
Creates a [UI definition][XML-UI] of the merged UI.

@since 2.4
-}
uIManagerGetUi ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> m T.Text
    {- ^ __Returns:__ A newly allocated string containing an XML representation of
the merged UI. -}
uIManagerGetUi manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gtk_ui_manager_get_ui manager'
    checkUnexpectedReturnNULL "uIManagerGetUi" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr manager
    return result'

data UIManagerGetUiMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetUiMethodInfo a signature where
    overloadedMethod _ = uIManagerGetUi

-- method UIManager::get_widget
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a path", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "Widget"}))
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_get_widget" gtk_ui_manager_get_widget :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CString ->                              -- path : TBasicType TUTF8
    IO (Ptr Gtk.Widget.Widget)

{-# DEPRECATED uIManagerGetWidget ["(Since version 3.10)"] #-}
{- |
Looks up a widget by following a path.
The path consists of the names specified in the XML description of the UI.
separated by “\/”. Elements which don’t have a name or action attribute in
the XML (e.g. \<popup>) can be addressed by their XML element name
(e.g. \"popup\"). The root element (\"\/ui\") can be omitted in the path.

Note that the widget found by following a path that ends in a \<menu>;
element is the menuitem to which the menu is attached, not the menu it
manages.

Also note that the widgets constructed by a ui manager are not tied to
the lifecycle of the ui manager. If you add the widgets returned by this
function to some container or explicitly ref them, they will survive the
destruction of the ui manager.

@since 2.4
-}
uIManagerGetWidget ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> T.Text
    {- ^ /@path@/: a path -}
    -> m Gtk.Widget.Widget
    {- ^ __Returns:__ the widget found by following the path,
    or 'Nothing' if no widget was found -}
uIManagerGetWidget manager path = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    path' <- textToCString path
    result <- gtk_ui_manager_get_widget manager' path'
    checkUnexpectedReturnNULL "uIManagerGetWidget" result
    result' <- (newObject Gtk.Widget.Widget) result
    touchManagedPtr manager
    freeMem path'
    return result'

data UIManagerGetWidgetMethodInfo
instance (signature ~ (T.Text -> m Gtk.Widget.Widget), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerGetWidgetMethodInfo a signature where
    overloadedMethod _ = uIManagerGetWidget

-- method UIManager::insert_action_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gtk", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the action group to be inserted", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pos", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the position at which the group will be inserted.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_insert_action_group" gtk_ui_manager_insert_action_group :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    Ptr Gtk.ActionGroup.ActionGroup ->      -- action_group : TInterface (Name {namespace = "Gtk", name = "ActionGroup"})
    Int32 ->                                -- pos : TBasicType TInt
    IO ()

{-# DEPRECATED uIManagerInsertActionGroup ["(Since version 3.10)"] #-}
{- |
Inserts an action group into the list of action groups associated
with /@manager@/. Actions in earlier groups hide actions with the same
name in later groups.

If /@pos@/ is larger than the number of action groups in /@manager@/, or
negative, /@actionGroup@/ will be inserted at the end of the internal
list.

@since 2.4
-}
uIManagerInsertActionGroup ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a, Gtk.ActionGroup.IsActionGroup b) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> b
    {- ^ /@actionGroup@/: the action group to be inserted -}
    -> Int32
    {- ^ /@pos@/: the position at which the group will be inserted. -}
    -> m ()
uIManagerInsertActionGroup manager actionGroup pos = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    actionGroup' <- unsafeManagedPtrCastPtr actionGroup
    gtk_ui_manager_insert_action_group manager' actionGroup' pos
    touchManagedPtr manager
    touchManagedPtr actionGroup
    return ()

data UIManagerInsertActionGroupMethodInfo
instance (signature ~ (b -> Int32 -> m ()), MonadIO m, IsUIManager a, Gtk.ActionGroup.IsActionGroup b) => O.MethodInfo UIManagerInsertActionGroupMethodInfo a signature where
    overloadedMethod _ = uIManagerInsertActionGroup

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

foreign import ccall "gtk_ui_manager_new_merge_id" gtk_ui_manager_new_merge_id :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    IO Word32

{-# DEPRECATED uIManagerNewMergeId ["(Since version 3.10)"] #-}
{- |
Returns an unused merge id, suitable for use with
'GI.Gtk.Objects.UIManager.uIManagerAddUi'.

@since 2.4
-}
uIManagerNewMergeId ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> m Word32
    {- ^ __Returns:__ an unused merge id. -}
uIManagerNewMergeId manager = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    result <- gtk_ui_manager_new_merge_id manager'
    touchManagedPtr manager
    return result

data UIManagerNewMergeIdMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerNewMergeIdMethodInfo a signature where
    overloadedMethod _ = uIManagerNewMergeId

-- method UIManager::remove_action_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "action_group", argType = TInterface (Name {namespace = "Gtk", name = "ActionGroup"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the action group to be removed", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_remove_action_group" gtk_ui_manager_remove_action_group :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    Ptr Gtk.ActionGroup.ActionGroup ->      -- action_group : TInterface (Name {namespace = "Gtk", name = "ActionGroup"})
    IO ()

{-# DEPRECATED uIManagerRemoveActionGroup ["(Since version 3.10)"] #-}
{- |
Removes an action group from the list of action groups associated
with /@manager@/.

@since 2.4
-}
uIManagerRemoveActionGroup ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a, Gtk.ActionGroup.IsActionGroup b) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> b
    {- ^ /@actionGroup@/: the action group to be removed -}
    -> m ()
uIManagerRemoveActionGroup manager actionGroup = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    actionGroup' <- unsafeManagedPtrCastPtr actionGroup
    gtk_ui_manager_remove_action_group manager' actionGroup'
    touchManagedPtr manager
    touchManagedPtr actionGroup
    return ()

data UIManagerRemoveActionGroupMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsUIManager a, Gtk.ActionGroup.IsActionGroup b) => O.MethodInfo UIManagerRemoveActionGroupMethodInfo a signature where
    overloadedMethod _ = uIManagerRemoveActionGroup

-- method UIManager::remove_ui
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager object", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "merge_id", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a merge id as returned by gtk_ui_manager_add_ui_from_string()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_remove_ui" gtk_ui_manager_remove_ui :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    Word32 ->                               -- merge_id : TBasicType TUInt
    IO ()

{-# DEPRECATED uIManagerRemoveUi ["(Since version 3.10)"] #-}
{- |
Unmerges the part of /@manager@/\'s content identified by /@mergeId@/.

@since 2.4
-}
uIManagerRemoveUi ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' object -}
    -> Word32
    {- ^ /@mergeId@/: a merge id as returned by 'GI.Gtk.Objects.UIManager.uIManagerAddUiFromString' -}
    -> m ()
uIManagerRemoveUi manager mergeId = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    gtk_ui_manager_remove_ui manager' mergeId
    touchManagedPtr manager
    return ()

data UIManagerRemoveUiMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerRemoveUiMethodInfo a signature where
    overloadedMethod _ = uIManagerRemoveUi

-- method UIManager::set_add_tearoffs
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "manager", argType = TInterface (Name {namespace = "Gtk", name = "UIManager"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkUIManager", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "add_tearoffs", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "whether tearoff menu items are added", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_ui_manager_set_add_tearoffs" gtk_ui_manager_set_add_tearoffs :: 
    Ptr UIManager ->                        -- manager : TInterface (Name {namespace = "Gtk", name = "UIManager"})
    CInt ->                                 -- add_tearoffs : TBasicType TBoolean
    IO ()

{-# DEPRECATED uIManagerSetAddTearoffs ["(Since version 3.4)","Tearoff menus are deprecated and should not","    be used in newly written code."] #-}
{- |
Sets the “add_tearoffs” property, which controls whether menus
generated by this 'GI.Gtk.Objects.UIManager.UIManager' will have tearoff menu items.

Note that this only affects regular menus. Generated popup
menus never have tearoff menu items.

@since 2.4
-}
uIManagerSetAddTearoffs ::
    (B.CallStack.HasCallStack, MonadIO m, IsUIManager a) =>
    a
    {- ^ /@manager@/: a 'GI.Gtk.Objects.UIManager.UIManager' -}
    -> Bool
    {- ^ /@addTearoffs@/: whether tearoff menu items are added -}
    -> m ()
uIManagerSetAddTearoffs manager addTearoffs = liftIO $ do
    manager' <- unsafeManagedPtrCastPtr manager
    let addTearoffs' = (fromIntegral . fromEnum) addTearoffs
    gtk_ui_manager_set_add_tearoffs manager' addTearoffs'
    touchManagedPtr manager
    return ()

data UIManagerSetAddTearoffsMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m, IsUIManager a) => O.MethodInfo UIManagerSetAddTearoffsMethodInfo a signature where
    overloadedMethod _ = uIManagerSetAddTearoffs