{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.WebKit2.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.GArray as B.GArray
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.Coerce as Coerce
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 GHC.Records as R
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
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
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 :: (MIO.MonadIO m, IsContextMenuItem o) => o -> m ContextMenuItem
= IO ContextMenuItem -> m ContextMenuItem
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.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'
B.ManagedPtr.unsafeCastTo ManagedPtr ContextMenuItem -> ContextMenuItem
ContextMenuItem
instance B.GValue.IsGValue (Maybe ContextMenuItem) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_webkit_context_menu_item_get_type
gvalueSet_ :: Ptr GValue -> Maybe ContextMenuItem -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ContextMenuItem
P.Nothing = Ptr GValue -> Ptr ContextMenuItem -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ContextMenuItem
forall a. Ptr a
FP.nullPtr :: FP.Ptr ContextMenuItem)
gvalueSet_ Ptr GValue
gv (P.Just ContextMenuItem
obj) = ContextMenuItem -> (Ptr ContextMenuItem -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ContextMenuItem
obj (Ptr GValue -> Ptr ContextMenuItem -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe ContextMenuItem)
gvalueGet_ Ptr GValue
gv = do
Ptr ContextMenuItem
ptr <- Ptr GValue -> IO (Ptr ContextMenuItem)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ContextMenuItem)
if Ptr ContextMenuItem
ptr Ptr ContextMenuItem -> Ptr ContextMenuItem -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr ContextMenuItem
forall a. Ptr a
FP.nullPtr
then ContextMenuItem -> Maybe ContextMenuItem
forall a. a -> Maybe a
P.Just (ContextMenuItem -> Maybe ContextMenuItem)
-> IO ContextMenuItem -> IO (Maybe ContextMenuItem)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (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
else Maybe ContextMenuItem -> IO (Maybe ContextMenuItem)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ContextMenuItem
forall a. Maybe a
P.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.OverloadedMethod 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
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveContextMenuItemMethod t ContextMenuItem, O.OverloadedMethod info ContextMenuItem p, R.HasField t ContextMenuItem p) => R.HasField t ContextMenuItem p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveContextMenuItemMethod t ContextMenuItem, O.OverloadedMethodInfo info ContextMenuItem) => OL.IsLabel t (O.MethodProxy info ContextMenuItem) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#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.WebKit2.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) =>
WebKit2.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) =>
WebKit2.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 WebKit2.ContextMenu.ContextMenu ->
IO (Ptr ContextMenuItem)
contextMenuItemNewWithSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, WebKit2.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.WebKit2.Objects.ContextMenuItem.contextMenuItemGetGaction' instead."] #-}
contextMenuItemGetAction ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m (Maybe Gtk.Action.Action)
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
$ \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.OverloadedMethod ContextMenuItemGetActionMethodInfo a signature where
overloadedMethod = contextMenuItemGetAction
instance O.OverloadedMethodInfo ContextMenuItemGetActionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetAction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-ContextMenuItem.html#v: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 (Maybe Gio.Action.Action)
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
$ \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.OverloadedMethod ContextMenuItemGetGactionMethodInfo a signature where
overloadedMethod = contextMenuItemGetGaction
instance O.OverloadedMethodInfo ContextMenuItemGetGactionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetGaction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-ContextMenuItem.html#v: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 WebKit2.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 WebKit2.Enums.ContextMenuAction), MonadIO m, IsContextMenuItem a) => O.OverloadedMethod ContextMenuItemGetStockActionMethodInfo a signature where
overloadedMethod = contextMenuItemGetStockAction
instance O.OverloadedMethodInfo ContextMenuItemGetStockActionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetStockAction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-ContextMenuItem.html#v:contextMenuItemGetStockAction"
})
#endif
foreign import ccall "webkit_context_menu_item_get_submenu" ::
Ptr ContextMenuItem ->
IO (Ptr WebKit2.ContextMenu.ContextMenu)
contextMenuItemGetSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a) =>
a
-> m (Maybe WebKit2.ContextMenu.ContextMenu)
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
$ \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.OverloadedMethod ContextMenuItemGetSubmenuMethodInfo a signature where
overloadedMethod = contextMenuItemGetSubmenu
instance O.OverloadedMethodInfo ContextMenuItemGetSubmenuMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2.Objects.ContextMenuItem.contextMenuItemGetSubmenu",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-ContextMenuItem.html#v: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.OverloadedMethod ContextMenuItemIsSeparatorMethodInfo a signature where
overloadedMethod = contextMenuItemIsSeparator
instance O.OverloadedMethodInfo ContextMenuItemIsSeparatorMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2.Objects.ContextMenuItem.contextMenuItemIsSeparator",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-ContextMenuItem.html#v:contextMenuItemIsSeparator"
})
#endif
foreign import ccall "webkit_context_menu_item_set_submenu" ::
Ptr ContextMenuItem ->
Ptr WebKit2.ContextMenu.ContextMenu ->
IO ()
contextMenuItemSetSubmenu ::
(B.CallStack.HasCallStack, MonadIO m, IsContextMenuItem a, WebKit2.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, WebKit2.ContextMenu.IsContextMenu b) => O.OverloadedMethod ContextMenuItemSetSubmenuMethodInfo a signature where
overloadedMethod = contextMenuItemSetSubmenu
instance O.OverloadedMethodInfo ContextMenuItemSetSubmenuMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.WebKit2.Objects.ContextMenuItem.contextMenuItemSetSubmenu",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-webkit2-4.0.28/docs/GI-WebKit2-Objects-ContextMenuItem.html#v:contextMenuItemSetSubmenu"
})
#endif