UNPKG

2.67 kBTypeScriptView Raw
1import { IWidgetTracker, MenuFactory } from '@jupyterlab/apputils';
2import { Token } from '@lumino/coreutils';
3import { Menu, Widget } from '@lumino/widgets';
4import { IEditMenu } from './edit';
5import { IFileMenu } from './file';
6import { IHelpMenu } from './help';
7import { IKernelMenu } from './kernel';
8import { IRunMenu } from './run';
9import { ISettingsMenu } from './settings';
10import { ITabsMenu } from './tabs';
11import { IViewMenu } from './view';
12/**
13 * The main menu token.
14 */
15export declare const IMainMenu: Token<IMainMenu>;
16/**
17 * A base interface for a consumer of one of the menu
18 * semantic extension points. The IMenuExtender gives
19 * a widget tracker which is checked when the menu
20 * is deciding which IMenuExtender to delegate to upon
21 * selection of the menu item.
22 */
23export interface IMenuExtender<T extends Widget> {
24 /**
25 * A widget tracker for identifying the appropriate extender.
26 */
27 tracker: IWidgetTracker<T>;
28 /**
29 * An additional function that determines whether the extender
30 * is enabled. By default it is considered enabled if the application
31 * active widget is contained in the `tracker`. If this is also
32 * provided, the criterion is equivalent to
33 * `tracker.has(widget) && extender.isEnabled(widget)`
34 */
35 isEnabled?: (widget: T) => boolean;
36}
37/**
38 * The main menu interface.
39 */
40export interface IMainMenu {
41 /**
42 * Add a new menu to the main menu bar.
43 */
44 addMenu(menu: Menu, options?: IMainMenu.IAddOptions): void;
45 /**
46 * The application "File" menu.
47 */
48 readonly fileMenu: IFileMenu;
49 /**
50 * The application "Edit" menu.
51 */
52 readonly editMenu: IEditMenu;
53 /**
54 * The application "View" menu.
55 */
56 readonly viewMenu: IViewMenu;
57 /**
58 * The application "Help" menu.
59 */
60 readonly helpMenu: IHelpMenu;
61 /**
62 * The application "Kernel" menu.
63 */
64 readonly kernelMenu: IKernelMenu;
65 /**
66 * The application "Run" menu.
67 */
68 readonly runMenu: IRunMenu;
69 /**
70 * The application "Settings" menu.
71 */
72 readonly settingsMenu: ISettingsMenu;
73 /**
74 * The application "Tabs" menu.
75 */
76 readonly tabsMenu: ITabsMenu;
77}
78/**
79 * The namespace for IMainMenu attached interfaces.
80 */
81export declare namespace IMainMenu {
82 /**
83 * The options used to add a menu to the main menu.
84 */
85 interface IAddOptions {
86 /**
87 * The rank order of the menu among its siblings.
88 */
89 rank?: number;
90 }
91 /**
92 * The instantiation options for an IMainMenu.
93 */
94 interface IMenuOptions extends MenuFactory.IMenuOptions {
95 }
96}