{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.WebKit2.Objects.ContextMenuItem
    ( 

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


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

#if defined(ENABLE_OVERLOADING)
    ResolveContextMenuItemMethod            ,
#endif


-- ** getAction #method:getAction#

#if defined(ENABLE_OVERLOADING)
    ContextMenuItemGetActionMethodInfo      ,
#endif
    contextMenuItemGetAction                ,


-- ** getGaction #method:getGaction#

#if defined(ENABLE_OVERLOADING)
    ContextMenuItemGetGactionMethodInfo     ,
#endif
    contextMenuItemGetGaction               ,


-- ** getStockAction #method:getStockAction#

#if defined(ENABLE_OVERLOADING)
    ContextMenuItemGetStockActionMethodInfo ,
#endif
    contextMenuItemGetStockAction           ,


-- ** getSubmenu #method:getSubmenu#

#if defined(ENABLE_OVERLOADING)
    ContextMenuItemGetSubmenuMethodInfo     ,
#endif
    contextMenuItemGetSubmenu               ,


-- ** isSeparator #method:isSeparator#

#if defined(ENABLE_OVERLOADING)
    ContextMenuItemIsSeparatorMethodInfo    ,
#endif
    contextMenuItemIsSeparator              ,


-- ** new #method:new#

    contextMenuItemNew                      ,


-- ** newFromGaction #method:newFromGaction#

    contextMenuItemNewFromGaction           ,


-- ** newFromStockAction #method:newFromStockAction#

    contextMenuItemNewFromStockAction       ,


-- ** newFromStockActionWithLabel #method:newFromStockActionWithLabel#

    contextMenuItemNewFromStockActionWithLabel,


-- ** newSeparator #method:newSeparator#

    contextMenuItemNewSeparator             ,


-- ** newWithSubmenu #method:newWithSubmenu#

    contextMenuItemNewWithSubmenu           ,


-- ** setSubmenu #method:setSubmenu#

#if defined(ENABLE_OVERLOADING)
    ContextMenuItemSetSubmenuMethodInfo     ,
#endif
    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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.Action as Gio.Action
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

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

instance GObject ContextMenuItem where
    gobjectType :: IO GType
gobjectType = IO GType
c_webkit_context_menu_item_get_type
    

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

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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `ContextMenuItem`.
noContextMenuItem :: Maybe ContextMenuItem
noContextMenuItem :: Maybe ContextMenuItem
noContextMenuItem = Maybe ContextMenuItem
forall a. Maybe a
Nothing

#if defined(ENABLE_OVERLOADING)
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 "getv" o = GObject.Object.ObjectGetvMethodInfo
    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 "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 "getGaction" o = ContextMenuItemGetGactionMethodInfo
    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 "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    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) => OL.IsLabel t (ContextMenuItem -> 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 ContextMenuItem
type instance O.AttributeList ContextMenuItem = ContextMenuItemAttributeList
type ContextMenuItemAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif

-- 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)

{-# DEPRECATED contextMenuItemNew ["(Since version 2.18)","Use 'GI.WebKit2.Objects.ContextMenuItem.contextMenuItemNewFromGaction' instead."] #-}
-- | Creates a new t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for the given /@action@/.
contextMenuItemNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.Action.IsAction a) =>
    a
    -- ^ /@action@/: a t'GI.Gtk.Objects.Action.Action'
    -> m ContextMenuItem
    -- ^ __Returns:__ the newly created t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object.
contextMenuItemNew :: a -> m ContextMenuItem
contextMenuItemNew action :: a
action = IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuItem -> m ContextMenuItem)
-> IO ContextMenuItem -> m ContextMenuItem
forall a b. (a -> b) -> a -> b
$ do
    Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
    Ptr ContextMenuItem
result <- Ptr Action -> IO (Ptr ContextMenuItem)
webkit_context_menu_item_new Ptr Action
action'
    Text -> Ptr ContextMenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "contextMenuItemNew" Ptr ContextMenuItem
result
    ContextMenuItem
