UNPKG

3.01 kBTypeScriptView Raw
1import { IRankedMenu, RankedMenu } from '@jupyterlab/ui-components';
2import { Widget } from '@lumino/widgets';
3import { IMenuExtender } from './tokens';
4/**
5 * An interface for an Edit menu.
6 */
7export interface IEditMenu extends IRankedMenu {
8 /**
9 * A set storing IUndoers for the Edit menu.
10 */
11 readonly undoers: Set<IEditMenu.IUndoer<Widget>>;
12 /**
13 * A set storing IClearers for the Edit menu.
14 */
15 readonly clearers: Set<IEditMenu.IClearer<Widget>>;
16 /**
17 * A set storing IGoToLiners for the Edit menu.
18 */
19 readonly goToLiners: Set<IEditMenu.IGoToLiner<Widget>>;
20}
21/**
22 * An extensible Edit menu for the application.
23 */
24export declare class EditMenu extends RankedMenu implements IEditMenu {
25 /**
26 * Construct the edit menu.
27 */
28 constructor(options: IRankedMenu.IOptions);
29 /**
30 * A set storing IUndoers for the Edit menu.
31 */
32 readonly undoers: Set<IEditMenu.IUndoer<Widget>>;
33 /**
34 * A set storing IClearers for the Edit menu.
35 */
36 readonly clearers: Set<IEditMenu.IClearer<Widget>>;
37 /**
38 * A set storing IGoToLiners for the Edit menu.
39 */
40 readonly goToLiners: Set<IEditMenu.IGoToLiner<Widget>>;
41 /**
42 * Dispose of the resources held by the edit menu.
43 */
44 dispose(): void;
45}
46/**
47 * Namespace for IEditMenu
48 */
49export declare namespace IEditMenu {
50 /**
51 * Interface for an activity that uses Undo/Redo.
52 */
53 interface IUndoer<T extends Widget> extends IMenuExtender<T> {
54 /**
55 * Execute an undo command for the activity.
56 */
57 undo?: (widget: T) => void;
58 /**
59 * Execute a redo command for the activity.
60 */
61 redo?: (widget: T) => void;
62 }
63 /**
64 * Interface for an activity that wants to register a 'Clear...' menu item
65 */
66 interface IClearer<T extends Widget> extends IMenuExtender<T> {
67 /**
68 * A function to create the label for the `clearCurrent`action.
69 *
70 * This function receives the number of items `n` to be able to provided
71 * correct pluralized forms of translations.
72 */
73 clearCurrentLabel?: (n: number) => string;
74 /**
75 * A function to create the label for the `clearAll`action.
76 *
77 * This function receives the number of items `n` to be able to provided
78 * correct pluralized forms of translations.
79 */
80 clearAllLabel?: (n: number) => string;
81 /**
82 * A function to clear the currently portion of activity.
83 */
84 clearCurrent?: (widget: T) => void;
85 /**
86 * A function to clear all of an activity.
87 */
88 clearAll?: (widget: T) => void;
89 }
90 /**
91 * Interface for an activity that uses Go to Line.
92 */
93 interface IGoToLiner<T extends Widget> extends IMenuExtender<T> {
94 /**
95 * Execute a go to line command for the activity.
96 */
97 goToLine?: (widget: T) => void;
98 }
99}