import { Message } from '../core/messaging'; import { Panel, PanelLayout } from './panel'; import { ChildMessage, ResizeMessage, Widget } from './widget'; /** * A panel which arranges its widgets in a single row or column. * * #### Notes * This class provides a convenience wrapper around a [[BoxLayout]]. */ export declare class BoxPanel extends Panel { /** * Construct a new box panel. * * @param options - The options for initializing the box panel. */ constructor(options?: BoxPanel.IOptions); /** * Get the layout direction for the box panel. */ /** * Set the layout direction for the box panel. */ direction: BoxPanel.Direction; /** * Get the inter-element spacing for the box panel. */ /** * Set the inter-element spacing for the box panel. */ spacing: number; /** * 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; } /** * The namespace for the `BoxPanel` class statics. */ export declare namespace BoxPanel { /** * A type alias for a box panel direction. */ type Direction = BoxLayout.Direction; /** * An options object for initializing a box panel. */ interface IOptions { /** * The layout direction of the panel. * * The default is `'top-to-bottom'`. */ direction?: Direction; /** * The spacing between items in the panel. * * The default is `4`. */ spacing?: number; /** * The box layout to use for the box panel. * * If this is provided, the other options are ignored. * * The default is a new `BoxLayout`. */ layout?: BoxLayout; } /** * Get the box panel stretch factor for the given widget. * * @param widget - The widget of interest. * * @returns The box panel stretch factor for the widget. */ function getStretch(widget: Widget): number; /** * Set the box 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; /** * Get the box panel size basis for the given widget. * * @param widget - The widget of interest. * * @returns The box panel size basis for the widget. */ function getSizeBasis(widget: Widget): number; /** * Set the box panel size basis for the given widget. * * @param widget - The widget of interest. * * @param value - The value for the size basis. */ function setSizeBasis(widget: Widget, value: number): void; } /** * A layout which arranges its widgets in a single row or column. */ export declare class BoxLayout extends PanelLayout { /** * Construct a new box layout. * * @param options - The options for initializing the layout. */ constructor(options?: BoxLayout.IOptions); /** * Get the layout direction for the box layout. */ /** * Set the layout direction for the box layout. */ direction: BoxLayout.Direction; /** * Get the inter-element spacing for the box layout. */ /** * Set the inter-element spacing for the box layout. */ spacing: number; /** * 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 _box; private _sizers; private _direction; } /** * The namespace for the `BoxLayout` class statics. */ export declare namespace BoxLayout { /** * A type alias for a box layout direction. */ type Direction = ('left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top'); /** * An options object for initializing a box layout. */ interface IOptions { /** * The direction of the layout. * * The default is `'top-to-bottom'`. */ direction?: Direction; /** * The spacing between items in the layout. * * The default is `4`. */ spacing?: number; } /** * Get the box layout stretch factor for the given widget. * * @param widget - The widget of interest. * * @returns The box layout stretch factor for the widget. */ function getStretch(widget: Widget): number; /** * Set the box 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; /** * Get the box layout size basis for the given widget. * * @param widget - The widget of interest. * * @returns The box layout size basis for the widget. */ function getSizeBasis(widget: Widget): number; /** * Set the box layout size basis for the given widget. * * @param widget - The widget of interest. * * @param value - The value for the size basis. */ function setSizeBasis(widget: Widget, value: number): void; }