result' <- ((ManagedPtr ContextMenuItem -> ContextMenuItem)
-> Ptr ContextMenuItem -> IO ContextMenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem) Ptr ContextMenuItem
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
    ContextMenuItem -> IO ContextMenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuItem
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method ContextMenuItem::new_from_gaction
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "action"
--           , argType = TInterface Name { namespace = "Gio" , name = "Action" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GAction" , 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 "the menu item label text"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "target"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GVariant to use as the action target"
--                 , 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_gaction" webkit_context_menu_item_new_from_gaction :: 
    Ptr Gio.Action.Action ->                -- action : TInterface (Name {namespace = "Gio", name = "Action"})
    CString ->                              -- label : TBasicType TUTF8
    Ptr GVariant ->                         -- target : TVariant
    IO (Ptr ContextMenuItem)

-- | Creates a new t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for the given /@action@/ and /@label@/. On activation
-- /@target@/ will be passed as parameter to the callback.
-- 
-- /Since: 2.18/
contextMenuItemNewFromGaction ::
    (B.CallStack.HasCallStack, MonadIO m, Gio.Action.IsAction a) =>
    a
    -- ^ /@action@/: a t'GI.Gio.Interfaces.Action.Action'
    -> T.Text
    -- ^ /@label@/: the menu item label text
    -> Maybe (GVariant)
    -- ^ /@target@/: a t'GVariant' to use as the action target
    -> m ContextMenuItem
    -- ^ __Returns:__ the newly created t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object.
contextMenuItemNewFromGaction :: a -> Text -> Maybe GVariant -> m ContextMenuItem
contextMenuItemNewFromGaction action :: a
action label :: Text
label target :: Maybe GVariant
target = IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuItem -> m ContextMenuItem)
-> IO ContextMenuItem -> m ContextMenuItem
forall a b. (a -> b) -> a -> b
$ do
    Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
    CString
label' <- Text -> IO CString
textToCString Text
label
    Ptr GVariant
maybeTarget <- case Maybe GVariant
target of
        Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just jTarget :: GVariant
jTarget -> do
            Ptr GVariant
jTarget' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jTarget
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jTarget'
    Ptr ContextMenuItem
result <- Ptr Action -> CString -> Ptr GVariant -> IO (Ptr ContextMenuItem)
webkit_context_menu_item_new_from_gaction Ptr Action
action' CString
label' Ptr GVariant
maybeTarget
    Text -> Ptr ContextMenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "contextMenuItemNewFromGaction" Ptr ContextMenuItem
result
    ContextMenuItem
result' <- ((ManagedPtr ContextMenuItem -> ContextMenuItem)
-> Ptr ContextMenuItem -> IO ContextMenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem) Ptr ContextMenuItem
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
    Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
target GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
label'
    ContextMenuItem -> IO ContextMenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuItem
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- 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 t'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 t'GI.Gtk.Objects.Action.Action' of a
-- t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' created with a t'GI.WebKit2.Enums.ContextMenuAction' with
-- 'GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetAction' and connect to [activate]("GI.Gtk.Objects.Action#signal:activate") signal
-- to be notified when the item is activated. But you can\'t prevent the associated
-- action from being performed.
contextMenuItemNewFromStockAction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebKit2.Enums.ContextMenuAction
    -- ^ /@action@/: a t'GI.WebKit2.Enums.ContextMenuAction' stock action
    -> m ContextMenuItem
    -- ^ __Returns:__ the newly created t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object.
contextMenuItemNewFromStockAction :: ContextMenuAction -> m ContextMenuItem
contextMenuItemNewFromStockAction action :: ContextMenuAction
action = IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuItem -> m ContextMenuItem)
-> IO ContextMenuItem -> m ContextMenuItem
forall a b. (a -> b) -> a -> b
$ do
    let action' :: CUInt
action' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (ContextMenuAction -> Int) -> ContextMenuAction -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContextMenuAction -> Int
forall a. Enum a => a -> Int
fromEnum) ContextMenuAction
action
    Ptr ContextMenuItem
result <- CUInt -> IO (Ptr ContextMenuItem)
webkit_context_menu_item_new_from_stock_action CUInt
action'
    Text -> Ptr ContextMenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "contextMenuItemNewFromStockAction" Ptr ContextMenuItem
result
    ContextMenuItem
result' <- ((ManagedPtr ContextMenuItem -> ContextMenuItem)
-> Ptr ContextMenuItem -> IO ContextMenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem) Ptr ContextMenuItem
result
    ContextMenuItem -> IO ContextMenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuItem
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- 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 t'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
-- t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' for a t'GI.WebKit2.Enums.ContextMenuAction' but using a custom label.
contextMenuItemNewFromStockActionWithLabel ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    WebKit2.Enums.ContextMenuAction
    -- ^ /@action@/: a t'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 t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object.
