{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Objects.Menu
(
Menu(..) ,
IsMenu ,
toMenu ,
#if defined(ENABLE_OVERLOADING)
ResolveMenuMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
MenuAppendMethodInfo ,
#endif
menuAppend ,
#if defined(ENABLE_OVERLOADING)
MenuAppendItemMethodInfo ,
#endif
menuAppendItem ,
#if defined(ENABLE_OVERLOADING)
MenuAppendSectionMethodInfo ,
#endif
menuAppendSection ,
#if defined(ENABLE_OVERLOADING)
MenuAppendSubmenuMethodInfo ,
#endif
menuAppendSubmenu ,
#if defined(ENABLE_OVERLOADING)
MenuFreezeMethodInfo ,
#endif
menuFreeze ,
#if defined(ENABLE_OVERLOADING)
MenuInsertMethodInfo ,
#endif
menuInsert ,
#if defined(ENABLE_OVERLOADING)
MenuInsertItemMethodInfo ,
#endif
menuInsertItem ,
#if defined(ENABLE_OVERLOADING)
MenuInsertSectionMethodInfo ,
#endif
menuInsertSection ,
#if defined(ENABLE_OVERLOADING)
MenuInsertSubmenuMethodInfo ,
#endif
menuInsertSubmenu ,
menuNew ,
#if defined(ENABLE_OVERLOADING)
MenuPrependMethodInfo ,
#endif
menuPrepend ,
#if defined(ENABLE_OVERLOADING)
MenuPrependItemMethodInfo ,
#endif
menuPrependItem ,
#if defined(ENABLE_OVERLOADING)
MenuPrependSectionMethodInfo ,
#endif
menuPrependSection ,
#if defined(ENABLE_OVERLOADING)
MenuPrependSubmenuMethodInfo ,
#endif
menuPrependSubmenu ,
#if defined(ENABLE_OVERLOADING)
MenuRemoveMethodInfo ,
#endif
menuRemove ,
#if defined(ENABLE_OVERLOADING)
MenuRemoveAllMethodInfo ,
#endif
menuRemoveAll ,
) 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.BasicTypes as B.Types
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 Control.Monad.IO.Class as MIO
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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuItem as Gio.MenuItem
import {-# SOURCE #-} qualified GI.Gio.Objects.MenuModel as Gio.MenuModel
newtype = (SP.ManagedPtr Menu)
deriving (Menu -> Menu -> Bool
(Menu -> Menu -> Bool) -> (Menu -> Menu -> Bool) -> Eq Menu
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Menu -> Menu -> Bool
$c/= :: Menu -> Menu -> Bool
== :: Menu -> Menu -> Bool
$c== :: Menu -> Menu -> Bool
Eq)
instance SP.ManagedPtrNewtype Menu where
toManagedPtr :: Menu -> ManagedPtr Menu
toManagedPtr (Menu ManagedPtr Menu
p) = ManagedPtr Menu
p
foreign import ccall "g_menu_get_type"
:: IO B.Types.GType
instance B.Types.TypedObject Menu where
glibType :: IO GType
glibType = IO GType
c_g_menu_get_type
instance B.Types.GObject Menu
instance B.GValue.IsGValue Menu where
toGValue :: Menu -> IO GValue
toGValue Menu
o = do
GType
gtype <- IO GType
c_g_menu_get_type
Menu -> (Ptr Menu -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Menu
o (GType -> (GValue -> Ptr Menu -> IO ()) -> Ptr Menu -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Menu -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
fromGValue :: GValue -> IO Menu
fromGValue GValue
gv = do
Ptr Menu
ptr <- GValue -> IO (Ptr Menu)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Menu)
(ManagedPtr Menu -> Menu) -> Ptr Menu -> IO Menu
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Menu -> Menu
Menu Ptr Menu
ptr
class (SP.GObject o, O.IsDescendantOf Menu o) => o
instance (SP.GObject o, O.IsDescendantOf Menu o) => IsMenu o
instance O.HasParentTypes Menu
type instance O.ParentTypes Menu = '[Gio.MenuModel.MenuModel, GObject.Object.Object]
toMenu :: (MonadIO m, IsMenu o) => o -> m Menu
= IO Menu -> m Menu
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Menu -> m Menu) -> (o -> IO Menu) -> o -> m Menu
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Menu -> Menu) -> o -> IO Menu
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Menu -> Menu
Menu
#if defined(ENABLE_OVERLOADING)
type family ResolveMenuMethod (t :: Symbol) (o :: *) :: * where
ResolveMenuMethod "append" o = MenuAppendMethodInfo
ResolveMenuMethod "appendItem" o = MenuAppendItemMethodInfo
ResolveMenuMethod "appendSection" o = MenuAppendSectionMethodInfo
ResolveMenuMethod "appendSubmenu" o = MenuAppendSubmenuMethodInfo
ResolveMenuMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveMenuMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveMenuMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveMenuMethod "freeze" o = MenuFreezeMethodInfo
ResolveMenuMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveMenuMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveMenuMethod "insert" o = MenuInsertMethodInfo
ResolveMenuMethod "insertItem" o = MenuInsertItemMethodInfo
ResolveMenuMethod "insertSection" o = MenuInsertSectionMethodInfo
ResolveMenuMethod "insertSubmenu" o = MenuInsertSubmenuMethodInfo
ResolveMenuMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveMenuMethod "isMutable" o = Gio.MenuModel.MenuModelIsMutableMethodInfo
ResolveMenuMethod "itemsChanged" o = Gio.MenuModel.MenuModelItemsChangedMethodInfo
ResolveMenuMethod "iterateItemAttributes" o = Gio.MenuModel.MenuModelIterateItemAttributesMethodInfo
ResolveMenuMethod "iterateItemLinks" o = Gio.MenuModel.MenuModelIterateItemLinksMethodInfo
ResolveMenuMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveMenuMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveMenuMethod "prepend" o = MenuPrependMethodInfo
ResolveMenuMethod "prependItem" o = MenuPrependItemMethodInfo
ResolveMenuMethod "prependSection" o = MenuPrependSectionMethodInfo
ResolveMenuMethod "prependSubmenu" o = MenuPrependSubmenuMethodInfo
ResolveMenuMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveMenuMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveMenuMethod "remove" o = MenuRemoveMethodInfo
ResolveMenuMethod "removeAll" o = MenuRemoveAllMethodInfo
ResolveMenuMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveMenuMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveMenuMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveMenuMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveMenuMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveMenuMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveMenuMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveMenuMethod "getItemAttributeValue" o = Gio.MenuModel.MenuModelGetItemAttributeValueMethodInfo
ResolveMenuMethod "getItemLink" o = Gio.MenuModel.MenuModelGetItemLinkMethodInfo
ResolveMenuMethod "getNItems" o = Gio.MenuModel.MenuModelGetNItemsMethodInfo
ResolveMenuMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveMenuMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveMenuMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveMenuMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveMenuMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveMenuMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveMenuMethod t Menu, O.MethodInfo info Menu p) => OL.IsLabel t (Menu -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Menu
type instance O.AttributeList Menu = MenuAttributeList
type MenuAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Menu = MenuSignalList
type MenuSignalList = ('[ '("itemsChanged", Gio.MenuModel.MenuModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_menu_new" ::
IO (Ptr Menu)
menuNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Menu
= IO Menu -> m Menu
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Menu -> m Menu) -> IO Menu -> m Menu
forall a b. (a -> b) -> a -> b
$ do
Ptr Menu
result <- IO (Ptr Menu)
g_menu_new
Text -> Ptr Menu -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"menuNew" Ptr Menu
result
Menu
result' <- ((ManagedPtr Menu -> Menu) -> Ptr Menu -> IO Menu
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Menu -> Menu
Menu) Ptr Menu
result
Menu -> IO Menu
forall (m :: * -> *) a. Monad m => a -> m a
return Menu
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "g_menu_append" ::
Ptr Menu ->
CString ->
CString ->
IO ()
menuAppend ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a) =>
a
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m ()
a
menu Maybe Text
label Maybe Text
detailedAction = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr CChar
maybeDetailedAction <- case Maybe Text
detailedAction of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jDetailedAction -> do
Ptr CChar
jDetailedAction' <- Text -> IO (Ptr CChar)
textToCString Text
jDetailedAction
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jDetailedAction'
Ptr Menu -> Ptr CChar -> Ptr CChar -> IO ()
g_menu_append Ptr Menu
menu' Ptr CChar
maybeLabel Ptr CChar
maybeDetailedAction
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeDetailedAction
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuAppendMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> m ()), MonadIO m, IsMenu a) => O.MethodInfo MenuAppendMethodInfo a signature where
overloadedMethod = menuAppend
#endif
foreign import ccall "g_menu_append_item" ::
Ptr Menu ->
Ptr Gio.MenuItem.MenuItem ->
IO ()
menuAppendItem ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuItem.IsMenuItem b) =>
a
-> b
-> m ()
a
menu b
item = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr MenuItem
item' <- b -> IO (Ptr MenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
item
Ptr Menu -> Ptr MenuItem -> IO ()
g_menu_append_item Ptr Menu
menu' Ptr MenuItem
item'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
item
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuAppendItemMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMenu a, Gio.MenuItem.IsMenuItem b) => O.MethodInfo MenuAppendItemMethodInfo a signature where
overloadedMethod = menuAppendItem
#endif
foreign import ccall "g_menu_append_section" ::
Ptr Menu ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuAppendSection ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) =>
a
-> Maybe (T.Text)
-> b
-> m ()
a
menu Maybe Text
label b
section = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
section' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
section
Ptr Menu -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_append_section Ptr Menu
menu' Ptr CChar
maybeLabel Ptr MenuModel
section'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
section
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuAppendSectionMethodInfo
instance (signature ~ (Maybe (T.Text) -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuAppendSectionMethodInfo a signature where
overloadedMethod = menuAppendSection
#endif
foreign import ccall "g_menu_append_submenu" ::
Ptr Menu ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuAppendSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) =>
a
-> Maybe (T.Text)
-> b
-> m ()
a
menu Maybe Text
label b
submenu = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
submenu' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
submenu
Ptr Menu -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_append_submenu Ptr Menu
menu' Ptr CChar
maybeLabel Ptr MenuModel
submenu'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
submenu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuAppendSubmenuMethodInfo
instance (signature ~ (Maybe (T.Text) -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuAppendSubmenuMethodInfo a signature where
overloadedMethod = menuAppendSubmenu
#endif
foreign import ccall "g_menu_freeze" ::
Ptr Menu ->
IO ()
menuFreeze ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a) =>
a
-> m ()
a
menu = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr Menu -> IO ()
g_menu_freeze Ptr Menu
menu'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuFreezeMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMenu a) => O.MethodInfo MenuFreezeMethodInfo a signature where
overloadedMethod = menuFreeze
#endif
foreign import ccall "g_menu_insert" ::
Ptr Menu ->
Int32 ->
CString ->
CString ->
IO ()
menuInsert ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a) =>
a
-> Int32
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m ()
a
menu Int32
position Maybe Text
label Maybe Text
detailedAction = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr CChar
maybeDetailedAction <- case Maybe Text
detailedAction of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jDetailedAction -> do
Ptr CChar
jDetailedAction' <- Text -> IO (Ptr CChar)
textToCString Text
jDetailedAction
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jDetailedAction'
Ptr Menu -> Int32 -> Ptr CChar -> Ptr CChar -> IO ()
g_menu_insert Ptr Menu
menu' Int32
position Ptr CChar
maybeLabel Ptr CChar
maybeDetailedAction
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeDetailedAction
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuInsertMethodInfo
instance (signature ~ (Int32 -> Maybe (T.Text) -> Maybe (T.Text) -> m ()), MonadIO m, IsMenu a) => O.MethodInfo MenuInsertMethodInfo a signature where
overloadedMethod = menuInsert
#endif
foreign import ccall "g_menu_insert_item" ::
Ptr Menu ->
Int32 ->
Ptr Gio.MenuItem.MenuItem ->
IO ()
menuInsertItem ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuItem.IsMenuItem b) =>
a
-> Int32
-> b
-> m ()
a
menu Int32
position b
item = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr MenuItem
item' <- b -> IO (Ptr MenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
item
Ptr Menu -> Int32 -> Ptr MenuItem -> IO ()
g_menu_insert_item Ptr Menu
menu' Int32
position Ptr MenuItem
item'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
item
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuInsertItemMethodInfo
instance (signature ~ (Int32 -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuItem.IsMenuItem b) => O.MethodInfo MenuInsertItemMethodInfo a signature where
overloadedMethod = menuInsertItem
#endif
foreign import ccall "g_menu_insert_section" ::
Ptr Menu ->
Int32 ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuInsertSection ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) =>
a
-> Int32
-> Maybe (T.Text)
-> b
-> m ()
a
menu Int32
position Maybe Text
label b
section = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
section' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
section
Ptr Menu -> Int32 -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_insert_section Ptr Menu
menu' Int32
position Ptr CChar
maybeLabel Ptr MenuModel
section'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
section
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuInsertSectionMethodInfo
instance (signature ~ (Int32 -> Maybe (T.Text) -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuInsertSectionMethodInfo a signature where
overloadedMethod = menuInsertSection
#endif
foreign import ccall "g_menu_insert_submenu" ::
Ptr Menu ->
Int32 ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuInsertSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) =>
a
-> Int32
-> Maybe (T.Text)
-> b
-> m ()
a
menu Int32
position Maybe Text
label b
submenu = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
submenu' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
submenu
Ptr Menu -> Int32 -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_insert_submenu Ptr Menu
menu' Int32
position Ptr CChar
maybeLabel Ptr MenuModel
submenu'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
submenu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuInsertSubmenuMethodInfo
instance (signature ~ (Int32 -> Maybe (T.Text) -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuInsertSubmenuMethodInfo a signature where
overloadedMethod = menuInsertSubmenu
#endif
foreign import ccall "g_menu_prepend" ::
Ptr Menu ->
CString ->
CString ->
IO ()
menuPrepend ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a) =>
a
-> Maybe (T.Text)
-> Maybe (T.Text)
-> m ()
a
menu Maybe Text
label Maybe Text
detailedAction = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr CChar
maybeDetailedAction <- case Maybe Text
detailedAction of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jDetailedAction -> do
Ptr CChar
jDetailedAction' <- Text -> IO (Ptr CChar)
textToCString Text
jDetailedAction
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jDetailedAction'
Ptr Menu -> Ptr CChar -> Ptr CChar -> IO ()
g_menu_prepend Ptr Menu
menu' Ptr CChar
maybeLabel Ptr CChar
maybeDetailedAction
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeDetailedAction
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuPrependMethodInfo
instance (signature ~ (Maybe (T.Text) -> Maybe (T.Text) -> m ()), MonadIO m, IsMenu a) => O.MethodInfo MenuPrependMethodInfo a signature where
overloadedMethod = menuPrepend
#endif
foreign import ccall "g_menu_prepend_item" ::
Ptr Menu ->
Ptr Gio.MenuItem.MenuItem ->
IO ()
menuPrependItem ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuItem.IsMenuItem b) =>
a
-> b
-> m ()
a
menu b
item = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr MenuItem
item' <- b -> IO (Ptr MenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
item
Ptr Menu -> Ptr MenuItem -> IO ()
g_menu_prepend_item Ptr Menu
menu' Ptr MenuItem
item'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
item
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuPrependItemMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsMenu a, Gio.MenuItem.IsMenuItem b) => O.MethodInfo MenuPrependItemMethodInfo a signature where
overloadedMethod = menuPrependItem
#endif
foreign import ccall "g_menu_prepend_section" ::
Ptr Menu ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuPrependSection ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) =>
a
-> Maybe (T.Text)
-> b
-> m ()
a
menu Maybe Text
label b
section = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
section' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
section
Ptr Menu -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_prepend_section Ptr Menu
menu' Ptr CChar
maybeLabel Ptr MenuModel
section'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
section
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuPrependSectionMethodInfo
instance (signature ~ (Maybe (T.Text) -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuPrependSectionMethodInfo a signature where
overloadedMethod = menuPrependSection
#endif
foreign import ccall "g_menu_prepend_submenu" ::
Ptr Menu ->
CString ->
Ptr Gio.MenuModel.MenuModel ->
IO ()
menuPrependSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) =>
a
-> Maybe (T.Text)
-> b
-> m ()
a
menu Maybe Text
label b
submenu = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr CChar
maybeLabel <- case Maybe Text
label of
Maybe Text
Nothing -> Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
forall a. Ptr a
nullPtr
Just Text
jLabel -> do
Ptr CChar
jLabel' <- Text -> IO (Ptr CChar)
textToCString Text
jLabel
Ptr CChar -> IO (Ptr CChar)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr CChar
jLabel'
Ptr MenuModel
submenu' <- b -> IO (Ptr MenuModel)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
submenu
Ptr Menu -> Ptr CChar -> Ptr MenuModel -> IO ()
g_menu_prepend_submenu Ptr Menu
menu' Ptr CChar
maybeLabel Ptr MenuModel
submenu'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
submenu
Ptr CChar -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CChar
maybeLabel
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuPrependSubmenuMethodInfo
instance (signature ~ (Maybe (T.Text) -> b -> m ()), MonadIO m, IsMenu a, Gio.MenuModel.IsMenuModel b) => O.MethodInfo MenuPrependSubmenuMethodInfo a signature where
overloadedMethod = menuPrependSubmenu
#endif
foreign import ccall "g_menu_remove" ::
Ptr Menu ->
Int32 ->
IO ()
menuRemove ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a) =>
a
-> Int32
-> m ()
a
menu Int32
position = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr Menu -> Int32 -> IO ()
g_menu_remove Ptr Menu
menu' Int32
position
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuRemoveMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m, IsMenu a) => O.MethodInfo MenuRemoveMethodInfo a signature where
overloadedMethod = menuRemove
#endif
foreign import ccall "g_menu_remove_all" ::
Ptr Menu ->
IO ()
menuRemoveAll ::
(B.CallStack.HasCallStack, MonadIO m, IsMenu a) =>
a
-> m ()
a
menu = 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 Menu
menu' <- a -> IO (Ptr Menu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
menu
Ptr Menu -> IO ()
g_menu_remove_all Ptr Menu
menu'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
menu
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data MenuRemoveAllMethodInfo
instance (signature ~ (m ()), MonadIO m, IsMenu a) => O.MethodInfo MenuRemoveAllMethodInfo a signature where
overloadedMethod = menuRemoveAll
#endif