UNPKG

6.63 kBTypeScriptView Raw
1import { Message } from '@lumino/messaging';
2import { ISignal } from '@lumino/signaling';
3import { Panel } from './panel';
4import { SplitLayout } from './splitlayout';
5import { Widget } from './widget';
6/**
7 * A panel which arranges its widgets into resizable sections.
8 *
9 * #### Notes
10 * This class provides a convenience wrapper around a [[SplitLayout]].
11 */
12export declare class SplitPanel extends Panel {
13 /**
14 * Construct a new split panel.
15 *
16 * @param options - The options for initializing the split panel.
17 */
18 constructor(options?: SplitPanel.IOptions);
19 /**
20 * Dispose of the resources held by the panel.
21 */
22 dispose(): void;
23 /**
24 * Get the layout orientation for the split panel.
25 */
26 /**
27 * Set the layout orientation for the split panel.
28 */
29 orientation: SplitPanel.Orientation;
30 /**
31 * Get the content alignment for the split panel.
32 *
33 * #### Notes
34 * This is the alignment of the widgets in the layout direction.
35 *
36 * The alignment has no effect if the widgets can expand to fill the
37 * entire split panel.
38 */
39 /**
40 * Set the content alignment for the split panel.
41 *
42 * #### Notes
43 * This is the alignment of the widgets in the layout direction.
44 *
45 * The alignment has no effect if the widgets can expand to fill the
46 * entire split panel.
47 */
48 alignment: SplitPanel.Alignment;
49 /**
50 * Get the inter-element spacing for the split panel.
51 */
52 /**
53 * Set the inter-element spacing for the split panel.
54 */
55 spacing: number;
56 /**
57 * The renderer used by the split panel.
58 */
59 readonly renderer: SplitPanel.IRenderer;
60 /**
61 * A signal emitted when a split handle has moved.
62 */
63 readonly handleMoved: ISignal<this, void>;
64 /**
65 * A read-only array of the split handles in the panel.
66 */
67 readonly handles: ReadonlyArray<HTMLDivElement>;
68 /**
69 * Get the relative sizes of the widgets in the panel.
70 *
71 * @returns A new array of the relative sizes of the widgets.
72 *
73 * #### Notes
74 * The returned sizes reflect the sizes of the widgets normalized
75 * relative to their siblings.
76 *
77 * This method **does not** measure the DOM nodes.
78 */
79 relativeSizes(): number[];
80 /**
81 * Set the relative sizes for the widgets in the panel.
82 *
83 * @param sizes - The relative sizes for the widgets in the panel.
84 * @param update - Update the layout after setting relative sizes.
85 * Default is True.
86 *
87 * #### Notes
88 * Extra values are ignored, too few will yield an undefined layout.
89 *
90 * The actual geometry of the DOM nodes is updated asynchronously.
91 */
92 setRelativeSizes(sizes: number[], update?: boolean): void;
93 /**
94 * Handle the DOM events for the split panel.
95 *
96 * @param event - The DOM event sent to the panel.
97 *
98 * #### Notes
99 * This method implements the DOM `EventListener` interface and is
100 * called in response to events on the panel's DOM node. It should
101 * not be called directly by user code.
102 */
103 handleEvent(event: Event): void;
104 /**
105 * A message handler invoked on a `'before-attach'` message.
106 */
107 protected onBeforeAttach(msg: Message): void;
108 /**
109 * A message handler invoked on an `'after-detach'` message.
110 */
111 protected onAfterDetach(msg: Message): void;
112 /**
113 * A message handler invoked on a `'child-added'` message.
114 */
115 protected onChildAdded(msg: Widget.ChildMessage): void;
116 /**
117 * A message handler invoked on a `'child-removed'` message.
118 */
119 protected onChildRemoved(msg: Widget.ChildMessage): void;
120 /**
121 * Handle the `'keydown'` event for the split panel.
122 */
123 private _evtKeyDown;
124 /**
125 * Handle the `'mousedown'` event for the split panel.
126 */
127 private _evtMouseDown;
128 /**
129 * Handle the `'mousemove'` event for the split panel.
130 */
131 private _evtMouseMove;
132 /**
133 * Handle the `'mouseup'` event for the split panel.
134 */
135 private _evtMouseUp;
136 /**
137 * Release the mouse grab for the split panel.
138 */
139 private _releaseMouse;
140 private _handleMoved;
141 private _pressData;
142}
143/**
144 * The namespace for the `SplitPanel` class statics.
145 */
146export declare namespace SplitPanel {
147 /**
148 * A type alias for a split panel orientation.
149 */
150 type Orientation = SplitLayout.Orientation;
151 /**
152 * A type alias for a split panel alignment.
153 */
154 type Alignment = SplitLayout.Alignment;
155 /**
156 * A type alias for a split panel renderer.
157 */
158 type IRenderer = SplitLayout.IRenderer;
159 /**
160 * An options object for initializing a split panel.
161 */
162 interface IOptions {
163 /**
164 * The renderer to use for the split panel.
165 *
166 * The default is a shared renderer instance.
167 */
168 renderer?: IRenderer;
169 /**
170 * The layout orientation of the panel.
171 *
172 * The default is `'horizontal'`.
173 */
174 orientation?: Orientation;
175 /**
176 * The content alignment of the panel.
177 *
178 * The default is `'start'`.
179 */
180 alignment?: Alignment;
181 /**
182 * The spacing between items in the panel.
183 *
184 * The default is `4`.
185 */
186 spacing?: number;
187 /**
188 * The split layout to use for the split panel.
189 *
190 * If this is provided, the other options are ignored.
191 *
192 * The default is a new `SplitLayout`.
193 */
194 layout?: SplitLayout;
195 }
196 /**
197 * The default implementation of `IRenderer`.
198 */
199 class Renderer implements IRenderer {
200 /**
201 * Create a new handle for use with a split panel.
202 *
203 * @returns A new handle element for a split panel.
204 */
205 createHandle(): HTMLDivElement;
206 }
207 /**
208 * The default `Renderer` instance.
209 */
210 const defaultRenderer: Renderer;
211 /**
212 * Get the split panel stretch factor for the given widget.
213 *
214 * @param widget - The widget of interest.
215 *
216 * @returns The split panel stretch factor for the widget.
217 */
218 function getStretch(widget: Widget): number;
219 /**
220 * Set the split panel stretch factor for the given widget.
221 *
222 * @param widget - The widget of interest.
223 *
224 * @param value - The value for the stretch factor.
225 */
226 function setStretch(widget: Widget, value: number): void;
227}
228//# sourceMappingURL=splitpanel.d.ts.map
\No newline at end of file