Menu

open external class Menu : MenuItemBase(source)

A type that is either a menu bar on the window on Windows and Linux or as a global menu in the menubar on macOS.

Platform-specific:

  • macOS: if using {@linkcode Menu} for the global menubar, it can only contain {@linkcode Submenu}s.

Constructors

Link copied to clipboard
constructor(rid: Double, id: String)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val id: String

The id of this item.

Link copied to clipboard
Link copied to clipboard
val rid: Double

Functions

Link copied to clipboard
fun <T : Any> append(items: T): Promise<Void>
fun <T : Any> append(items: ReadonlyArray<T>): Promise<Void>

Add a menu item to the end of this menu.

Link copied to clipboard

Destroys and cleans up this resource from memory. You should not call any method on this object anymore and should drop any reference to it.

Link copied to clipboard
fun get(id: String): Promise<Any?>

Retrieves the menu item matching the given identifier.

Link copied to clipboard
fun <T : Any> insert(items: T, position: Double): Promise<Void>
fun <T : Any> insert(items: ReadonlyArray<T>, position: Double): Promise<Void>

Add a menu item to the specified position in this menu.

Link copied to clipboard

Returns a list of menu items that has been added to this menu.

Link copied to clipboard
fun popup(at: LogicalPosition = definedExternally, window: Window = definedExternally): Promise<Void>
fun popup(at: PhysicalPosition = definedExternally, window: Window = definedExternally): Promise<Void>
fun popup(at: Position = definedExternally, window: Window = definedExternally): Promise<Void>

Popup this menu as a context menu on the specified window.

Link copied to clipboard
fun <T : Any> prepend(items: T): Promise<Void>
fun <T : Any> prepend(items: ReadonlyArray<T>): Promise<Void>

Add a menu item to the beginning of this menu.

Link copied to clipboard
fun remove(item: Submenu): Promise<Void>

Remove a menu item from this menu.

Link copied to clipboard
fun removeAt(position: Double): Promise<Any?>

Remove a menu item from this menu at the specified position.

Link copied to clipboard

Sets the app-wide menu and returns the previous one.

Link copied to clipboard
fun setAsWindowMenu(window: Window = definedExternally): Promise<Menu?>

Sets the window menu and returns the previous one.