UNPKG

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