Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Represents the context menu in a WebKitWebView
.
WebKitContextMenu
represents a context menu containing
WebKitContextMenuItem
s in a WebKitWebView
.
When a WebKitWebView
is about to display the context menu, it
emits the WebKitWebView::context-menu
signal, which has the
WebKitContextMenu
as an argument. You can modify it, adding new
submenus that you can create with contextMenuNew
, adding
new WebKitContextMenuItem
s with
contextMenuPrepend
, contextMenuAppend
or
contextMenuInsert
, maybe after having removed the
existing ones with contextMenuRemoveAll
.
Synopsis
- newtype ContextMenu = ContextMenu (ManagedPtr ContextMenu)
- class (GObject o, IsDescendantOf ContextMenu o) => IsContextMenu o
- toContextMenu :: (MonadIO m, IsContextMenu o) => o -> m ContextMenu
- contextMenuAppend :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) => a -> b -> m ()
- contextMenuFirst :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m ContextMenuItem
- contextMenuGetItemAtPosition :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> Word32 -> m ContextMenuItem
- contextMenuGetItems :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m [ContextMenuItem]
- contextMenuGetNItems :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m Word32
- contextMenuGetUserData :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m GVariant
- contextMenuInsert :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) => a -> b -> Int32 -> m ()
- contextMenuLast :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m ContextMenuItem
- contextMenuMoveItem :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) => a -> b -> Int32 -> m ()
- contextMenuNew :: (HasCallStack, MonadIO m) => m ContextMenu
- contextMenuNewWithItems :: (HasCallStack, MonadIO m, IsContextMenuItem a) => [a] -> m ContextMenu
- contextMenuPrepend :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) => a -> b -> m ()
- contextMenuRemove :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) => a -> b -> m ()
- contextMenuRemoveAll :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m ()
- contextMenuSetUserData :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> GVariant -> m ()
Exported types
newtype ContextMenu Source #
Memory-managed wrapper type.
ContextMenu (ManagedPtr ContextMenu) |
Instances
Eq ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu (==) :: ContextMenu -> ContextMenu -> Bool # (/=) :: ContextMenu -> ContextMenu -> Bool # | |
GObject ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu | |
ManagedPtrNewtype ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu toManagedPtr :: ContextMenu -> ManagedPtr ContextMenu | |
TypedObject ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu | |
HasParentTypes ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu | |
IsGValue (Maybe ContextMenu) Source # | Convert |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ContextMenu -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ContextMenu) | |
type ParentTypes ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu type ParentTypes ContextMenu = '[Object] |
class (GObject o, IsDescendantOf ContextMenu o) => IsContextMenu o Source #
Type class for types which can be safely cast to ContextMenu
, for instance with toContextMenu
.
Instances
(GObject o, IsDescendantOf ContextMenu o) => IsContextMenu o Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu |
toContextMenu :: (MonadIO m, IsContextMenu o) => o -> m ContextMenu Source #
Cast to ContextMenu
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
append, bindProperty, bindPropertyFull, first, forceFloating, freezeNotify, getv, insert, isFloating, last, moveItem, notify, notifyByPspec, prepend, ref, refSink, remove, removeAll, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getItemAtPosition, getItems, getNItems, getProperty, getQdata, getUserData.
Setters
append
:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
=> a |
|
-> b |
|
-> m () |
Adds item
at the end of the menu
.
first
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m ContextMenuItem | Returns: the first |
Gets the first item in the menu
.
getItemAtPosition
contextMenuGetItemAtPosition Source #
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> Word32 |
|
-> m ContextMenuItem | Returns: the |
Gets the item at the given position in the menu
.
getItems
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m [ContextMenuItem] | Returns: a |
Returns the item list of menu
.
getNItems
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m Word32 | Returns: the number of |
Gets the length of the menu
.
getUserData
contextMenuGetUserData Source #
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m GVariant | Returns: the user data of |
Gets the user data of menu
.
This function can be used from the UI Process to get user data previously set
from the Web Process with contextMenuSetUserData
.
Since: 2.8
insert
:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
=> a |
|
-> b |
|
-> Int32 |
|
-> m () |
Inserts item
into the menu
at the given position.
If position
is negative, or is larger than the number of items
in the WebKitContextMenu
, the item is added on to the end of
the menu
. The first position is 0.
last
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m ContextMenuItem | Returns: the last |
Gets the last item in the menu
.
moveItem
:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
=> a |
|
-> b |
|
-> Int32 |
|
-> m () |
Moves item
to the given position in the menu
.
If position
is negative, or is larger than the number of items
in the WebKitContextMenu
, the item is added on to the end of
the menu
.
The first position is 0.
new
:: (HasCallStack, MonadIO m) | |
=> m ContextMenu | Returns: The newly created |
Creates a new WebKitContextMenu
object.
Creates a new WebKitContextMenu
object to be used as a submenu of an existing
WebKitContextMenu
. The context menu of a WebKitWebView
is created by the view
and passed as an argument of WebKitWebView::context-menu
signal.
To add items to the menu use contextMenuPrepend
,
contextMenuAppend
or contextMenuInsert
.
See also contextMenuNewWithItems
to create a WebKitContextMenu
with
a list of initial items.
newWithItems
contextMenuNewWithItems Source #
:: (HasCallStack, MonadIO m, IsContextMenuItem a) | |
=> [a] |
|
-> m ContextMenu | Returns: The newly created |
Creates a new WebKitContextMenu
object with the given items.
Creates a new WebKitContextMenu
object to be used as a submenu of an existing
WebKitContextMenu
with the given initial items.
See also contextMenuNew
prepend
:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
=> a |
|
-> b |
|
-> m () |
Adds item
at the beginning of the menu
.
remove
:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
=> a |
|
-> b |
|
-> m () |
Removes item
from the menu
.
See also contextMenuRemoveAll
to remove all items.
removeAll
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m () |
Removes all items of the menu
.
setUserData
contextMenuSetUserData Source #
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> GVariant |
|
-> m () |
Sets user data to menu
.
This function can be used from a Web Process extension to set user data
that can be retrieved from the UI Process using contextMenuGetUserData
.
If the userData
GVariant
is floating, it is consumed.
Since: 2.8