1 | import { Message } from '@lumino/messaging';
|
2 | import { PanelLayout } from './panellayout';
|
3 | import { Widget } from './widget';
|
4 |
|
5 |
|
6 |
|
7 | export declare class SplitLayout extends PanelLayout {
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 | constructor(options: SplitLayout.IOptions);
|
14 | /**
|
15 | * Dispose of the resources held by the layout.
|
16 | */
|
17 | dispose(): void;
|
18 | /**
|
19 | * The renderer used by the split layout.
|
20 | */
|
21 | readonly renderer: SplitLayout.IRenderer;
|
22 | /**
|
23 | * Get the layout orientation for the split layout.
|
24 | */
|
25 | /**
|
26 | * Set the layout orientation for the split layout.
|
27 | */
|
28 | orientation: SplitLayout.Orientation;
|
29 | /**
|
30 | * Get the content alignment for the split layout.
|
31 | *
|
32 | * #### Notes
|
33 | * This is the alignment of the widgets in the layout direction.
|
34 | *
|
35 | * The alignment has no effect if the widgets can expand to fill the
|
36 | * entire split layout.
|
37 | */
|
38 | /**
|
39 | * Set the content alignment for the split layout.
|
40 | *
|
41 | * #### Notes
|
42 | * This is the alignment of the widgets in the layout direction.
|
43 | *
|
44 | * The alignment has no effect if the widgets can expand to fill the
|
45 | * entire split layout.
|
46 | */
|
47 | alignment: SplitLayout.Alignment;
|
48 | /**
|
49 | * Get the inter-element spacing for the split layout.
|
50 | */
|
51 | /**
|
52 | * Set the inter-element spacing for the split layout.
|
53 | */
|
54 | spacing: number;
|
55 | /**
|
56 | * A read-only array of the split handles in the layout.
|
57 | */
|
58 | readonly handles: ReadonlyArray<HTMLDivElement>;
|
59 | /**
|
60 | * Get the relative sizes of the widgets in the layout.
|
61 | *
|
62 | * @returns A new array of the relative sizes of the widgets.
|
63 | *
|
64 | * #### Notes
|
65 | * The returned sizes reflect the sizes of the widgets normalized
|
66 | * relative to their siblings.
|
67 | *
|
68 | * This method **does not** measure the DOM nodes.
|
69 | */
|
70 | relativeSizes(): number[];
|
71 | /**
|
72 | * Set the relative sizes for the widgets in the layout.
|
73 | *
|
74 | * @param sizes - The relative sizes for the widgets in the panel.
|
75 | *
|
76 | * #### Notes
|
77 | * Extra values are ignored, too few will yield an undefined layout.
|
78 | *
|
79 | * The actual geometry of the DOM nodes is updated asynchronously.
|
80 | */
|
81 | setRelativeSizes(sizes: number[]): void;
|
82 | /**
|
83 | * Move the offset position of a split handle.
|
84 | *
|
85 | * @param index - The index of the handle of the interest.
|
86 | *
|
87 | * @param position - The desired offset position of the handle.
|
88 | *
|
89 | * #### Notes
|
90 | * The position is relative to the offset parent.
|
91 | *
|
92 | * This will move the handle as close as possible to the desired
|
93 | * position. The sibling widgets will be adjusted as necessary.
|
94 | */
|
95 | moveHandle(index: number, position: number): void;
|
96 | /**
|
97 | * Perform layout initialization which requires the parent widget.
|
98 | */
|
99 | protected init(): void;
|
100 | /**
|
101 | * Attach a widget to the parent's DOM node.
|
102 | *
|
103 | * @param index - The current index of the widget in the layout.
|
104 | *
|
105 | * @param widget - The widget to attach to the parent.
|
106 | *
|
107 | * #### Notes
|
108 | * This is a reimplementation of the superclass method.
|
109 | */
|
110 | protected attachWidget(index: number, widget: Widget): void;
|
111 | /**
|
112 | * Move a widget in the parent's DOM node.
|
113 | *
|
114 | * @param fromIndex - The previous index of the widget in the layout.
|
115 | *
|
116 | * @param toIndex - The current index of the widget in the layout.
|
117 | *
|
118 | * @param widget - The widget to move in the parent.
|
119 | *
|
120 | * #### Notes
|
121 | * This is a reimplementation of the superclass method.
|
122 | */
|
123 | protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void;
|
124 | /**
|
125 | * Detach a widget from the parent's DOM node.
|
126 | *
|
127 | * @param index - The previous index of the widget in the layout.
|
128 | *
|
129 | * @param widget - The widget to detach from the parent.
|
130 | *
|
131 | * #### Notes
|
132 | * This is a reimplementation of the superclass method.
|
133 | */
|
134 | protected detachWidget(index: number, widget: Widget): void;
|
135 | /**
|
136 | * A message handler invoked on a `'before-show'` message.
|
137 | */
|
138 | protected onBeforeShow(msg: Message): void;
|
139 | /**
|
140 | * A message handler invoked on a `'before-attach'` message.
|
141 | */
|
142 | protected onBeforeAttach(msg: Message): void;
|
143 | /**
|
144 | * A message handler invoked on a `'child-shown'` message.
|
145 | */
|
146 | protected onChildShown(msg: Widget.ChildMessage): void;
|
147 | /**
|
148 | * A message handler invoked on a `'child-hidden'` message.
|
149 | */
|
150 | protected onChildHidden(msg: Widget.ChildMessage): void;
|
151 | /**
|
152 | * A message handler invoked on a `'resize'` message.
|
153 | */
|
154 | protected onResize(msg: Widget.ResizeMessage): void;
|
155 | /**
|
156 | * A message handler invoked on an `'update-request'` message.
|
157 | */
|
158 | protected onUpdateRequest(msg: Message): void;
|
159 | /**
|
160 | * A message handler invoked on a `'fit-request'` message.
|
161 | */
|
162 | protected onFitRequest(msg: Message): void;
|
163 | /**
|
164 | * Update the item position.
|
165 | *
|
166 | * @param i Item index
|
167 | * @param isHorizontal Whether the layout is horizontal or not
|
168 | * @param left Left position in pixels
|
169 | * @param top Top position in pixels
|
170 | * @param height Item height
|
171 | * @param width Item width
|
172 | * @param size Item size
|
173 | */
|
174 | protected updateItemPosition(i: number, isHorizontal: boolean, left: number, top: number, height: number, width: number, size: number): void;
|
175 | /**
|
176 | * Fit the layout to the total size required by the widgets.
|
177 | */
|
178 | private _fit;
|
179 | /**
|
180 | * Update the layout position and size of the widgets.
|
181 | *
|
182 | * The parent offset dimensions should be `-1` if unknown.
|
183 | */
|
184 | private _update;
|
185 | protected widgetOffset: number;
|
186 | private _fixed;
|
187 | private _spacing;
|
188 | private _dirty;
|
189 | private _hasNormedSizes;
|
190 | private _sizers;
|
191 | private _items;
|
192 | private _handles;
|
193 | private _box;
|
194 | private _alignment;
|
195 | private _orientation;
|
196 | }
|
197 | /**
|
198 | * The namespace for the `SplitLayout` class statics.
|
199 | */
|
200 | export declare namespace SplitLayout {
|
201 | |
202 |
|
203 |
|
204 | type Orientation = 'horizontal' | 'vertical';
|
205 | |
206 |
|
207 |
|
208 | type Alignment = 'start' | 'center' | 'end' | 'justify';
|
209 | |
210 |
|
211 |
|
212 | interface IOptions {
|
213 | |
214 |
|
215 |
|
216 | renderer: IRenderer;
|
217 | |
218 |
|
219 |
|
220 |
|
221 |
|
222 | orientation?: Orientation;
|
223 | |
224 |
|
225 |
|
226 |
|
227 |
|
228 | alignment?: Alignment;
|
229 | |
230 |
|
231 |
|
232 |
|
233 |
|
234 | spacing?: number;
|
235 | }
|
236 | |
237 |
|
238 |
|
239 | interface IRenderer {
|
240 | |
241 |
|
242 |
|
243 |
|
244 |
|
245 | createHandle(): HTMLDivElement;
|
246 | }
|
247 | |
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | function getStretch(widget: Widget): number;
|
255 | |
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 | function setStretch(widget: Widget, value: number): void;
|
263 | }
|
264 |
|
\ | No newline at end of file |