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
Modifier and TypeClassDescriptionstatic class
ContextMenuItem.Builder<B extends ContextMenuItem.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionContextMenuItem
(MemorySegment address) Create a ContextMenuItem proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ContextMenuItem
asParent()
Returns this instance as if it were its parent type.static ContextMenuItem.Builder
<? extends ContextMenuItem.Builder> builder()
AContextMenuItem.Builder
object constructs aContextMenuItem
with the specified properties.static ContextMenuItem
fromGaction
(Action action, String label, @Nullable Variant target) Creates a newWebKitContextMenuItem
for the givenaction
andlabel
.static ContextMenuItem
fromStockAction
(ContextMenuAction action) Creates a newWebKitContextMenuItem
for the given stock action.static ContextMenuItem
fromStockActionWithLabel
(ContextMenuAction action, String label) Creates a newWebKitContextMenuItem
for the given stock action using the givenlabel
.Gets the action associated to this ContextMenuItem as aGAction
.Gets theWebKitContextMenuAction
of this ContextMenuItem.Gets the submenu of this ContextMenuItem.static Type
getType()
Get the GType of the ContextMenuItem classboolean
Checks whether this ContextMenuItem is a separator.static ContextMenuItem
Creates a newWebKitContextMenuItem
representing a separator.void
setSubmenu
(@Nullable ContextMenu submenu) Sets or replaces the this ContextMenuItem submenu.static ContextMenuItem
withSubmenu
(String label, ContextMenu submenu) Creates a newWebKitContextMenuItem
using the givenlabel
with a submenu.Methods inherited from class org.gnome.gobject.InitiallyUnowned
getMemoryLayout
Methods 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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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:
asParent
in classInitiallyUnowned
-
fromGaction
public static ContextMenuItem fromGaction(Action action, String label, @Nullable @Nullable Variant target) Creates a newWebKitContextMenuItem
for the givenaction
andlabel
.On activation
target
will be passed as parameter to the callback.- Parameters:
action
- aGAction
label
- the menu item label texttarget
- aGVariant
to use as the action target- Returns:
- the newly created
WebKitContextMenuItem
object. - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
fromStockAction
Creates a newWebKitContextMenuItem
for the given stock action.Stock actions are handled automatically by WebKit so that, for example, when a menu item created with a
ContextMenuAction.STOP
is activated the action associated will be handled by WebKit and the current load operation will be stopped. You can get theGAction
of aWebKitContextMenuItem
created with aWebKitContextMenuAction
with 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
- aWebKitContextMenuAction
stock action- Returns:
- the newly created
WebKitContextMenuItem
object. - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
fromStockActionWithLabel
Creates a newWebKitContextMenuItem
for the given stock action using the givenlabel
.Stock actions have a predefined label, this method can be used to create a
WebKitContextMenuItem
for aWebKitContextMenuAction
but using a custom label.- Parameters:
action
- aWebKitContextMenuAction
stock actionlabel
- a custom label text to use instead of the predefined one- Returns:
- the newly created
WebKitContextMenuItem
object. - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
separator
Creates a newWebKitContextMenuItem
representing a separator.- Returns:
- the newly created
WebKitContextMenuItem
object. - Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
getGaction
Gets the action associated to this ContextMenuItem as aGAction
.- Returns:
- the
GAction
associated to theWebKitContextMenuItem
, ornull
if this ContextMenuItem is a separator.
-
getStockAction
Gets theWebKitContextMenuAction
of this ContextMenuItem.If the
WebKitContextMenuItem
was not created for a stock actionContextMenuAction.CUSTOM
will be returned. If theWebKitContextMenuItem
is a separatorContextMenuAction.NO_ACTION
will be returned.- Returns:
- the
WebKitContextMenuAction
of this ContextMenuItem
-
isSeparator
public boolean isSeparator()Checks whether this ContextMenuItem is a separator.- Returns:
true
is this ContextMenuItem is a separator orfalse
otherwise
-
builder
AContextMenuItem.Builder
object constructs aContextMenuItem
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withContextMenuItem.Builder.build()
.
-