contextMenuItemNewFromStockActionWithLabel :: ContextMenuAction -> Text -> m ContextMenuItem
contextMenuItemNewFromStockActionWithLabel action :: ContextMenuAction
action label :: Text
label = IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuItem -> m ContextMenuItem)
-> IO ContextMenuItem -> m ContextMenuItem
forall a b. (a -> b) -> a -> b
$ do
    let action' :: CUInt
action' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (ContextMenuAction -> Int) -> ContextMenuAction -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ContextMenuAction -> Int
forall a. Enum a => a -> Int
fromEnum) ContextMenuAction
action
    CString
label' <- Text -> IO CString
textToCString Text
label
    Ptr ContextMenuItem
result <- CUInt -> CString -> IO (Ptr ContextMenuItem)
webkit_context_menu_item_new_from_stock_action_with_label CUInt
action' CString
label'
    Text -> Ptr ContextMenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "contextMenuItemNewFromStockActionWithLabel" Ptr ContextMenuItem
result
    ContextMenuItem
result' <- ((ManagedPtr ContextMenuItem -> ContextMenuItem)
-> Ptr ContextMenuItem -> IO ContextMenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem) Ptr ContextMenuItem
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
label'
    ContextMenuItem -> IO ContextMenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuItem
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- 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 t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' representing a separator.
contextMenuItemNewSeparator ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m ContextMenuItem
    -- ^ __Returns:__ the newly created t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object.
contextMenuItemNewSeparator :: m ContextMenuItem
contextMenuItemNewSeparator  = IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuItem -> m ContextMenuItem)
-> IO ContextMenuItem -> m ContextMenuItem
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContextMenuItem
result <- IO (Ptr ContextMenuItem)
webkit_context_menu_item_new_separator
    Text -> Ptr ContextMenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "contextMenuItemNewSeparator" Ptr ContextMenuItem
result
    ContextMenuItem
result' <- ((ManagedPtr ContextMenuItem -> ContextMenuItem)
-> Ptr ContextMenuItem -> IO ContextMenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem) Ptr ContextMenuItem
result
    ContextMenuItem -> IO ContextMenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuItem
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- 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 t'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 t'GI.WebKit2.Objects.ContextMenu.ContextMenu' to set
    -> m ContextMenuItem
    -- ^ __Returns:__ the newly created t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' object.
contextMenuItemNewWithSubmenu :: Text -> a -> m ContextMenuItem
contextMenuItemNewWithSubmenu label :: Text
label submenu :: a
submenu = IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuItem -> m ContextMenuItem)
-> IO ContextMenuItem -> m ContextMenuItem
forall a b. (a -> b) -> a -> b
$ do
    CString
label' <- Text -> IO CString
textToCString Text
label
    Ptr ContextMenu
submenu' <- a -> IO (Ptr ContextMenu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
submenu
    Ptr ContextMenuItem
result <- CString -> Ptr ContextMenu -> IO (Ptr ContextMenuItem)
webkit_context_menu_item_new_with_submenu CString
label' Ptr ContextMenu
submenu'
    Text -> Ptr ContextMenuItem -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "contextMenuItemNewWithSubmenu" Ptr ContextMenuItem
result
    ContextMenuItem
result' <- ((ManagedPtr ContextMenuItem -> ContextMenuItem)
-> Ptr ContextMenuItem -> IO ContextMenuItem
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem) Ptr ContextMenuItem
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
submenu
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
label'
    ContextMenuItem -> IO ContextMenuItem
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuItem
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- 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)

{-# DEPRECATED contextMenuItemGetAction ["(Since version 2.18)","Use 'GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetGaction' instead."] #-}
-- | Gets the action associated to /@item@/ as a t'GI.Gtk.Objects.Action.Action'.
contextMenuItemGetAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
    a
    -- ^ /@item@/: a t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem'
    -> m (Maybe Gtk.Action.Action)
    -- ^ __Returns:__ the t'GI.Gtk.Objects.Action.Action' associated to the t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem',
    --    or 'P.Nothing' if /@item@/ is a separator.
contextMenuItemGetAction :: a -> m (Maybe Action)
contextMenuItemGetAction item :: a
item = IO (Maybe Action) -> m (Maybe Action)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Action) -> m (Maybe Action))
-> IO (Maybe Action) -> m (Maybe Action)
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContextMenuItem
item' <- a -> IO (Ptr ContextMenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
item
    Ptr Action
