Path: blob/main/src/vs/platform/layout/browser/layoutService.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { IDimension } from '../../../base/browser/dom.js';6import { Event } from '../../../base/common/event.js';7import { DisposableStore } from '../../../base/common/lifecycle.js';8import { createDecorator } from '../../instantiation/common/instantiation.js';910export const ILayoutService = createDecorator<ILayoutService>('layoutService');1112export interface ILayoutOffsetInfo {1314/**15* Generic top offset16*/17readonly top: number;1819/**20* Quick pick specific top offset.21*/22readonly quickPickTop: number;23}2425export interface ILayoutService {2627readonly _serviceBrand: undefined;2829/**30* An event that is emitted when the main container is layed out.31*/32readonly onDidLayoutMainContainer: Event<IDimension>;3334/**35* An event that is emitted when any container is layed out.36*/37readonly onDidLayoutContainer: Event<{ readonly container: HTMLElement; readonly dimension: IDimension }>;3839/**40* An event that is emitted when the active container is layed out.41*/42readonly onDidLayoutActiveContainer: Event<IDimension>;4344/**45* An event that is emitted when a new container is added. This46* can happen in multi-window environments.47*/48readonly onDidAddContainer: Event<{ readonly container: HTMLElement; readonly disposables: DisposableStore }>;4950/**51* An event that is emitted when the active container changes.52*/53readonly onDidChangeActiveContainer: Event<void>;5455/**56* The dimensions of the main container.57*/58readonly mainContainerDimension: IDimension;5960/**61* The dimensions of the active container.62*/63readonly activeContainerDimension: IDimension;6465/**66* Main container of the application.67*/68readonly mainContainer: HTMLElement;6970/**71* Active container of the application. When multiple windows are opened, will return72* the container of the active, focused window.73*/74readonly activeContainer: HTMLElement;7576/**77* All the containers of the application. There can be one container per window.78*/79readonly containers: Iterable<HTMLElement>;8081/**82* Get the container for the given window.83*/84getContainer(window: Window): HTMLElement;8586/**87* Ensures that the styles for the container associated88* to the window have loaded. For the main window, this89* will resolve instantly, but for floating windows, this90* will resolve once the styles have been loaded and helps91* for when certain layout assumptions are made.92*/93whenContainerStylesLoaded(window: Window): Promise<void> | undefined;9495/**96* An offset to use for positioning elements inside the main container.97*/98readonly mainContainerOffset: ILayoutOffsetInfo;99100/**101* An offset to use for positioning elements inside the container.102*/103readonly activeContainerOffset: ILayoutOffsetInfo;104105/**106* Focus the primary component of the active container.107*/108focus(): void;109}110111112