Class ContextMenuItem
- All Implemented Interfaces:
Proxy
One item of a WebKitContextMenu.
The WebKitContextMenu is composed of WebKitContextMenuItems. These items can be created from a GtkAction, from a
WebKitContextMenuAction or from a WebKitContextMenuAction and a
label. These WebKitContextMenuActions denote stock actions
for the items. You can also create separators and submenus.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classContextMenuItem.Builder<B extends ContextMenuItem.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new ContextMenuItem.ContextMenuItem(MemorySegment address) Create a ContextMenuItem instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ContextMenuItemasParent()Return this instance as if it were its parent type.static ContextMenuItem.Builder<? extends ContextMenuItem.Builder> builder()AContextMenuItem.Builderobject constructs aContextMenuItemwith the specified properties.static ContextMenuItemfromGaction(Action action, String label, @Nullable Variant target) Creates a newWebKitContextMenuItemfor the givenactionandlabel.static ContextMenuItemfromStockAction(ContextMenuAction action) Creates a newWebKitContextMenuItemfor the given stock action.static ContextMenuItemfromStockActionWithLabel(ContextMenuAction action, String label) Creates a newWebKitContextMenuItemfor the given stock action using the givenlabel.Gets the action associated to this ContextMenuItem as aGAction.@Nullable VariantGets the targetGVariantassociated withitem.static MemoryLayoutThe memory layout of the native struct.Gets theWebKitContextMenuActionofitem.Gets the submenu ofitem.getTitle()Gets the title ofitem.static @Nullable TypegetType()Get the GType of the ContextMenuItem class.booleanChecks whether this ContextMenuItem is a separator.static ContextMenuItemCreates a newWebKitContextMenuItemrepresenting a separator.voidsetSubmenu(@Nullable ContextMenu submenu) Sets or replaces the this ContextMenuItem submenu.static ContextMenuItemwithSubmenu(String label, ContextMenu submenu) Creates a newWebKitContextMenuItemusing the givenlabelwith a submenu.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ContextMenuItem
Create a ContextMenuItem instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ContextMenuItem
public ContextMenuItem()Create a new ContextMenuItem.
-
-
Method Details
-
getType
Get the GType of the ContextMenuItem class.- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code.- Overrides:
asParentin classInitiallyUnowned- Returns:
- the instance as if it were its parent type
-
fromGaction
Creates a new
WebKitContextMenuItemfor the givenactionandlabel.On activation
targetwill be passed as parameter to the callback.- Parameters:
action- aGActionlabel- the menu item label texttarget- aGVariantto use as the action target- Returns:
- the newly created
WebKitContextMenuItemobject. - Since:
- 2.18
-
fromStockAction
Creates a new
WebKitContextMenuItemfor the given stock action.Stock actions are handled automatically by WebKit so that, for example, when a menu item created with a
ContextMenuAction.STOPis activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get theGActionof aWebKitContextMenuItemcreated with aWebKitContextMenuActionwith webkit_context_menu_item_get_gaction() and connect to theGSimpleAction::activate signal to be notified when the item is activated, but you can't prevent the associated action from being performed.- Parameters:
action- aWebKitContextMenuActionstock action- Returns:
- the newly created
WebKitContextMenuItemobject.
-
fromStockActionWithLabel
Creates a new
WebKitContextMenuItemfor the given stock action using the givenlabel.Stock actions have a predefined label, this method can be used to create a
WebKitContextMenuItemfor aWebKitContextMenuActionbut using a custom label.- Parameters:
action- aWebKitContextMenuActionstock actionlabel- a custom label text to use instead of the predefined one- Returns:
- the newly created
WebKitContextMenuItemobject.
-
separator
Creates a newWebKitContextMenuItemrepresenting a separator.- Returns:
- the newly created
WebKitContextMenuItemobject.
-
getGaction
Gets the action associated to this ContextMenuItem as aGAction.- Returns:
- the
GActionassociated to theWebKitContextMenuItem, ornullif this ContextMenuItem is a separator. - Since:
- 2.18
-
getGactionTarget
Gets the targetGVariantassociated withitem.- Returns:
- the target
GVariantof theWebKitContextMenuItem, ornullif this ContextMenuItem was not created with webkit_context_menu_item_new_from_gaction() or if no target was specified. - Since:
- 2.52
-
getStockAction
Gets the
WebKitContextMenuActionofitem.If the
WebKitContextMenuItemwas not created for a stock actionContextMenuAction.CUSTOMwill be returned. If theWebKitContextMenuItemis a separatorContextMenuAction.NO_ACTIONwill be returned.- Returns:
- the
WebKitContextMenuActionof this ContextMenuItem
-
getTitle
Gets the title ofitem.- Returns:
- the title of
item,ornullif this ContextMenuItem is a separator. - Since:
- 2.52
-
isSeparator
public boolean isSeparator()Checks whether this ContextMenuItem is a separator.- Returns:
trueis this ContextMenuItem is a separator orfalseotherwise
-
builder
AContextMenuItem.Builderobject constructs aContextMenuItemwith the specified properties. Use the variousset...()methods to set properties, and finish construction withContextMenuItem.Builder.build().- Returns:
- the builder object
-