result <- Ptr ContextMenuItem -> IO (Ptr Action)
webkit_context_menu_item_get_action Ptr ContextMenuItem
item'
    Maybe Action
maybeResult <- Ptr Action -> (Ptr Action -> IO Action) -> IO (Maybe Action)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Action
result ((Ptr Action -> IO Action) -> IO (Maybe Action))
-> (Ptr Action -> IO Action) -> IO (Maybe Action)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Action
result' -> do
        Action
result'' <- ((ManagedPtr Action -> Action) -> Ptr Action -> IO Action
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Action -> Action
Gtk.Action.Action) Ptr Action
result'
        Action -> IO Action
forall (m :: * -> *) a. Monad m => a -> m a
return Action
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
    Maybe Action -> IO (Maybe Action)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Action
maybeResult

#if defined(ENABLE_OVERLOADING)
data ContextMenuItemGetActionMethodInfo
instance (signature ~ (m (Maybe Gtk.Action.Action)), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetActionMethodInfo a signature where
    overloadedMethod = contextMenuItemGetAction

#endif

-- method ContextMenuItem::get_gaction
-- 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 = "Gio" , name = "Action" })
-- throws : False
-- Skip return : False

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

-- | Gets the action associated to /@item@/ as a t'GI.Gio.Interfaces.Action.Action'.
-- 
-- /Since: 2.18/
contextMenuItemGetGaction ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
    a
    -- ^ /@item@/: a t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem'
    -> m (Maybe Gio.Action.Action)
    -- ^ __Returns:__ the t'GI.Gio.Interfaces.Action.Action' associated to the t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem',
    --    or 'P.Nothing' if /@item@/ is a separator.
contextMenuItemGetGaction :: a -> m (Maybe Action)
contextMenuItemGetGaction item :: a
item = IO (Maybe Action) -> m (Maybe Action)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Action) -> m (Maybe Action))
-> IO (Maybe Action) -> m (Maybe Action)
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContextMenuItem
item' <- a -> IO (Ptr ContextMenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
item
    Ptr Action
result <- Ptr ContextMenuItem -> IO (Ptr Action)
webkit_context_menu_item_get_gaction Ptr ContextMenuItem
item'
    Maybe Action
maybeResult <- Ptr Action -> (Ptr Action -> IO Action) -> IO (Maybe Action)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Action
result ((Ptr Action -> IO Action) -> IO (Maybe Action))
-> (Ptr Action -> IO Action) -> IO (Maybe Action)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr Action
result' -> do
        Action
result'' <- ((ManagedPtr Action -> Action) -> Ptr Action -> IO Action
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Action -> Action
Gio.Action.Action) Ptr Action
result'
        Action -> IO Action
forall (m :: * -> *) a. Monad m => a -> m a
return Action
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
    Maybe Action -> IO (Maybe Action)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Action
maybeResult

#if defined(ENABLE_OVERLOADING)
data ContextMenuItemGetGactionMethodInfo
instance (signature ~ (m (Maybe Gio.Action.Action)), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetGactionMethodInfo a signature where
    overloadedMethod = contextMenuItemGetGaction

#endif

-- 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 t'GI.WebKit2.Enums.ContextMenuAction' of /@item@/. If the t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem' was not
-- created for a stock action 'GI.WebKit2.Enums.ContextMenuActionCustom' will be
-- returned. If the t'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 t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem'
    -> m WebKit2.Enums.ContextMenuAction
    -- ^ __Returns:__ the t'GI.WebKit2.Enums.ContextMenuAction' of /@item@/
contextMenuItemGetStockAction :: a -> m ContextMenuAction
contextMenuItemGetStockAction item :: a
item = IO ContextMenuAction -> m ContextMenuAction
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenuAction -> m ContextMenuAction)
-> IO ContextMenuAction -> m ContextMenuAction
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContextMenuItem
item' <- a -> IO (Ptr ContextMenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
item
    CUInt
result <- Ptr ContextMenuItem -> IO CUInt
webkit_context_menu_item_get_stock_action Ptr ContextMenuItem
item'
    let result' :: ContextMenuAction
result' = (Int -> ContextMenuAction
forall a. Enum a => Int -> a
toEnum (Int -> ContextMenuAction)
-> (CUInt -> Int) -> CUInt -> ContextMenuAction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
    ContextMenuAction -> IO ContextMenuAction
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenuAction
result'

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

