콘텐츠로 이동

Submenu

이 콘텐츠는 아직 번역되지 않았습니다.

Module @netwiv/api/menu · Kind Constant

import { Submenu } from '@netwiv/api/menu';
append<T>(items: T | T[]): Promise<void>

Add a menu item to the end of this submenu.

  • macOS: Only {@linkcode Submenu}s can be added to a {@linkcode Menu }.
close(): Promise<void>

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.

get(id: string): Promise<Item | null>

Retrieves the menu item matching the given identifier.

id: string

The id of this item.

insert<T>(items: T | T[], position: number): Promise<void>

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

  • macOS: Only {@linkcode Submenu}s can be added to a {@linkcode Menu }.
isEnabled(): Promise<boolean>

Returns whether this submenu is enabled or not.

items(): Promise<Item[]>

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

popup(at?: LogicalPosition | PhysicalPosition | undefined, window?: Window | undefined): Promise<void>

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

If the position, is provided, it is relative to the window’s top-left corner.

prepend<T>(items: T | T[]): Promise<void>

Add a menu item to the beginning of this submenu.

  • macOS: Only {@linkcode Submenu}s can be added to a {@linkcode Menu }.
remove(item: Item): Promise<void>

Remove a menu item from this submenu.

removeAt(position: number): Promise<Item | null>

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

rid: number
setAsHelpMenuForNSApp(): Promise<void>

Set this submenu as the Help menu for the application on macOS.

This will cause macOS to automatically add a search box to the menu.

If no menu is set as the Help menu, macOS will automatically use any menu which has a title matching the localized word “Help”.

  • Windows / Linux: Unsupported.
setAsWindowsMenuForNSApp(): Promise<void>

Set this submenu as the Window menu for the application on macOS.

This will cause macOS to automatically add window-switching items and certain other items to the menu.

  • Windows / Linux: Unsupported.
setEnabled(enabled: boolean): Promise<void>

Sets whether this submenu is enabled or not.

setIcon(icon: MenuIcon | null): Promise<void>

Sets an icon for this submenu

setText(text: string): Promise<void>

Sets the text for this submenu.

text(): Promise<string>

Returns the text of this submenu.


Descriptions come from the pinned @tauri-apps/api@2.11.1 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.