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

module GI.WebKit2.Objects.ContextMenuItem
    ( 

-- * Exported types
    ContextMenuItem(..)                     ,
    IsContextMenuItem                       ,
    toContextMenuItem                       ,
    noContextMenuItem                       ,


 -- * Methods
-- ** getAction #method:getAction#
    ContextMenuItemGetActionMethodInfo      ,
    contextMenuItemGetAction                ,


-- ** getStockAction #method:getStockAction#
    ContextMenuItemGetStockActionMethodInfo ,
    contextMenuItemGetStockAction           ,


-- ** getSubmenu #method:getSubmenu#
    ContextMenuItemGetSubmenuMethodInfo     ,
    contextMenuItemGetSubmenu               ,


-- ** isSeparator #method:isSeparator#
    ContextMenuItemIsSeparatorMethodInfo    ,
    contextMenuItemIsSeparator              ,


-- ** new #method:new#
    contextMenuItemNew                      ,


-- ** newFromStockAction #method:newFromStockAction#
    contextMenuItemNewFromStockAction       ,


-- ** newFromStockActionWithLabel #method:newFromStockActionWithLabel#
    contextMenuItemNewFromStockActionWithLabel,


-- ** newSeparator #method:newSeparator#
    contextMenuItemNewSeparator             ,


-- ** newWithSubmenu #method:newWithSubmenu#
    contextMenuItemNewWithSubmenu           ,


-- ** setSubmenu #method:setSubmenu#
    ContextMenuItemSetSubmenuMethodInfo     ,
    contextMenuItemSetSubmenu               ,




    ) 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 qualified GI.Gtk.Objects.Action as Gtk.Action