#endif

-- 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 t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem'
    -> m (Maybe WebKit2.ContextMenu.ContextMenu)
    -- ^ __Returns:__ the t'GI.WebKit2.Objects.ContextMenu.ContextMenu' representing the submenu of
    --    /@item@/ or 'P.Nothing' if /@item@/ doesn\'t have a submenu.
contextMenuItemGetSubmenu :: a -> m (Maybe ContextMenu)
contextMenuItemGetSubmenu item :: a
item = IO (Maybe ContextMenu) -> m (Maybe ContextMenu)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe ContextMenu) -> m (Maybe ContextMenu))
-> IO (Maybe ContextMenu) -> m (Maybe ContextMenu)
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContextMenuItem
item' <- a -> IO (Ptr ContextMenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
item
    Ptr ContextMenu
result <- Ptr ContextMenuItem -> IO (Ptr ContextMenu)
webkit_context_menu_item_get_submenu Ptr ContextMenuItem
item'
    Maybe ContextMenu
maybeResult <- Ptr ContextMenu
-> (Ptr ContextMenu -> IO ContextMenu) -> IO (Maybe ContextMenu)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr ContextMenu
result ((Ptr ContextMenu -> IO ContextMenu) -> IO (Maybe ContextMenu))
-> (Ptr ContextMenu -> IO ContextMenu) -> IO (Maybe ContextMenu)
forall a b. (a -> b) -> a -> b
$ \result' :: Ptr ContextMenu
result' -> do
        ContextMenu
result'' <- ((ManagedPtr ContextMenu -> ContextMenu)
-> Ptr ContextMenu -> IO ContextMenu
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ContextMenu -> ContextMenu
WebKit2.ContextMenu.ContextMenu) Ptr ContextMenu
result'
        ContextMenu -> IO ContextMenu
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenu
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
    Maybe ContextMenu -> IO (Maybe ContextMenu)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ContextMenu
maybeResult

#if defined(ENABLE_OVERLOADING)
data ContextMenuItemGetSubmenuMethodInfo
instance (signature ~ (m (Maybe WebKit2.ContextMenu.ContextMenu)), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetSubmenuMethodInfo a signature where
    overloadedMethod = contextMenuItemGetSubmenu

#endif

-- 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 t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem'
    -> m Bool
    -- ^ __Returns:__ 'P.True' is /@item@/ is a separator or 'P.False' otherwise
contextMenuItemIsSeparator :: a -> m Bool
contextMenuItemIsSeparator item :: a
item = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    Ptr ContextMenuItem
item' <- a -> IO (Ptr ContextMenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
item
    CInt
result <- Ptr ContextMenuItem -> IO CInt
webkit_context_menu_item_is_separator Ptr ContextMenuItem
item'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

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

#endif

-- 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 'P.Nothing' the current
-- submenu of /@item@/ is removed.
contextMenuItemSetSubmenu ::
    (B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a, WebKit2.ContextMenu.IsContextMenu b) =>
    a
    -- ^ /@item@/: a t'GI.WebKit2.Objects.ContextMenuItem.ContextMenuItem'
    -> Maybe (b)
    -- ^ /@submenu@/: a t'GI.WebKit2.Objects.ContextMenu.ContextMenu'
    -> m ()
contextMenuItemSetSubmenu :: a -> Maybe b -> m ()
contextMenuItemSetSubmenu item :: a
item submenu :: Maybe 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 ContextMenuItem
item' <- a -> IO (Ptr ContextMenuItem)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
item
    Ptr ContextMenu
maybeSubmenu <- case Maybe b
submenu of
        Nothing -> Ptr ContextMenu -> IO (Ptr ContextMenu)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ContextMenu
forall a. Ptr a
nullPtr
        Just jSubmenu :: b
jSubmenu -> do
            Ptr ContextMenu
jSubmenu' <- b -> IO (Ptr ContextMenu)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSubmenu
            Ptr ContextMenu -> IO (Ptr ContextMenu)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ContextMenu
jSubmenu'
    Ptr ContextMenuItem -> Ptr ContextMenu -> IO ()
webkit_context_menu_item_set_submenu Ptr ContextMenuItem
item' Ptr ContextMenu
maybeSubmenu
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
submenu b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

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

#endif