UNPKG

2.69 kBTypeScriptView Raw
1import { FrontendApplicationConfig } from '@theia/application-package';
2import { FrontendApplicationState } from '../common/frontend-application-state';
3import { StopReason } from '../electron-common/messaging/electron-messages';
4import { BrowserWindow, BrowserWindowConstructorOptions, IpcMainEvent } from '../../electron-shared/electron';
5import { ElectronMainApplicationGlobals } from './electron-main-constants';
6import { DisposableCollection, Emitter, Event } from '../common';
7/**
8 * Theia tracks the maximized state of Electron Browser Windows.
9 */
10export interface TheiaBrowserWindowOptions extends BrowserWindowConstructorOptions {
11 isMaximized?: boolean;
12 isFullScreen?: boolean;
13 /**
14 * Represents the complete screen layout for all available displays.
15 * This field is used to determine if the layout was updated since the electron window was last opened,
16 * in which case we want to invalidate the stored options and use the default options instead.
17 */
18 screenLayout?: string;
19}
20export declare const TheiaBrowserWindowOptions: unique symbol;
21export declare const WindowApplicationConfig: unique symbol;
22export declare type WindowApplicationConfig = FrontendApplicationConfig;
23export declare class TheiaElectronWindow {
24 protected readonly options: TheiaBrowserWindowOptions;
25 protected readonly config: WindowApplicationConfig;
26 protected readonly globals: ElectronMainApplicationGlobals;
27 protected onDidCloseEmitter: Emitter<void>;
28 get onDidClose(): Event<void>;
29 protected readonly toDispose: DisposableCollection;
30 protected _window: BrowserWindow;
31 get window(): BrowserWindow;
32 protected closeIsConfirmed: boolean;
33 protected applicationState: FrontendApplicationState;
34 protected init(): void;
35 /**
36 * Only show the window when the content is ready.
37 */
38 protected attachReadyToShow(): void;
39 protected attachCloseListeners(): void;
40 protected doCloseWindow(): void;
41 close(reason?: StopReason): Promise<boolean>;
42 protected reload(): void;
43 protected handleStopRequest(onSafeCallback: () => unknown, reason: StopReason): Promise<boolean>;
44 protected checkSafeToStop(reason: StopReason): Promise<boolean>;
45 protected restoreMaximizedState(): void;
46 protected trackApplicationState(): void;
47 protected attachReloadListener(): void;
48 protected isSender(e: IpcMainEvent): boolean;
49 dispose(): void;
50}
51export interface TheiaElectronWindowFactory {
52 (options: TheiaBrowserWindowOptions, config: FrontendApplicationConfig): TheiaElectronWindow;
53}
54export declare const TheiaElectronWindowFactory: unique symbol;
55//# sourceMappingURL=theia-electron-window.d.ts.map
\No newline at end of file