@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
102 lines • 5.17 kB
TypeScript
import { TabBar, Widget, DockPanel, Title } from '@lumino/widgets';
import { Signal } from '@lumino/signaling';
import { Drag } from '@lumino/dragdrop';
import { DisposableCollection } from '../../common/disposable.js';
import { CorePreferences } from '../../common/core-preferences.js';
import { Emitter, Event } from '../../common/index.js';
import { TabDropHelper } from './tab-drop-helper.js';
export declare const ACTIVE_TABBAR_CLASS = "theia-tabBar-active";
export declare const MAIN_AREA_ID = "theia-main-content-panel";
export declare const BOTTOM_AREA_ID = "theia-bottom-content-panel";
/**
* This specialization of DockPanel adds various events that are used for implementing the
* side panels of the application shell.
*/
export declare class TheiaDockPanel extends DockPanel {
protected readonly preferences?: CorePreferences | undefined;
protected readonly maximizeCallback?: ((area: TheiaDockPanel) => void) | undefined;
/**
* Emitted when a widget is added to the panel.
*/
readonly widgetAdded: Signal<this, Widget>;
/**
* Emitted when a widget is activated by calling `activateWidget`.
*/
readonly widgetActivated: Signal<this, Widget>;
/**
* Emitted when a widget is removed from the panel.
*/
readonly widgetRemoved: Signal<this, Widget>;
protected readonly onDidChangeCurrentEmitter: Emitter<Title<Widget> | undefined>;
protected disableDND: boolean | undefined;
protected tabWithDNDDisabledStyling?: HTMLElement;
protected readonly tabDropHelper: TabDropHelper;
protected canDropWidget?: (widget: Widget) => boolean;
protected onWillDropWidget?: (widget: Widget) => void;
get onDidChangeCurrent(): Event<Title<Widget> | undefined>;
constructor(options?: DockPanel.IOptions, preferences?: CorePreferences | undefined, maximizeCallback?: ((area: TheiaDockPanel) => void) | undefined);
protected onTabDetachRequestedWithDisabledDND(sender: TabBar<Widget>, args: TabBar.ITabDetachRequestedArgs<Widget>): void;
protected onNullTabDragDataWithDisabledDND(): void;
handleEvent(event: globalThis.Event): void;
protected isDropAllowed(event: Drag.Event): boolean;
protected notifyWillDrop(event: Drag.Event): void;
/**
* Handles dragging a widget over the tab bars of this panel: the widget is inserted as a tab where it is dropped,
* instead of after the current tab of the tab bar as Lumino does.
*
* @returns `true` if the event has been handled
*/
protected handleTabBarDragEvent(event: Drag.Event): boolean;
protected getDraggedWidget(event: Drag.Event): Widget | undefined;
protected findTabBarAt(clientX: number, clientY: number): TabBar<Widget> | undefined;
protected insertTab(tabBar: TabBar<Widget>, index: number, widget: Widget): void;
toggleMaximized(): void;
isElectron(): boolean;
protected _currentTitle: Title<Widget> | undefined;
get currentTitle(): Title<Widget> | undefined;
get currentTabBar(): TabBar<Widget> | undefined;
findTabBar(title: Title<Widget>): TabBar<Widget> | undefined;
protected readonly toDisposeOnMarkAsCurrent: DisposableCollection;
markAsCurrent(title: Title<Widget> | undefined): void;
markActiveTabBar(title?: Title<Widget>): void;
addWidget(widget: Widget, options?: TheiaDockPanel.AddOptions): void;
activateWidget(widget: Widget): void;
protected onChildRemoved(msg: Widget.ChildMessage): void;
nextTabBarWidget(widget: Widget): Widget | undefined;
nextTabBarInPanel(tabBar: TabBar<Widget>): TabBar<Widget> | undefined;
previousTabBarWidget(widget: Widget): Widget | undefined;
previousTabBarInPanel(tabBar: TabBar<Widget>): TabBar<Widget> | undefined;
dispose(): void;
}
export declare namespace TheiaDockPanel {
const Factory: unique symbol;
interface Factory {
(options?: DockPanel.IOptions | TheiaDockPanel.IOptions, maximizeCallback?: (area: TheiaDockPanel) => void): TheiaDockPanel;
}
interface IOptions extends DockPanel.IOptions {
/** whether drag and drop for tabs should be disabled */
disableDragAndDrop?: boolean;
/**
* @param sender the tab bar
* @param args the widget (title)
* @returns true if the request was handled by this handler, false if the tabbar should handle the request
*/
closeHandler?: (sender: TabBar<Widget>, args: TabBar.ITabCloseRequestedArgs<Widget>) => boolean;
/**
* Whether the given widget may be dropped on this panel. By default, any widget may be dropped.
*/
canDropWidget?: (widget: Widget) => boolean;
/**
* Called when the given widget is dropped on this panel, before it is added to the panel.
*/
onWillDropWidget?: (widget: Widget) => void;
}
function isTheiaDockPanelIOptions(options: DockPanel.IOptions | undefined): options is IOptions;
interface AddOptions extends DockPanel.IAddOptions {
/**
* Whether to also close the widget referenced by `ref`.
*/
closeRef?: boolean;
}
}
//# sourceMappingURL=theia-dock-panel.d.ts.map