import {-# SOURCE #-} qualified GI.WebKit2.Enums as WebKit2.Enums
import {-# SOURCE #-} qualified GI.WebKit2.Objects.ContextMenu as WebKit2.ContextMenu

newtype ContextMenuItem = ContextMenuItem (ManagedPtr ContextMenuItem)
foreign import ccall "webkit_context_menu_item_get_type"
    c_webkit_context_menu_item_get_type :: IO GType

instance GObject ContextMenuItem where
    gobjectType _ = c_webkit_context_menu_item_get_type
    

class GObject o => IsContextMenuItem o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError ContextMenuItem a) =>
    IsContextMenuItem a
#endif
instance IsContextMenuItem ContextMenuItem
instance GObject.Object.IsObject ContextMenuItem

toContextMenuItem :: IsContextMenuItem o => o -> IO ContextMenuItem
toContextMenuItem = unsafeCastTo ContextMenuItem

noContextMenuItem :: Maybe ContextMenuItem
noContextMenuItem = Nothing

type family ResolveContextMenuItemMethod (t :: Symbol) (o :: *) :: * where
    ResolveContextMenuItemMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveContextMenuItemMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveContextMenuItemMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveContextMenuItemMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveContextMenuItemMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveContextMenuItemMethod "isSeparator" o = ContextMenuItemIsSeparatorMethodInfo
    ResolveContextMenuItemMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveContextMenuItemMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveContextMenuItemMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveContextMenuItemMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveContextMenuItemMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveContextMenuItemMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveContextMenuItemMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveContextMenuItemMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveContextMenuItemMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveContextMenuItemMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveContextMenuItemMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveContextMenuItemMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveContextMenuItemMethod "getAction" o = ContextMenuItemGetActionMethodInfo
    ResolveContextMenuItemMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveContextMenuItemMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveContextMenuItemMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveContextMenuItemMethod "getStockAction" o = ContextMenuItemGetStockActionMethodInfo
    ResolveContextMenuItemMethod "getSubmenu" o = ContextMenuItemGetSubmenuMethodInfo
    ResolveContextMenuItemMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveContextMenuItemMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveContextMenuItemMethod "setSubmenu" o = ContextMenuItemSetSubmenuMethodInfo
    ResolveContextMenuItemMethod l o = O.MethodResolutionFailed l o

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

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

instance O.HasAttributeList ContextMenuItem
type instance O.AttributeList ContextMenuItem = ContextMenuItemAttributeList
type ContextMenuItemAttributeList = ('[ ] :: [(Symbol, *)])

type instance O.SignalList ContextMenuItem = ContextMenuItemSignalList
type ContextMenuItemSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method ContextMenuItem::new
-- method type : Constructor
-- Args : [Arg {argCName = "action", argType = TInterface (Name {namespace = "Gtk", name = "Action"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkAction", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_context_menu_item_new" webkit_context_menu_item_new :: 
    Ptr Gtk.Action.Action ->                -- action : TInterface (Name {namespace = "Gtk", name = "Action"})
    IO (Ptr ContextMenuItem)

{- |
Creates a new 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for the given /@action@/.
-}
contextMenuItemNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.Action.IsAction a) =>
    a
    {- ^ /@action@/: a 'GI.Gtk.Objects.Action.Action' -}
    -> m ContextMenuItem
    {- ^ __Returns:__ the newly created 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object. -}
contextMenuItemNew action = liftIO $ do
    action' <- unsafeManagedPtrCastPtr action
    result <- webkit_context_menu_item_new action'
    checkUnexpectedReturnNULL "contextMenuItemNew" result
    result' <- (newObject ContextMenuItem) result
    touchManagedPtr action
    return result'

-- method ContextMenuItem::new_from_stock_action
-- method type : Constructor
-- Args : [Arg {argCName = "action", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenuAction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenuAction stock action", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_context_menu_item_new_from_stock_action" webkit_context_menu_item_new_from_stock_action :: 
    CUInt ->                                -- action : TInterface (Name {namespace = "WebKit2", name = "ContextMenuAction"})
    IO (Ptr ContextMenuItem)

{- |
Creates a new 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for the given stock action.
Stock actions are handled automatically by WebKit so that, for example,
when a menu item created with a 'GI.WebKit2.Enums.ContextMenuActionStop' is
activated the action associated will be handled by WebKit and the current
load operation will be stopped. You can get the 'GI.Gtk.Objects.Action.Action' of a
'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' created with a 'GI.WebKit2.Enums.ContextMenuAction' with
'GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetAction' and connect to 'GI.Gtk.Objects.Action.Action'::@/activate/@ signal
to be notified when the item is activated. But you can\'t prevent the asociated
action from being performed.
-}
contextMenuItemNewFromStockAction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebKit2.Enums.ContextMenuAction
    {- ^ /@action@/: a 'GI.WebKit2.Enums.ContextMenuAction' stock action -}
    -> m ContextMenuItem
    {- ^ __Returns:__ the newly created 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object. -}
contextMenuItemNewFromStockAction action = liftIO $ do
    let action' = (fromIntegral . fromEnum) action
    result <- webkit_context_menu_item_new_from_stock_action action'
    checkUnexpectedReturnNULL "contextMenuItemNewFromStockAction" result
    result' <- (newObject ContextMenuItem) result
    return result'

-- method ContextMenuItem::new_from_stock_action_with_label
-- method type : Constructor
-- Args : [Arg {argCName = "action", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenuAction"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenuAction stock action", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a custom label text to use instead of the predefined one", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_context_menu_item_new_from_stock_action_with_label" webkit_context_menu_item_new_from_stock_action_with_label :: 
    CUInt ->                                -- action : TInterface (Name {namespace = "WebKit2", name = "ContextMenuAction"})
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr ContextMenuItem)

{- |
Creates a new 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for the given stock action using the given /@label@/.
Stock actions have a predefined label, this method can be used to create a
'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for a 'GI.WebKit2.Enums.ContextMenuAction' but using a custom label.
-}
contextMenuItemNewFromStockActionWithLabel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebKit2.Enums.ContextMenuAction
    {- ^ /@action@/: a 'GI.WebKit2.Enums.ContextMenuAction' stock action -}
    -> T.Text
    {- ^ /@label@/: a custom label text to use instead of the predefined one -}
    -> m ContextMenuItem
    {- ^ __Returns:__ the newly created 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object. -}
contextMenuItemNewFromStockActionWithLabel action label = liftIO $ do
    let action' = (fromIntegral . fromEnum) action
    label' <- textToCString label
    result <- webkit_context_menu_item_new_from_stock_action_with_label action' label'
    checkUnexpectedReturnNULL "contextMenuItemNewFromStockActionWithLabel" result
    result' <- (newObject ContextMenuItem) result
    freeMem label'
    return result'

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

foreign import ccall "webkit_context_menu_item_new_separator" webkit_context_menu_item_new_separator :: 
    IO (Ptr ContextMenuItem)

{- |
Creates a new 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' representing a separator.
-}
contextMenuItemNewSeparator ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ContextMenuItem
    {- ^ __Returns:__ the newly created 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object. -}
contextMenuItemNewSeparator  = liftIO $ do
    result <- webkit_context_menu_item_new_separator
    checkUnexpectedReturnNULL "contextMenuItemNewSeparator" result
    result' <- (newObject ContextMenuItem) result
    return result'

-- method ContextMenuItem::new_with_submenu
-- method type : Constructor
-- Args : [Arg {argCName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the menu item label text", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "submenu", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenu"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenu to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_context_menu_item_new_with_submenu" webkit_context_menu_item_new_with_submenu :: 
    CString ->                              -- label : TBasicType TUTF8
    Ptr WebKit2.ContextMenu.ContextMenu ->  -- submenu : TInterface (Name {namespace = "WebKit2", name = "ContextMenu"})
    IO (Ptr ContextMenuItem)

{- |
Creates a new 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' using the given /@label@/ with a submenu.
-}
contextMenuItemNewWithSubmenu ::
    (B.CallStack.HasCallStack, MonadIO m, WebKit2.ContextMenu.IsContextMenu a) =>
    T.Text
    {- ^ /@label@/: the menu item label text -}
    -> a
    {- ^ /@submenu@/: a 'GI.WebKit2.Objects.ContextMenu.ContextMenu' to set -}
    -> m ContextMenuItem
    {- ^ __Returns:__ the newly created 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object. -}
contextMenuItemNewWithSubmenu label submenu = liftIO $ do
    label' <- textToCString label
    submenu' <- unsafeManagedPtrCastPtr submenu
    result <- webkit_context_menu_item_new_with_submenu label' submenu'
    checkUnexpectedReturnNULL "contextMenuItemNewWithSubmenu" result
    result' <- (newObject ContextMenuItem) result
    touchManagedPtr submenu
    freeMem label'
    return result'

-- method ContextMenuItem::get_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "item", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenuItem", 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 "webkit_context_menu_item_get_action" webkit_context_menu_item_get_action :: 
    Ptr ContextMenuItem ->                  -- item : TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"})
    IO (Ptr Gtk.Action.Action)

{- |
Gets the action associated to /@item@/.
-}
contextMenuItemGetAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
    a
    {- ^ /@item@/: a 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' -}
    -> m Gtk.Action.Action
    {- ^ __Returns:__ the 'GI.Gtk.Objects.Action.Action' associated to the 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem',
   or 'Nothing' if /@item@/ is a separator. -}
contextMenuItemGetAction item = liftIO $ do
    item' <- unsafeManagedPtrCastPtr item
    result <- webkit_context_menu_item_get_action item'
    checkUnexpectedReturnNULL "contextMenuItemGetAction" result
    result' <- (newObject Gtk.Action.Action) result
    touchManagedPtr item
    return result'

data ContextMenuItemGetActionMethodInfo
instance (signature ~ (m Gtk.Action.Action), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetActionMethodInfo a signature where
    overloadedMethod _ = contextMenuItemGetAction

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

foreign import ccall "webkit_context_menu_item_get_stock_action" webkit_context_menu_item_get_stock_action :: 
    Ptr ContextMenuItem ->                  -- item : TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"})
    IO CUInt

{- |
Gets the 'GI.WebKit2.Enums.ContextMenuAction' of /@item@/. If the 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' was not
created for a stock action 'GI.WebKit2.Enums.ContextMenuActionCustom' will be
returned. If the 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' is a separator 'GI.WebKit2.Enums.ContextMenuActionNoAction'
will be returned.
-}
contextMenuItemGetStockAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
    a
    {- ^ /@item@/: a 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' -}
    -> m WebKit2.Enums.ContextMenuAction
    {- ^ __Returns:__ the 'GI.WebKit2.Enums.ContextMenuAction' of /@item@/ -}
contextMenuItemGetStockAction item = liftIO $ do
    item' <- unsafeManagedPtrCastPtr item
    result <- webkit_context_menu_item_get_stock_action item'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr item
    return result'

data ContextMenuItemGetStockActionMethodInfo
instance (signature ~ (m WebKit2.Enums.ContextMenuAction), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetStockActionMethodInfo a signature where
    overloadedMethod _ = contextMenuItemGetStockAction

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

foreign import ccall "webkit_context_menu_item_get_submenu" webkit_context_menu_item_get_submenu :: 
    Ptr ContextMenuItem ->                  -- item : TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"})
    IO (Ptr WebKit2.ContextMenu.ContextMenu)

{- |
Gets the submenu of /@item@/.
-}
contextMenuItemGetSubmenu ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
    a
    {- ^ /@item@/: a 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' -}
    -> m WebKit2.ContextMenu.ContextMenu
    {- ^ __Returns:__ the 'GI.WebKit2.Objects.ContextMenu.ContextMenu' representing the submenu of
   /@item@/ or 'Nothing' if /@item@/ doesn\'t have a submenu. -}
contextMenuItemGetSubmenu item = liftIO $ do
    item' <- unsafeManagedPtrCastPtr item
    result <- webkit_context_menu_item_get_submenu item'
    checkUnexpectedReturnNULL "contextMenuItemGetSubmenu" result
    result' <- (newObject WebKit2.ContextMenu.ContextMenu) result
    touchManagedPtr item
    return result'

data ContextMenuItemGetSubmenuMethodInfo
instance (signature ~ (m WebKit2.ContextMenu.ContextMenu), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetSubmenuMethodInfo a signature where
    overloadedMethod _ = contextMenuItemGetSubmenu

-- method ContextMenuItem::is_separator
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "item", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenuItem", 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 "webkit_context_menu_item_is_separator" webkit_context_menu_item_is_separator :: 
    Ptr ContextMenuItem ->                  -- item : TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"})
    IO CInt

{- |
Checks whether /@item@/ is a separator.
-}
contextMenuItemIsSeparator ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
    a
    {- ^ /@item@/: a 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' -}
    -> m Bool
    {- ^ __Returns:__ 'True' is /@item@/ is a separator or 'False' otherwise -}
contextMenuItemIsSeparator item = liftIO $ do
    item' <- unsafeManagedPtrCastPtr item
    result <- webkit_context_menu_item_is_separator item'
    let result' = (/= 0) result
    touchManagedPtr item
    return result'

data ContextMenuItemIsSeparatorMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemIsSeparatorMethodInfo a signature where
    overloadedMethod _ = contextMenuItemIsSeparator

-- method ContextMenuItem::set_submenu
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "item", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenuItem", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "submenu", argType = TInterface (Name {namespace = "WebKit2", name = "ContextMenu"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #WebKitContextMenu", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "webkit_context_menu_item_set_submenu" webkit_context_menu_item_set_submenu :: 
    Ptr ContextMenuItem ->                  -- item : TInterface (Name {namespace = "WebKit2", name = "ContextMenuItem"})
    Ptr WebKit2.ContextMenu.ContextMenu ->  -- submenu : TInterface (Name {namespace = "WebKit2", name = "ContextMenu"})
    IO ()

{- |
Sets or replaces the /@item@/ submenu. If /@submenu@/ is 'Nothing' the current
submenu of /@item@/ is removed.
-}
contextMenuItemSetSubmenu ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a, WebKit2.ContextMenu.IsContextMenu b) =>
    a
    {- ^ /@item@/: a 'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' -}
    -> Maybe (b)
    {- ^ /@submenu@/: a 'GI.WebKit2.Objects.ContextMenu.ContextMenu' -}
    -> m ()
contextMenuItemSetSubmenu item submenu = liftIO $ do
    item' <- unsafeManagedPtrCastPtr item
    maybeSubmenu <- case submenu of
        Nothing -> return nullPtr
        Just jSubmenu -> do
            jSubmenu' <- unsafeManagedPtrCastPtr jSubmenu
            return jSubmenu'
    webkit_context_menu_item_set_submenu item' maybeSubmenu
    touchManagedPtr item
    whenJust submenu touchManagedPtr
    return ()

data ContextMenuItemSetSubmenuMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsContextMenuItem a, WebKit2.ContextMenu.IsContextMenu b) => O.MethodInfo ContextMenuItemSetSubmenuMethodInfo a signature where
    overloadedMethod _ = contextMenuItemSetSubmenu