| 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 |
GI.WebKit2WebExtension.Objects.ContextMenu
Description
Represents the context menu in a WebKitWebView.
ContextMenu represents a context menu containing
ContextMenuItems in a WebKitWebView.
When a WebKitWebView is about to display the context menu, it
emits the WebKitWebView::context-menu signal, which has the
ContextMenu as an argument. You can modify it, adding new
submenus that you can create with contextMenuNew, adding
new ContextMenuItems 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
- contextMenuGetEvent :: (HasCallStack, MonadIO m, IsContextMenu a) => a -> m Event
- 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.
Constructors
| ContextMenu (ManagedPtr ContextMenu) |
Instances
| Eq ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu | |
| GObject ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu | |
| ManagedPtrNewtype ContextMenu Source # | |
Defined in GI.WebKit2WebExtension.Objects.ContextMenu Methods 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 Methods 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, getEvent, getItemAtPosition, getItems, getNItems, getProperty, getQdata, getUserData.
Setters
append
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
| => a |
|
| -> b |
|
| -> m () |
Adds item at the end of the menu.
first
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a) | |
| => a |
|
| -> m ContextMenuItem | Returns: the first |
Gets the first item in the menu.
getEvent
Arguments
| :: (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 WebKitWebView::context-menu
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 #
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a) | |
| => a |
|
| -> Word32 |
|
| -> m ContextMenuItem | Returns: the |
Gets the item at the given position in the menu.
getItems
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a) | |
| => a |
|
| -> m [ContextMenuItem] | Returns: a |
Returns the item list of menu.
getNItems
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a) | |
| => a |
|
| -> m Word32 | Returns: the number of |
Gets the length of the menu.
getUserData
contextMenuGetUserData Source #
Arguments
| :: (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
Arguments
| :: (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
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a) | |
| => a |
|
| -> m ContextMenuItem | Returns: the last |
Gets the last item in the menu.
moveItem
Arguments
| :: (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
Arguments
| :: (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 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 ContextMenu with
a list of initial items.
newWithItems
contextMenuNewWithItems Source #
Arguments
| :: (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
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
| => a |
|
| -> b |
|
| -> m () |
Adds item at the beginning of the menu.
remove
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) | |
| => a |
|
| -> b |
|
| -> m () |
Removes item from the menu.
See also contextMenuRemoveAll to remove all items.
removeAll
Arguments
| :: (HasCallStack, MonadIO m, IsContextMenu a) | |
| => a |
|
| -> m () |
Removes all items of the menu.
setUserData
contextMenuSetUserData Source #
Arguments
| :: (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