@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
60 lines • 3.18 kB
TypeScript
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 '../../browser/context-key-service';
import { MenuDto, MenuRole } from '../../electron-common/electron-api';
/**
* Representation of possible electron menu options.
*/
export interface ElectronMenuOptions {
/**
* Controls whether to render disabled menu items.
* Defaults to `true`.
*/
readonly showDisabled?: boolean;
/**
* Controls whether to render disabled items as disabled
* Defaults to `true`
*/
readonly honorDisabled?: 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?: MenuDto[];
protected _toggledCommands: Set<string>;
protected preferencesService: PreferenceService;
postConstruct(): void;
setMenuBar(): Promise<void>;
createElectronMenuBar(): MenuDto[] | undefined;
createElectronContextMenu(menuPath: MenuPath, args?: any[], context?: HTMLElement, contextKeyService?: ContextMatcher, skipSingleRootNode?: boolean): MenuDto[];
protected fillMenuTemplate(parentItems: MenuDto[], menu: MenuNode, args: unknown[] | undefined, options: ElectronMenuOptions): MenuDto[];
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): MenuRole | undefined;
protected execute(cmd: string, args: any[], menuPath: MenuPath): Promise<void>;
findMenuById(items: MenuDto[], id: string): MenuDto | undefined;
protected createOSXMenu(): MenuDto;
}
//# sourceMappingURL=electron-main-menu-factory.d.ts.map