UNPKG

3.63 kBTypeScriptView Raw
1import { ExtractableWidget, Widget } from './widgets';
2import { MessageService } from '../common/message-service';
3import { ApplicationShell } from './shell/application-shell';
4import { Emitter } from '../common/event';
5import { SecondaryWindowService } from './window/secondary-window-service';
6import { KeybindingRegistry } from './keybinding';
7import { ColorApplicationContribution } from './color-application-contribution';
8/**
9 * Offers functionality to move a widget out of the main window to a newly created window.
10 * Widgets must explicitly implement the `ExtractableWidget` interface to support this.
11 *
12 * This handler manages the opened secondary windows and sets up messaging between them and the Theia main window.
13 * In addition, it provides access to the extracted widgets and provides notifications when widgets are added to or removed from this handler.
14 *
15 * @experimental The functionality provided by this handler is experimental and has known issues in Electron apps.
16 */
17export declare class SecondaryWindowHandler {
18 /** List of currently open secondary windows. Window references should be removed once the window is closed. */
19 protected readonly secondaryWindows: Window[];
20 /** List of widgets in secondary windows. */
21 protected readonly _widgets: ExtractableWidget[];
22 protected applicationShell: ApplicationShell;
23 protected keybindings: KeybindingRegistry;
24 protected colorAppContribution: ColorApplicationContribution;
25 protected readonly onDidAddWidgetEmitter: Emitter<Widget>;
26 /** Subscribe to get notified when a widget is added to this handler, i.e. the widget was moved to an secondary window . */
27 readonly onDidAddWidget: import("../common/event").Event<Widget>;
28 protected readonly onDidRemoveWidgetEmitter: Emitter<Widget>;
29 /** Subscribe to get notified when a widget is removed from this handler, i.e. the widget's window was closed or the widget was disposed. */
30 readonly onDidRemoveWidget: import("../common/event").Event<Widget>;
31 protected readonly messageService: MessageService;
32 protected readonly secondaryWindowService: SecondaryWindowService;
33 /** @returns List of widgets in secondary windows. */
34 get widgets(): ReadonlyArray<Widget>;
35 /**
36 * Sets up message forwarding from the main window to secondary windows.
37 * Does nothing if this service has already been initialized.
38 *
39 * @param shell The `ApplicationShell` that widgets will be moved out from.
40 */
41 init(shell: ApplicationShell): void;
42 /**
43 * Moves the given widget to a new window.
44 *
45 * @param widget the widget to extract
46 */
47 moveWidgetToSecondaryWindow(widget: ExtractableWidget): void;
48 /**
49 * If the given widget is tracked by this handler, activate it and focus its secondary window.
50 *
51 * @param widgetId The widget to activate specified by its id
52 * @returns The activated `ExtractableWidget` or `undefined` if the given widget id is unknown to this handler.
53 */
54 activateWidget(widgetId: string): ExtractableWidget | undefined;
55 /**
56 * If the given widget is tracked by this handler, reveal it by focussing its secondary window.
57 *
58 * @param widgetId The widget to reveal specified by its id
59 * @returns The revealed `ExtractableWidget` or `undefined` if the given widget id is unknown to this handler.
60 */
61 revealWidget(widgetId: string): ExtractableWidget | undefined;
62 protected addWidget(widget: ExtractableWidget): void;
63 protected removeWidget(widget: ExtractableWidget): void;
64}
65//# sourceMappingURL=secondary-window-handler.d.ts.map
\No newline at end of file