UNPKG

2.25 kBPlain TextView Raw
1// Copyright (c) Jupyter Development Team.
2// Distributed under the terms of the Modified BSD License.
3
4import { MenuFactory } from '@jupyterlab/apputils';
5import { Token } from '@lumino/coreutils';
6import { Menu } from '@lumino/widgets';
7import { IEditMenu } from './edit';
8import { IFileMenu } from './file';
9import { IHelpMenu } from './help';
10import { IKernelMenu } from './kernel';
11import { IRunMenu } from './run';
12import { ISettingsMenu } from './settings';
13import { ITabsMenu } from './tabs';
14import { IViewMenu } from './view';
15
16/**
17 * The main menu token.
18 */
19export const IMainMenu = new Token<IMainMenu>(
20 '@jupyterlab/mainmenu:IMainMenu',
21 `A service for the main menu bar for the application.
22 Use this if you want to add your own menu items or provide implementations for standardized menu items for specific activities.`
23);
24
25/**
26 * The main menu interface.
27 */
28export interface IMainMenu {
29 /**
30 * Add a new menu to the main menu bar.
31 *
32 * @param menu The menu to add
33 * @param update Whether to update the menu bar or not
34 * @param options Options for adding the menu
35 */
36 addMenu(menu: Menu, update?: boolean, options?: IMainMenu.IAddOptions): void;
37
38 /**
39 * The application "File" menu.
40 */
41 readonly fileMenu: IFileMenu;
42
43 /**
44 * The application "Edit" menu.
45 */
46 readonly editMenu: IEditMenu;
47
48 /**
49 * The application "View" menu.
50 */
51 readonly viewMenu: IViewMenu;
52
53 /**
54 * The application "Help" menu.
55 */
56 readonly helpMenu: IHelpMenu;
57
58 /**
59 * The application "Kernel" menu.
60 */
61 readonly kernelMenu: IKernelMenu;
62
63 /**
64 * The application "Run" menu.
65 */
66 readonly runMenu: IRunMenu;
67
68 /**
69 * The application "Settings" menu.
70 */
71 readonly settingsMenu: ISettingsMenu;
72
73 /**
74 * The application "Tabs" menu.
75 */
76 readonly tabsMenu: ITabsMenu;
77}
78
79/**
80 * The namespace for IMainMenu attached interfaces.
81 */
82export namespace IMainMenu {
83 /**
84 * The options used to add a menu to the main menu.
85 */
86 export interface IAddOptions {
87 /**
88 * The rank order of the menu among its siblings.
89 */
90 rank?: number;
91 }
92
93 /**
94 * The instantiation options for an IMainMenu.
95 */
96 export interface IMenuOptions extends MenuFactory.IMenuOptions {}
97}