import { ISequence } from '../algorithm/sequence'; import { Message } from '../core/messaging'; import { Panel, PanelLayout } from './panel'; import { ChildMessage, ResizeMessage, Widget } from './widget'; /** * A panel which arranges its widgets into resizable sections. * * #### Notes * This class provides a convenience wrapper around a [[SplitLayout]]. */ export declare class SplitPanel extends Panel { /** * Construct a new split panel. * * @param options - The options for initializing the split panel. */ constructor(options?: SplitPanel.IOptions); /** * Dispose of the resources held by the panel. */ dispose(): void; /** * Get the layout orientation for the split panel. */ /** * Set the layout orientation for the split panel. */ orientation: SplitPanel.Orientation; /** * Get the inter-element spacing for the split panel. */ /** * Set the inter-element spacing for the split panel. */ spacing: number; /** * The renderer used by the split panel. * * #### Notes * This is a read-only property. */ readonly renderer: SplitPanel.IRenderer; /** * A read-only sequence of the split handles in the panel. * * #### Notes * This is a read-only property. */ readonly handles: ISequence; /** * Get the relative sizes of the widgets in the panel. * * @returns A new array of the relative sizes of the widgets. * * #### Notes * The returned sizes reflect the sizes of the widgets normalized * relative to their siblings. * * This method **does not** measure the DOM nodes. */ relativeSizes(): number[]; /** * Set the relative sizes for the widgets in the panel. * * @param sizes - The relative sizes for the widgets in the panel. * * #### Notes * Extra values are ignored, too few will yield an undefined layout. * * The actual geometry of the DOM nodes is updated asynchronously. */ setRelativeSizes(sizes: number[]): void; /** * Handle the DOM events for the split panel. * * @param event - The DOM event sent to the panel. * * #### Notes * This method implements the DOM `EventListener` interface and is * called in response to events on the panel's DOM node. It should * not be called directly by user code. */ handleEvent(event: Event): void; /** * A message handler invoked on an `'after-attach'` message. */ protected onAfterAttach(msg: Message): void; /** * A message handler invoked on a `'before-detach'` message. */ protected onBeforeDetach(msg: Message): void; /** * A message handler invoked on a `'child-added'` message. */ protected onChildAdded(msg: ChildMessage): void; /** * A message handler invoked on a `'child-removed'` message. */ protected onChildRemoved(msg: ChildMessage): void; /** * Handle the `'keydown'` event for the split panel. */ private _evtKeyDown(event); /** * Handle the `'mousedown'` event for the split panel. */ private _evtMouseDown(event); /** * Handle the `'mousemove'` event for the split panel. */ private _evtMouseMove(event); /** * Handle the `'mouseup'` event for the split panel. */ private _evtMouseUp(event); /** * Release the mouse grab for the split panel. */ private _releaseMouse(); private _pressData; } /** * The namespace for the `SplitPanel` class statics. */ export declare namespace SplitPanel { /** * A type alias for a split panel orientation. */ type Orientation = SplitLayout.Orientation; /** * A type alias for a split panel renderer; */ type IRenderer = SplitLayout.IRenderer; /** * An options object for initializing a split panel. */ interface IOptions { /** * The renderer to use for the split panel. * * The default is a shared renderer instance. */ renderer?: IRenderer; /** * The layout orientation of the panel. * * The default is `'horizontal'`. */ orientation?: Orientation; /** * The spacing between items in the panel. * * The default is `4`. */ spacing?: number; /** * The split layout to use for the split panel. * * If this is provided, the other options are ignored. * * The default is a new `SplitLayout`. */ layout?: SplitLayout; } /** * The default implementation of `IRenderer`. */ class Renderer implements IRenderer { /** * Create a new handle node for use with a split panel. * * @returns A new handle node for a split panel. */ createHandleNode(): HTMLDivElement; } /** * The default `Renderer` instance. */ const defaultRenderer: Renderer; /** * Get the split panel stretch factor for the given widget. * * @param widget - The widget of interest. * * @returns The split panel stretch factor for the widget. */ function getStretch(widget: Widget): number; /** * Set the split panel stretch factor for the given widget. * * @param widget - The widget of interest. * * @param value - The value for the stretch factor. */ function setStretch(widget: Widget, value: number): void; } /** * A layout which arranges its widgets into resizable sections. */ export declare class SplitLayout extends PanelLayout { /** * Construct a new split layout. * * @param options - The options for initializing the layout. */ constructor(options: SplitLayout.IOptions); /** * Get the layout orientation for the split layout. */ /** * Set the layout orientation for the split layout. */ orientation: SplitLayout.Orientation; /** * Get the inter-element spacing for the split layout. */ /** * Set the inter-element spacing for the split layout. */ spacing: number; /** * The renderer used by the split layout. * * #### Notes * This is a read-only property. */ readonly renderer: SplitLayout.IRenderer; /** * A read-only sequence of the split handles in the layout. * * #### Notes * This is a read-only property. */ readonly handles: ISequence; /** * Get the relative sizes of the widgets in the layout. * * @returns A new array of the relative sizes of the widgets. * * #### Notes * The returned sizes reflect the sizes of the widgets normalized * relative to their siblings. * * This method **does not** measure the DOM nodes. */ relativeSizes(): number[]; /** * Set the relative sizes for the widgets in the layout. * * @param sizes - The relative sizes for the widgets in the panel. * * #### Notes * Extra values are ignored, too few will yield an undefined layout. * * The actual geometry of the DOM nodes is updated asynchronously. */ setRelativeSizes(sizes: number[]): void; /** * Set the offset position of a split handle. * * @param index - The index of the handle of the interest. * * @param position - The desired offset position of the handle. * * #### Notes * The position is relative to the offset parent. * * This will move the handle as close as possible to the desired * position. The sibling widgets will be adjusted as necessary. * * #### Undefined Behavior * An `index` which is non-integral or out of range. */ setHandlePosition(index: number, position: number): void; /** * Perform layout initialization which requires the parent widget. */ protected init(): void; /** * Attach a widget to the parent's DOM node. * * @param index - The current index of the widget in the layout. * * @param widget - The widget to attach to the parent. * * #### Notes * This is a reimplementation of the superclass method. */ protected attachWidget(index: number, widget: Widget): void; /** * Move a widget in the parent's DOM node. * * @param fromIndex - The previous index of the widget in the layout. * * @param toIndex - The current index of the widget in the layout. * * @param widget - The widget to move in the parent. * * #### Notes * This is a reimplementation of the superclass method. */ protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void; /** * Detach a widget from the parent's DOM node. * * @param index - The previous index of the widget in the layout. * * @param widget - The widget to detach from the parent. * * #### Notes * This is a reimplementation of the superclass method. */ protected detachWidget(index: number, widget: Widget): void; /** * A message handler invoked on an `'after-show'` message. */ protected onAfterShow(msg: Message): void; /** * A message handler invoked on an `'after-attach'` message. */ protected onAfterAttach(msg: Message): void; /** * A message handler invoked on a `'child-shown'` message. */ protected onChildShown(msg: ChildMessage): void; /** * A message handler invoked on a `'child-hidden'` message. */ protected onChildHidden(msg: ChildMessage): void; /** * A message handler invoked on a `'resize'` message. */ protected onResize(msg: ResizeMessage): void; /** * A message handler invoked on an `'update-request'` message. */ protected onUpdateRequest(msg: Message): void; /** * A message handler invoked on a `'fit-request'` message. */ protected onFitRequest(msg: Message): void; /** * Fit the layout to the total size required by the widgets. */ private _fit(); /** * Update the layout position and size of the widgets. * * The parent offset dimensions should be `-1` if unknown. */ private _update(offsetWidth, offsetHeight); private _fixed; private _spacing; private _dirty; private _hasNormedSizes; private _box; private _renderer; private _sizers; private _handles; private _orientation; } /** * The namespace for the `SplitLayout` class statics. */ export declare namespace SplitLayout { /** * A type alias for a split layout orientation. */ type Orientation = 'horizontal' | 'vertical'; /** * An options object for initializing a split layout. */ interface IOptions { /** * The renderer to use for the split layout. */ renderer: IRenderer; /** * The orientation of the layout. * * The default is `'horizontal'`. */ orientation?: Orientation; /** * The spacing between items in the layout. * * The default is `4`. */ spacing?: number; } /** * A renderer for use with a split layout. */ interface IRenderer { /** * Create a new handle node for use with a split layout. * * @returns A new handle node. */ createHandleNode(): HTMLDivElement; } /** * Get the split layout stretch factor for the given widget. * * @param widget - The widget of interest. * * @returns The split layout stretch factor for the widget. */ function getStretch(widget: Widget): number; /** * Set the split layout stretch factor for the given widget. * * @param widget - The widget of interest. * * @param value - The value for the stretch factor. */ function setStretch(widget: Widget, value: number): void; }