gi-webkit2-4.0.31: WebKit2 bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.WebKit2.Objects.ContextMenu

Description

Represents the context menu in a WebView.

ContextMenu represents a context menu containing ContextMenuItems 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 ContextMenuItems with contextMenuPrepend, contextMenuAppend or contextMenuInsert, maybe after having removed the existing ones with contextMenuRemoveAll.

Synopsis

Exported types

newtype ContextMenu Source #

Memory-managed wrapper type.

Constructors

ContextMenu (ManagedPtr ContextMenu) 

Instances

Instances details
Eq ContextMenu Source # 
Instance details

Defined in GI.WebKit2.Objects.ContextMenu

GObject ContextMenu Source # 
Instance details

Defined in GI.WebKit2.Objects.ContextMenu

ManagedPtrNewtype ContextMenu Source # 
Instance details

Defined in GI.WebKit2.Objects.ContextMenu

Methods

toManagedPtr :: ContextMenu -> ManagedPtr ContextMenu

TypedObject ContextMenu Source # 
Instance details

Defined in GI.WebKit2.Objects.ContextMenu

Methods

glibType :: IO GType

HasParentTypes ContextMenu Source # 
Instance details

Defined in GI.WebKit2.Objects.ContextMenu

IsGValue (Maybe ContextMenu) Source #

Convert ContextMenu to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.WebKit2.Objects.ContextMenu

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe ContextMenu -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe ContextMenu)

type ParentTypes ContextMenu Source # 
Instance details

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

Instances details
(GObject o, IsDescendantOf ContextMenu o) => IsContextMenu o Source # 
Instance details

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

append

contextMenuAppend Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) 
=> a

menu: a ContextMenu

-> b

item: the ContextMenuItem to add

-> m () 

Adds item at the end of the menu.

first

contextMenuFirst Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m (Maybe ContextMenuItem)

Returns: the first ContextMenuItem of menu, or Nothing if the ContextMenu is empty.

Gets the first item in the menu.

getEvent

contextMenuGetEvent Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m Event

Returns: the menu event or Nothing.

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 #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> Word32

position: the position of the item, counting from 0

-> m (Maybe ContextMenuItem)

Returns: the ContextMenuItem at position position in menu, or Nothing if the position is off the end of the menu.

Gets the item at the given position in the menu.

getItems

contextMenuGetItems Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m [ContextMenuItem]

Returns: a List of ContextMenuItems

Returns the item list of menu.

getNItems

contextMenuGetNItems Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m Word32

Returns: the number of ContextMenuItems in menu

Gets the length of the menu.

getUserData

contextMenuGetUserData Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m (Maybe GVariant)

Returns: the user data of menu, or Nothing if menu doesn't have user data

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

contextMenuInsert Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) 
=> a

menu: a ContextMenu

-> b

item: the ContextMenuItem to add

-> Int32

position: the position to insert the item

-> 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

contextMenuLast Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m (Maybe ContextMenuItem)

Returns: the last ContextMenuItem of menu, or Nothing if the ContextMenu is empty.

Gets the last item in the menu.

moveItem

contextMenuMoveItem Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) 
=> a

menu: a ContextMenu

-> b

item: the ContextMenuItem to add

-> Int32

position: the new position to move the item

-> 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

contextMenuNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ContextMenu

Returns: The newly created ContextMenu object

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 #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenuItem a) 
=> [a]

items: a List of ContextMenuItem

-> m ContextMenu

Returns: The newly created ContextMenu object

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

contextMenuPrepend Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) 
=> a

menu: a ContextMenu

-> b

item: the ContextMenuItem to add

-> m () 

Adds item at the beginning of the menu.

remove

contextMenuRemove Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a, IsContextMenuItem b) 
=> a

menu: a ContextMenu

-> b

item: the ContextMenuItem to remove

-> m () 

Removes item from the menu.

See also contextMenuRemoveAll to remove all items.

removeAll

contextMenuRemoveAll Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> m () 

Removes all items of the menu.

setUserData

contextMenuSetUserData Source #

Arguments

:: (HasCallStack, MonadIO m, IsContextMenu a) 
=> a

menu: a ContextMenu

-> GVariant

userData: 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