{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.WebKit2WebExtension.Objects.ContextMenuItem
(
ContextMenuItem(..) ,
IsContextMenuItem ,
toContextMenuItem ,
#if defined(ENABLE_OVERLOADING)
ResolveContextMenuItemMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ContextMenuItemGetActionMethodInfo ,
#endif
contextMenuItemGetAction ,
#if defined(ENABLE_OVERLOADING)
ContextMenuItemGetGactionMethodInfo ,
#endif
contextMenuItemGetGaction ,
#if defined(ENABLE_OVERLOADING)
ContextMenuItemGetStockActionMethodInfo ,
#endif
contextMenuItemGetStockAction ,
#if defined(ENABLE_OVERLOADING)
ContextMenuItemGetSubmenuMethodInfo ,
#endif
contextMenuItemGetSubmenu ,
#if defined(ENABLE_OVERLOADING)
ContextMenuItemIsSeparatorMethodInfo ,
#endif
contextMenuItemIsSeparator ,
contextMenuItemNew ,
contextMenuItemNewFromGaction ,
contextMenuItemNewFromStockAction ,
contextMenuItemNewFromStockActionWithLabel,
contextMenuItemNewSeparator ,
contextMenuItemNewWithSubmenu ,
#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.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 qualified GI.Gio.Interfaces.Action as Gio.Action
import qualified GI.Gtk.Objects.Action as Gtk.Action
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Enums as WebKit2WebExtension.Enums
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.ContextMenu as WebKit2WebExtension.ContextMenu
newtype = (SP.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)
instance SP.ManagedPtrNewtype ContextMenuItem where
toManagedPtr :: ContextMenuItem -> ManagedPtr ContextMenuItem
toManagedPtr (ContextMenuItem ManagedPtr ContextMenuItem
p) = ManagedPtr ContextMenuItem
p
foreign import ccall "webkit_context_menu_item_get_type"
:: IO B.Types.GType
instance B.Types.TypedObject ContextMenuItem where
glibType :: IO GType
glibType = IO GType
c_webkit_context_menu_item_get_type
instance B.Types.GObject ContextMenuItem
instance B.GValue.IsGValue ContextMenuItem where
toGValue :: ContextMenuItem -> IO GValue
toGValue 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 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
class (SP.GObject o, O.IsDescendantOf ContextMenuItem o) => o
instance (SP.GObject o, O.IsDescendantOf ContextMenuItem o) => IsContextMenuItem o
instance O.HasParentTypes ContextMenuItem
type instance O.ParentTypes ContextMenuItem = '[GObject.Object.Object]
toContextMenuItem :: (MonadIO m, IsContextMenuItem o) => o -> m ContextMenuItem
= 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, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem
#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
foreign import ccall "webkit_context_menu_item_new" ::
Ptr Gtk.Action.Action ->
IO (Ptr ContextMenuItem)
{-# DEPRECATED contextMenuItemNew ["(Since version 2.18)","Use 'GI.WebKit2WebExtension.Objects.ContextMenuItem.contextMenuItemNewFromGaction' instead."] #-}
contextMenuItemNew ::
(B.CallStack.HasCallStack, MonadIO m, Gtk.Action.IsAction a) =>
a
-> m ContextMenuItem
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 Text
"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
foreign import ccall "webkit_context_menu_item_new_from_gaction" ::
Ptr Gio.Action.Action ->
CString ->
Ptr GVariant ->
IO (Ptr ContextMenuItem)
contextMenuItemNewFromGaction ::
(B.CallStack.HasCallStack, MonadIO m, Gio.Action.IsAction a) =>
a
-> T.Text
-> Maybe (GVariant)
-> m ContextMenuItem
a
action Text
label 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
Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
Just 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 Text
"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
foreign import ccall "webkit_context_menu_item_new_from_stock_action" ::
CUInt ->
IO (Ptr ContextMenuItem)
contextMenuItemNewFromStockAction ::
(B.CallStack.HasCallStack, MonadIO m) =>
WebKit2WebExtension.Enums.ContextMenuAction
-> m ContextMenuItem
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 Text
"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
foreign import ccall "webkit_context_menu_item_new_from_stock_action_with_label" ::
CUInt ->
CString ->
IO (Ptr ContextMenuItem)
contextMenuItemNewFromStockActionWithLabel ::
(B.CallStack.HasCallStack, MonadIO m) =>
WebKit2WebExtension.Enums.ContextMenuAction
-> T.Text
-> m ContextMenuItem
ContextMenuAction
action 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 Text
"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
foreign import ccall "webkit_context_menu_item_new_separator" ::
IO (Ptr ContextMenuItem)
contextMenuItemNewSeparator ::
(B.CallStack.HasCallStack, MonadIO m) =>
m ContextMenuItem
= 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 Text
"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
foreign import ccall "webkit_context_menu_item_new_with_submenu" ::
CString ->
Ptr WebKit2WebExtension.ContextMenu.ContextMenu ->
IO (Ptr ContextMenuItem)
contextMenuItemNewWithSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, WebKit2WebExtension.ContextMenu.IsContextMenu a) =>
T.Text
-> a
-> m ContextMenuItem
Text
label 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 Text
"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
foreign import ccall "webkit_context_menu_item_get_action" ::
Ptr ContextMenuItem ->
IO (Ptr Gtk.Action.Action)
{-# DEPRECATED contextMenuItemGetAction ["(Since version 2.18)","Use 'GI.WebKit2WebExtension.Objects.ContextMenuItem.contextMenuItemGetGaction' instead."] #-}
contextMenuItemGetAction ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m Gtk.Action.Action
a
item = IO Action -> m Action
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Action -> m Action) -> IO Action -> m 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'
Text -> Ptr Action -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contextMenuItemGetAction" Ptr Action
result
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
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
Action -> IO Action
forall (m :: * -> *) a. Monad m => a -> m a
return Action
result'
#if defined(ENABLE_OVERLOADING)
data ContextMenuItemGetActionMethodInfo
instance (signature ~ (m Gtk.Action.Action), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetActionMethodInfo a signature where
overloadedMethod = contextMenuItemGetAction
#endif
foreign import ccall "webkit_context_menu_item_get_gaction" ::
Ptr ContextMenuItem ->
IO (Ptr Gio.Action.Action)
contextMenuItemGetGaction ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m Gio.Action.Action
a
item = IO Action -> m Action
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Action -> m Action) -> IO Action -> m 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'
Text -> Ptr Action -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contextMenuItemGetGaction" Ptr Action
result
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
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
Action -> IO Action
forall (m :: * -> *) a. Monad m => a -> m a
return Action
result'
#if defined(ENABLE_OVERLOADING)
data ContextMenuItemGetGactionMethodInfo
instance (signature ~ (m Gio.Action.Action), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetGactionMethodInfo a signature where
overloadedMethod = contextMenuItemGetGaction
#endif
foreign import ccall "webkit_context_menu_item_get_stock_action" ::
Ptr ContextMenuItem ->
IO CUInt
contextMenuItemGetStockAction ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m WebKit2WebExtension.Enums.ContextMenuAction
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 WebKit2WebExtension.Enums.ContextMenuAction), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetStockActionMethodInfo a signature where
overloadedMethod = contextMenuItemGetStockAction
#endif
foreign import ccall "webkit_context_menu_item_get_submenu" ::
Ptr ContextMenuItem ->
IO (Ptr WebKit2WebExtension.ContextMenu.ContextMenu)
contextMenuItemGetSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m WebKit2WebExtension.ContextMenu.ContextMenu
a
item = IO ContextMenu -> m ContextMenu
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ContextMenu -> m ContextMenu)
-> IO ContextMenu -> m 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'
Text -> Ptr ContextMenu -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"contextMenuItemGetSubmenu" Ptr ContextMenu
result
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
WebKit2WebExtension.ContextMenu.ContextMenu) Ptr ContextMenu
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
item
ContextMenu -> IO ContextMenu
forall (m :: * -> *) a. Monad m => a -> m a
return ContextMenu
result'
#if defined(ENABLE_OVERLOADING)
data ContextMenuItemGetSubmenuMethodInfo
instance (signature ~ (m WebKit2WebExtension.ContextMenu.ContextMenu), MonadIO m, IsContextMenuItem a) => O.MethodInfo ContextMenuItemGetSubmenuMethodInfo a signature where
overloadedMethod = contextMenuItemGetSubmenu
#endif
foreign import ccall "webkit_context_menu_item_is_separator" ::
Ptr ContextMenuItem ->
IO CInt
contextMenuItemIsSeparator ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m Bool
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
/= CInt
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
foreign import ccall "webkit_context_menu_item_set_submenu" ::
Ptr ContextMenuItem ->
Ptr WebKit2WebExtension.ContextMenu.ContextMenu ->
IO ()
contextMenuItemSetSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a, WebKit2WebExtension.ContextMenu.IsContextMenu b) =>
a
-> Maybe (b)
-> m ()
a
item 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
Maybe b
Nothing -> Ptr ContextMenu -> IO (Ptr ContextMenu)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ContextMenu
forall a. Ptr a
nullPtr
Just 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, WebKit2WebExtension.ContextMenu.IsContextMenu b) => O.MethodInfo ContextMenuItemSetSubmenuMethodInfo a signature where
overloadedMethod = contextMenuItemSetSubmenu
#endif