1 | import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
2 | import { ContextMenu, Menu } from '@lumino/widgets';
|
3 | /**
|
4 | * Helper functions to build a menu from the settings
|
5 | */
|
6 | export declare namespace MenuFactory {
|
7 | /**
|
8 | * Menu constructor options
|
9 | */
|
10 | interface IMenuOptions {
|
11 | /**
|
12 | * The unique menu identifier.
|
13 | */
|
14 | id: string;
|
15 | /**
|
16 | * The menu label.
|
17 | */
|
18 | label?: string;
|
19 | /**
|
20 | * The menu rank.
|
21 | */
|
22 | rank?: number;
|
23 | }
|
24 | /**
|
25 | * Create menus from their description
|
26 | *
|
27 | * @param data Menubar description
|
28 | * @param menuFactory Factory for empty menu
|
29 | */
|
30 | function createMenus(data: ISettingRegistry.IMenu[], menuFactory: (options: IMenuOptions) => Menu): Menu[];
|
31 | /**
|
32 | * Convert an item description in a context menu item object
|
33 | *
|
34 | * @param item Context menu item
|
35 | * @param menu Context menu to populate
|
36 | * @param menuFactory Empty menu factory
|
37 | */
|
38 | function addContextItem(item: ISettingRegistry.IContextMenuItem, menu: ContextMenu, menuFactory: (options: IMenuOptions) => Menu): void;
|
39 | /**
|
40 | * Update an existing list of menu and returns
|
41 | * the new elements.
|
42 | *
|
43 | * #### Note
|
44 | * New elements are added to the current menu list.
|
45 | *
|
46 | * @param menus Current menus
|
47 | * @param data New description to take into account
|
48 | * @param menuFactory Empty menu factory
|
49 | * @returns Newly created menus
|
50 | */
|
51 | function updateMenus(menus: Menu[], data: ISettingRegistry.IMenu[], menuFactory: (options: IMenuOptions) => Menu): Menu[];
|
52 | }
|