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.
- Since:
- 2.18
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOptionMenu.Builder<B extends OptionMenu.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theCloseCallbackcallback.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new OptionMenu.OptionMenu(MemorySegment address) Create a OptionMenu proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateItem(int index) Activates theWebKitOptionMenuItematindexinmenu.protected OptionMenuasParent()Returns this instance as if it were its parent type.static OptionMenu.Builder<? extends OptionMenu.Builder> builder()AOptionMenu.Builderobject constructs aOptionMenuwith the specified properties.voidclose()Request to close aWebKitOptionMenu.voidEmits the "close" signal.getEvent()Gets theGdkEventthat triggered the dropdown menu.getItem(int index) Returns theWebKitOptionMenuItematindexinmenu.intGets the length of themenu.static @Nullable TypegetType()Get the GType of the OptionMenu classonClose(OptionMenu.CloseCallback handler) Emitted when closing aWebKitOptionMenuis requested.voidselectItem(int index) Selects theWebKitOptionMenuItematindexinmenu.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, 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
-
OptionMenu
Create a OptionMenu proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
OptionMenu
public OptionMenu()Creates a new OptionMenu.
-
-
Method Details
-
getType
-
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. -
activateItem
public void activateItem(int index) Activates theWebKitOptionMenuItematindexinmenu.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- Since:
- 2.18
-
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.
- Since:
- 2.18
-
getEvent
Gets theGdkEventthat triggered the dropdown menu. If this OptionMenu was not triggered by a user interaction, like a mouse click,nullis returned.- Returns:
- the menu event or
null. - Since:
- 2.40
-
getItem
Returns theWebKitOptionMenuItematindexinmenu.- Parameters:
index- the index of the item- Returns:
- a
WebKitOptionMenuItemofmenu. - Since:
- 2.18
-
getNItems
public int getNItems()Gets the length of themenu.- Returns:
- the number of
WebKitOptionMenuItem<!-- -->s in this OptionMenu - Since:
- 2.18
-
selectItem
public void selectItem(int index) Selects theWebKitOptionMenuItematindexinmenu.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- Since:
- 2.18
-
onClose
Emitted when closing aWebKitOptionMenuis 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
- Since:
- 2.18
- See Also:
-
emitClose
public void emitClose()Emits the "close" signal. SeeonClose(org.webkitgtk.OptionMenu.CloseCallback). -
builder
AOptionMenu.Builderobject constructs aOptionMenuwith the specified properties. Use the variousset...()methods to set properties, and finish construction withOptionMenu.Builder.build().- Returns:
- the builder object
-