UNPKG

@theia/core

Version:

Theia is a cloud & desktop IDE framework implemented in TypeScript.

53 lines 2.98 kB
import { MenuPath, MenuNode } from '../../common'; import { Keybinding } from '../../common/keybinding'; import { PreferenceService } from '../../browser'; import { BrowserMainMenuFactory } from '../../browser/menu/browser-menu-plugin'; import { ContextMatcher } from 'src/browser/context-key-service'; /** * Representation of possible electron menu options. */ export interface ElectronMenuOptions { /** * Controls whether to render disabled menu items. * Defaults to `true`. */ readonly showDisabled?: boolean; /** * A DOM context to use when evaluating any `when` clauses * of menu items registered for this item. */ context?: HTMLElement; /** * A context key service to use when evaluating any `when` clauses. * If none is provided, the global context will be used. */ contextKeyService?: ContextMatcher; /** * The root menu path for which the menu is being built. */ rootMenuPath: MenuPath; } /** * Define the action of the menu item, when specified the `click` property will * be ignored. See [roles](https://www.electronjs.org/docs/api/menu-item#roles). */ export declare type ElectronMenuItemRole = ('undo' | 'redo' | 'cut' | 'copy' | 'paste' | 'pasteAndMatchStyle' | 'delete' | 'selectAll' | 'reload' | 'forceReload' | 'toggleDevTools' | 'resetZoom' | 'zoomIn' | 'zoomOut' | 'togglefullscreen' | 'window' | 'minimize' | 'close' | 'help' | 'about' | 'services' | 'hide' | 'hideOthers' | 'unhide' | 'quit' | 'startSpeaking' | 'stopSpeaking' | 'zoom' | 'front' | 'appMenu' | 'fileMenu' | 'editMenu' | 'viewMenu' | 'recentDocuments' | 'toggleTabBar' | 'selectNextTab' | 'selectPreviousTab' | 'mergeAllWindows' | 'clearRecentDocuments' | 'moveTabToNewWindow' | 'windowMenu'); export declare class ElectronMainMenuFactory extends BrowserMainMenuFactory { protected _menu?: Electron.Menu; protected _toggledCommands: Set<string>; protected preferencesService: PreferenceService; postConstruct(): void; setMenuBar(): Promise<void>; createElectronMenuBar(): Electron.Menu | null; createElectronContextMenu(menuPath: MenuPath, args?: any[], context?: HTMLElement, contextKeyService?: ContextMatcher): Electron.Menu; protected fillMenuTemplate(parentItems: Electron.MenuItemConstructorOptions[], menu: MenuNode, args: unknown[] | undefined, options: ElectronMenuOptions): Electron.MenuItemConstructorOptions[]; protected undefinedOrMatch(contextKeyService: ContextMatcher, expression?: string, context?: HTMLElement): boolean; /** * Return a user visible representation of a keybinding. */ protected acceleratorFor(keybinding: Keybinding): string; protected roleFor(id: string): ElectronMenuItemRole | undefined; protected execute(command: string, args: any[], menuPath: MenuPath): Promise<void>; protected createOSXMenu(): Electron.MenuItemConstructorOptions; } //# sourceMappingURL=electron-main-menu-factory.d.ts.map