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 WebView
.
ContextMenu
represents a context menu containing
ContextMenuItem
s in a WebView
.
When a WebView
is about to display the context menu, it
emits the WebView::contextMenu signal, which has the
ContextMenu
as an argument. You can modify it, adding new
submenus that you can create with contextMenuNew
, adding
new ContextMenuItem
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 (Maybe ContextMenuItem)
- contextMenuGetEvent :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m Event
- contextMenuGetItemAtPosition :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> Word32 -> m (Maybe 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 (Maybe GVariant)
- contextMenuInsert :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) => a -> b -> Int32 -> m ()
- contextMenuLast :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m (Maybe 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.WebKit2.Objects.ContextMenu (==) :: ContextMenu -> ContextMenu -> Bool # (/=) :: ContextMenu -> ContextMenu -> Bool # | |
GObject ContextMenu Source # | |
Defined in GI.WebKit2.Objects.ContextMenu | |
ManagedPtrNewtype ContextMenu Source # | |
Defined in GI.WebKit2.Objects.ContextMenu toManagedPtr :: ContextMenu -> ManagedPtr ContextMenu | |
TypedObject ContextMenu Source # | |
Defined in GI.WebKit2.Objects.ContextMenu | |
HasParentTypes ContextMenu Source # | |
Defined in GI.WebKit2.Objects.ContextMenu | |
IsGValue (Maybe ContextMenu) Source # | Convert |
Defined in GI.WebKit2.Objects.ContextMenu gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ContextMenu -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ContextMenu) | |
type ParentTypes ContextMenu Source # | |
Defined in GI.WebKit2.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.WebKit2.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, getEvent, 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 (Maybe ContextMenuItem) | Returns: the first |
Gets the first item in the menu
.
getEvent
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m Event | Returns: the menu event or |
Gets the Event
that triggered the context menu. This function only returns a valid
Event
when called for a ContextMenu
passed to WebView::contextMenu
signal; in all other cases, Nothing
is returned.
The returned Event
is expected to be one of the following types:
<itemizedlist>
<listitem><para>
a EventButton
of type EventTypeButtonPress
when the context menu was triggered with mouse.
</para></listitem>
<listitem><para>
a EventKey
of type EventTypeKeyPress
if the keyboard was used to show the menu.
</para></listitem>
<listitem><para>
a generic Event
of type EventTypeNothing
when the Widget::popupMenu signal was used to show the context menu.
</para></listitem>
</itemizedlist>
Since: 2.40
getItemAtPosition
contextMenuGetItemAtPosition Source #
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> Word32 |
|
-> m (Maybe 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 (Maybe 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 ContextMenu
, the item is added on to the end of
the menu
. The first position is 0.
last
:: (HasCallStack, MonadIO m, IsContextMenu a) | |
=> a |
|
-> m (Maybe 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 ContextMenu
, 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 ContextMenu
object.
Creates a new ContextMenu
object to be used as a submenu of an existing
ContextMenu
. The context menu of a WebView
is created by the view
and passed as an argument of WebView::contextMenu signal.
To add items to the menu use contextMenuPrepend
,
contextMenuAppend
or contextMenuInsert
.
See also contextMenuNewWithItems
to create a ContextMenu
with
a list of initial items.
newWithItems
contextMenuNewWithItems Source #
:: (HasCallStack, MonadIO m, IsContextMenuItem a) | |
=> [a] |
|
-> m ContextMenu | Returns: The newly created |
Creates a new ContextMenu
object with the given items.
Creates a new ContextMenu
object to be used as a submenu of an existing
ContextMenu
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