Class ContextMenuItem
- All Implemented Interfaces:
Proxy
WebKitContextMenu.
The WebKitContextMenu is composed of WebKitContextMenuItem<!--
-->s. These items can be created from a GtkAction, from a
WebKitContextMenuAction or from a WebKitContextMenuAction and a
label. These WebKitContextMenuAction<!-- -->s 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 org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ContextMenuItem.ContextMenuItem(MemorySegment address) Create a ContextMenuItem proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ContextMenuItemasParent()Returns 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.Gets theWebKitContextMenuActionofitem.Gets the submenu ofitem.static @Nullable TypegetType()Get the GType of the ContextMenuItem classbooleanChecks 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 org.gnome.gobject.InitiallyUnowned
getMemoryLayoutMethods inherited from class org.gnome.gobject.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 org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ContextMenuItem
Create a ContextMenuItem proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ContextMenuItem
public ContextMenuItem()Creates a new ContextMenuItem.
-
-
Method Details
-
getType
Get the GType of the ContextMenuItem class- Returns:
- the GType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParentin classInitiallyUnowned
-
fromGaction
Creates a newWebKitContextMenuItemfor 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 newWebKitContextMenuItemfor 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 newWebKitContextMenuItemfor 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
-
getStockAction
Gets theWebKitContextMenuActionofitem.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
-
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
-