Submenu
이 콘텐츠는 아직 번역되지 않았습니다.
Module @netwiv/api/menu · Kind Constant
import { Submenu } from '@netwiv/api/menu';Instance members
Section titled “Instance members”append
Section titled “append”append<T>(items: T | T[]): Promise<void>Add a menu item to the end of this submenu.
Platform-specific:
Section titled “Platform-specific:”- 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: stringThe id of this item.
insert
Section titled “insert”insert<T>(items: T | T[], position: number): Promise<void>Add a menu item to the specified position in this submenu.
Platform-specific:
Section titled “Platform-specific:”- macOS: Only {@linkcode Submenu}s can be added to a {@linkcode Menu }.
isEnabled
Section titled “isEnabled”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
Section titled “prepend”prepend<T>(items: T | T[]): Promise<void>Add a menu item to the beginning of this submenu.
Platform-specific:
Section titled “Platform-specific:”- macOS: Only {@linkcode Submenu}s can be added to a {@linkcode Menu }.
remove
Section titled “remove”remove(item: Item): Promise<void>Remove a menu item from this submenu.
removeAt
Section titled “removeAt”removeAt(position: number): Promise<Item | null>Remove a menu item from this submenu at the specified position.
rid: numbersetAsHelpMenuForNSApp
Section titled “setAsHelpMenuForNSApp”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”.
Platform-specific:
Section titled “Platform-specific:”- Windows / Linux: Unsupported.
setAsWindowsMenuForNSApp
Section titled “setAsWindowsMenuForNSApp”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.
Platform-specific:
Section titled “Platform-specific:”- Windows / Linux: Unsupported.
setEnabled
Section titled “setEnabled”setEnabled(enabled: boolean): Promise<void>Sets whether this submenu is enabled or not.
setIcon
Section titled “setIcon”setIcon(icon: MenuIcon | null): Promise<void>Sets an icon for this submenu
setText
Section titled “setText”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.