Class OptionMenu
- All Implemented Interfaces:
Proxy
select
element in a WebKitWebView
.
When a select element in a WebKitWebView
needs to display a dropdown menu, the signal
WebKitWebView
::show-option-menu is emitted, providing a WebKitOptionMenu with the
WebKitOptionMenuItem
<!-- -->s that should be displayed.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
OptionMenu.Builder<B extends OptionMenu.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theCloseCallback
callback.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionOptionMenu
(MemorySegment address) Create a OptionMenu proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateItem
(int index) Activates theWebKitOptionMenuItem
atindex
in this OptionMenu.protected OptionMenu
asParent()
Returns this instance as if it were its parent type.static OptionMenu.Builder
<? extends OptionMenu.Builder> builder()
AOptionMenu.Builder
object constructs aOptionMenu
with the specified properties.void
close()
Request to close aWebKitOptionMenu
.void
Emits the "close" signal.getEvent()
Gets theGdkEvent
that triggered the dropdown menu.getItem
(int index) Returns theWebKitOptionMenuItem
atindex
in this OptionMenu.int
Gets the length of the this OptionMenu.static Type
getType()
Get the GType of the OptionMenu classonClose
(OptionMenu.CloseCallback handler) Emitted when closing aWebKitOptionMenu
is requested.void
selectItem
(int index) Selects theWebKitOptionMenuItem
atindex
in this OptionMenu.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, getMemoryLayout, 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
-
OptionMenu
Create a OptionMenu 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. -
activateItem
public void activateItem(int index) Activates theWebKitOptionMenuItem
atindex
in this OptionMenu.Activating an item changes the value of the element making the item the active one. You are expected to close the menu with webkit_option_menu_close() after activating an item, calling this function again will have no effect.
- Parameters:
index
- the index of the item
-
close
public void close()Request to close aWebKitOptionMenu
.This emits WebKitOptionMenu::close signal. This function should always be called to notify WebKit that the associated menu has been closed. If the menu is closed and neither webkit_option_menu_select_item() nor webkit_option_menu_activate_item() have been called, the element value remains unchanged.
-
getEvent
Gets theGdkEvent
that triggered the dropdown menu. If this OptionMenu was not triggered by a user interaction, like a mouse click,null
is returned.- Returns:
- the menu event or
null
.
-
getItem
Returns theWebKitOptionMenuItem
atindex
in this OptionMenu.- Parameters:
index
- the index of the item- Returns:
- a
WebKitOptionMenuItem
of this OptionMenu.
-
getNItems
public int getNItems()Gets the length of the this OptionMenu.- Returns:
- the number of
WebKitOptionMenuItem
<!-- -->s in this OptionMenu
-
selectItem
public void selectItem(int index) Selects theWebKitOptionMenuItem
atindex
in this OptionMenu.Selecting an item changes the text shown by the combo button, but it doesn't change the value of the element. You need to explicitly activate the item with webkit_option_menu_select_item() or close the menu with webkit_option_menu_close() in which case the currently selected item will be activated.
- Parameters:
index
- the index of the item
-
onClose
Emitted when closing aWebKitOptionMenu
is requested. This can happen when the user explicitly calls webkit_option_menu_close() or when the element is detached from the current page.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitClose
public void emitClose()Emits the "close" signal. SeeonClose(org.gnome.webkit.OptionMenu.CloseCallback)
. -
builder
AOptionMenu.Builder
object constructs aOptionMenu
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withOptionMenu.Builder.build()
.
-