1 | import { IIterator } from '@lumino/algorithm';
|
2 | import { Message } from '@lumino/messaging';
|
3 | import { ISignal } from '@lumino/signaling';
|
4 | import { DockLayout } from './docklayout';
|
5 | import { TabBar } from './tabbar';
|
6 | import { Widget } from './widget';
|
7 |
|
8 |
|
9 |
|
10 | export declare class DockPanel extends Widget {
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 | constructor(options?: DockPanel.IOptions);
|
17 | /**
|
18 | * Dispose of the resources held by the panel.
|
19 | */
|
20 | dispose(): void;
|
21 | /**
|
22 | * The method for hiding widgets.
|
23 | */
|
24 | /**
|
25 | * Set the method for hiding widgets.
|
26 | */
|
27 | hiddenMode: Widget.HiddenMode;
|
28 | /**
|
29 | * A signal emitted when the layout configuration is modified.
|
30 | *
|
31 | * #### Notes
|
32 | * This signal is emitted whenever the current layout configuration
|
33 | * may have changed.
|
34 | *
|
35 | * This signal is emitted asynchronously in a collapsed fashion, so
|
36 | * that multiple synchronous modifications results in only a single
|
37 | * emit of the signal.
|
38 | */
|
39 | readonly layoutModified: ISignal<this, void>;
|
40 | /**
|
41 | * A signal emitted when the add button on a tab bar is clicked.
|
42 | *
|
43 | */
|
44 | readonly addRequested: ISignal<this, TabBar<Widget>>;
|
45 | /**
|
46 | * The overlay used by the dock panel.
|
47 | */
|
48 | readonly overlay: DockPanel.IOverlay;
|
49 | /**
|
50 | * The renderer used by the dock panel.
|
51 | */
|
52 | readonly renderer: DockPanel.IRenderer;
|
53 | /**
|
54 | * Get the spacing between the widgets.
|
55 | */
|
56 | /**
|
57 | * Set the spacing between the widgets.
|
58 | */
|
59 | spacing: number;
|
60 | /**
|
61 | * Get the mode for the dock panel.
|
62 | */
|
63 | /**
|
64 | * Set the mode for the dock panel.
|
65 | *
|
66 | * #### Notes
|
67 | * Changing the mode is a destructive operation with respect to the
|
68 | * panel's layout configuration. If layout state must be preserved,
|
69 | * save the current layout config before changing the mode.
|
70 | */
|
71 | mode: DockPanel.Mode;
|
72 | /**
|
73 | * Whether the tabs can be dragged / moved at runtime.
|
74 | */
|
75 | /**
|
76 | * Enable / Disable draggable / movable tabs.
|
77 | */
|
78 | tabsMovable: boolean;
|
79 | /**
|
80 | * Whether the tabs are constrained to their source dock panel
|
81 | */
|
82 | /**
|
83 | * Constrain/Allow tabs to be dragged outside of this dock panel
|
84 | */
|
85 | tabsConstrained: boolean;
|
86 | /**
|
87 | * Whether the add buttons for each tab bar are enabled.
|
88 | */
|
89 | /**
|
90 | * Set whether the add buttons for each tab bar are enabled.
|
91 | */
|
92 | addButtonEnabled: boolean;
|
93 | /**
|
94 | * Whether the dock panel is empty.
|
95 | */
|
96 | readonly isEmpty: boolean;
|
97 | /**
|
98 | * Create an iterator over the user widgets in the panel.
|
99 | *
|
100 | * @returns A new iterator over the user widgets in the panel.
|
101 | *
|
102 | * #### Notes
|
103 | * This iterator does not include the generated tab bars.
|
104 | */
|
105 | widgets(): IIterator<Widget>;
|
106 | /**
|
107 | * Create an iterator over the selected widgets in the panel.
|
108 | *
|
109 | * @returns A new iterator over the selected user widgets.
|
110 | *
|
111 | * #### Notes
|
112 | * This iterator yields the widgets corresponding to the current tab
|
113 | * of each tab bar in the panel.
|
114 | */
|
115 | selectedWidgets(): IIterator<Widget>;
|
116 | /**
|
117 | * Create an iterator over the tab bars in the panel.
|
118 | *
|
119 | * @returns A new iterator over the tab bars in the panel.
|
120 | *
|
121 | * #### Notes
|
122 | * This iterator does not include the user widgets.
|
123 | */
|
124 | tabBars(): IIterator<TabBar<Widget>>;
|
125 | /**
|
126 | * Create an iterator over the handles in the panel.
|
127 | *
|
128 | * @returns A new iterator over the handles in the panel.
|
129 | */
|
130 | handles(): IIterator<HTMLDivElement>;
|
131 | /**
|
132 | * Select a specific widget in the dock panel.
|
133 | *
|
134 | * @param widget - The widget of interest.
|
135 | *
|
136 | * #### Notes
|
137 | * This will make the widget the current widget in its tab area.
|
138 | */
|
139 | selectWidget(widget: Widget): void;
|
140 | /**
|
141 | * Activate a specified widget in the dock panel.
|
142 | *
|
143 | * @param widget - The widget of interest.
|
144 | *
|
145 | * #### Notes
|
146 | * This will select and activate the given widget.
|
147 | */
|
148 | activateWidget(widget: Widget): void;
|
149 | /**
|
150 | * Save the current layout configuration of the dock panel.
|
151 | *
|
152 | * @returns A new config object for the current layout state.
|
153 | *
|
154 | * #### Notes
|
155 | * The return value can be provided to the `restoreLayout` method
|
156 | * in order to restore the layout to its current configuration.
|
157 | */
|
158 | saveLayout(): DockPanel.ILayoutConfig;
|
159 | /**
|
160 | * Restore the layout to a previously saved configuration.
|
161 | *
|
162 | * @param config - The layout configuration to restore.
|
163 | *
|
164 | * #### Notes
|
165 | * Widgets which currently belong to the layout but which are not
|
166 | * contained in the config will be unparented.
|
167 | *
|
168 | * The dock panel automatically reverts to `'multiple-document'`
|
169 | * mode when a layout config is restored.
|
170 | */
|
171 | restoreLayout(config: DockPanel.ILayoutConfig): void;
|
172 | /**
|
173 | * Add a widget to the dock panel.
|
174 | *
|
175 | * @param widget - The widget to add to the dock panel.
|
176 | *
|
177 | * @param options - The additional options for adding the widget.
|
178 | *
|
179 | * #### Notes
|
180 | * If the panel is in single document mode, the options are ignored
|
181 | * and the widget is always added as tab in the hidden tab bar.
|
182 | */
|
183 | addWidget(widget: Widget, options?: DockPanel.IAddOptions): void;
|
184 | /**
|
185 | * Process a message sent to the widget.
|
186 | *
|
187 | * @param msg - The message sent to the widget.
|
188 | */
|
189 | processMessage(msg: Message): void;
|
190 | /**
|
191 | * Handle the DOM events for the dock panel.
|
192 | *
|
193 | * @param event - The DOM event sent to the panel.
|
194 | *
|
195 | * #### Notes
|
196 | * This method implements the DOM `EventListener` interface and is
|
197 | * called in response to events on the panel's DOM node. It should
|
198 | * not be called directly by user code.
|
199 | */
|
200 | handleEvent(event: Event): void;
|
201 | /**
|
202 | * A message handler invoked on a `'before-attach'` message.
|
203 | */
|
204 | protected onBeforeAttach(msg: Message): void;
|
205 | /**
|
206 | * A message handler invoked on an `'after-detach'` message.
|
207 | */
|
208 | protected onAfterDetach(msg: Message): void;
|
209 | /**
|
210 | * A message handler invoked on a `'child-added'` message.
|
211 | */
|
212 | protected onChildAdded(msg: Widget.ChildMessage): void;
|
213 | /**
|
214 | * A message handler invoked on a `'child-removed'` message.
|
215 | */
|
216 | protected onChildRemoved(msg: Widget.ChildMessage): void;
|
217 | /**
|
218 | * Handle the `'lm-dragenter'` event for the dock panel.
|
219 | */
|
220 | private _evtDragEnter;
|
221 | /**
|
222 | * Handle the `'lm-dragleave'` event for the dock panel.
|
223 | */
|
224 | private _evtDragLeave;
|
225 | /**
|
226 | * Handle the `'lm-dragover'` event for the dock panel.
|
227 | */
|
228 | private _evtDragOver;
|
229 | /**
|
230 | * Handle the `'lm-drop'` event for the dock panel.
|
231 | */
|
232 | private _evtDrop;
|
233 | /**
|
234 | * Handle the `'keydown'` event for the dock panel.
|
235 | */
|
236 | private _evtKeyDown;
|
237 | /**
|
238 | * Handle the `'mousedown'` event for the dock panel.
|
239 | */
|
240 | private _evtMouseDown;
|
241 | /**
|
242 | * Handle the `'mousemove'` event for the dock panel.
|
243 | */
|
244 | private _evtMouseMove;
|
245 | /**
|
246 | * Handle the `'mouseup'` event for the dock panel.
|
247 | */
|
248 | private _evtMouseUp;
|
249 | /**
|
250 | * Release the mouse grab for the dock panel.
|
251 | */
|
252 | private _releaseMouse;
|
253 | /**
|
254 | * Show the overlay indicator at the given client position.
|
255 | *
|
256 | * Returns the drop zone at the specified client position.
|
257 | *
|
258 | * #### Notes
|
259 | * If the position is not over a valid zone, the overlay is hidden.
|
260 | */
|
261 | private _showOverlay;
|
262 | /**
|
263 | * Create a new tab bar for use by the panel.
|
264 | */
|
265 | private _createTabBar;
|
266 | /**
|
267 | * Create a new handle for use by the panel.
|
268 | */
|
269 | private _createHandle;
|
270 | /**
|
271 | * Handle the `tabMoved` signal from a tab bar.
|
272 | */
|
273 | private _onTabMoved;
|
274 | /**
|
275 | * Handle the `currentChanged` signal from a tab bar.
|
276 | */
|
277 | private _onCurrentChanged;
|
278 | /**
|
279 | * Handle the `addRequested` signal from a tab bar.
|
280 | */
|
281 | private _onTabAddRequested;
|
282 | /**
|
283 | * Handle the `tabActivateRequested` signal from a tab bar.
|
284 | */
|
285 | private _onTabActivateRequested;
|
286 | /**
|
287 | * Handle the `tabCloseRequested` signal from a tab bar.
|
288 | */
|
289 | private _onTabCloseRequested;
|
290 | /**
|
291 | * Handle the `tabDetachRequested` signal from a tab bar.
|
292 | */
|
293 | private _onTabDetachRequested;
|
294 | private _edges;
|
295 | private _document;
|
296 | private _mode;
|
297 | private _drag;
|
298 | private _renderer;
|
299 | private _tabsMovable;
|
300 | private _tabsConstrained;
|
301 | private _addButtonEnabled;
|
302 | private _pressData;
|
303 | private _layoutModified;
|
304 | private _addRequested;
|
305 | }
|
306 | /**
|
307 | * The namespace for the `DockPanel` class statics.
|
308 | */
|
309 | export declare namespace DockPanel {
|
310 | |
311 |
|
312 |
|
313 | interface IOptions {
|
314 | |
315 |
|
316 |
|
317 |
|
318 |
|
319 | document?: Document | ShadowRoot;
|
320 | |
321 |
|
322 |
|
323 |
|
324 |
|
325 | overlay?: IOverlay;
|
326 | |
327 |
|
328 |
|
329 |
|
330 |
|
331 | renderer?: IRenderer;
|
332 | |
333 |
|
334 |
|
335 |
|
336 |
|
337 | spacing?: number;
|
338 | |
339 |
|
340 |
|
341 |
|
342 |
|
343 | mode?: DockPanel.Mode;
|
344 | |
345 |
|
346 |
|
347 |
|
348 | edges?: IEdges;
|
349 | |
350 |
|
351 |
|
352 |
|
353 |
|
354 | hiddenMode?: Widget.HiddenMode;
|
355 | |
356 |
|
357 |
|
358 |
|
359 |
|
360 | tabsMovable?: boolean;
|
361 | |
362 |
|
363 |
|
364 |
|
365 |
|
366 | tabsConstrained?: boolean;
|
367 | |
368 |
|
369 |
|
370 |
|
371 |
|
372 | addButtonEnabled?: boolean;
|
373 | }
|
374 | |
375 |
|
376 |
|
377 | interface IEdges {
|
378 | |
379 |
|
380 |
|
381 | top: number;
|
382 | |
383 |
|
384 |
|
385 | right: number;
|
386 | |
387 |
|
388 |
|
389 | bottom: number;
|
390 | |
391 |
|
392 |
|
393 | left: number;
|
394 | }
|
395 | |
396 |
|
397 |
|
398 | type Mode = |
399 |
|
400 |
|
401 |
|
402 |
|
403 | 'single-document'
|
404 | |
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 | | 'multiple-document';
|
411 | |
412 |
|
413 |
|
414 | type ILayoutConfig = DockLayout.ILayoutConfig;
|
415 | |
416 |
|
417 |
|
418 | type InsertMode = DockLayout.InsertMode;
|
419 | |
420 |
|
421 |
|
422 | type IAddOptions = DockLayout.IAddOptions;
|
423 | |
424 |
|
425 |
|
426 | interface IOverlayGeometry {
|
427 | |
428 |
|
429 |
|
430 | top: number;
|
431 | |
432 |
|
433 |
|
434 | left: number;
|
435 | |
436 |
|
437 |
|
438 | right: number;
|
439 | |
440 |
|
441 |
|
442 | bottom: number;
|
443 | }
|
444 | |
445 |
|
446 |
|
447 | interface IOverlay {
|
448 | |
449 |
|
450 |
|
451 | readonly node: HTMLDivElement;
|
452 | |
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 | show(geo: IOverlayGeometry): void;
|
465 | |
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 | hide(delay: number): void;
|
475 | }
|
476 | |
477 |
|
478 |
|
479 |
|
480 |
|
481 | class Overlay implements IOverlay {
|
482 | |
483 |
|
484 |
|
485 | constructor();
|
486 | /**
|
487 | * The DOM node for the overlay.
|
488 | */
|
489 | readonly node: HTMLDivElement;
|
490 | /**
|
491 | * Show the overlay using the given overlay geometry.
|
492 | *
|
493 | * @param geo - The desired geometry for the overlay.
|
494 | */
|
495 | show(geo: IOverlayGeometry): void;
|
496 | /**
|
497 | * Hide the overlay node.
|
498 | *
|
499 | * @param delay - The delay (in ms) before hiding the overlay.
|
500 | * A delay value <= 0 will hide the overlay immediately.
|
501 | */
|
502 | hide(delay: number): void;
|
503 | private _timer;
|
504 | private _hidden;
|
505 | }
|
506 | /**
|
507 | * A type alias for a dock panel renderer;
|
508 | */
|
509 | type IRenderer = DockLayout.IRenderer;
|
510 | /**
|
511 | * The default implementation of `IRenderer`.
|
512 | */
|
513 | class Renderer implements IRenderer {
|
514 | |
515 |
|
516 |
|
517 |
|
518 |
|
519 | createTabBar(document?: Document | ShadowRoot): TabBar<Widget>;
|
520 | |
521 |
|
522 |
|
523 |
|
524 |
|
525 | createHandle(): HTMLDivElement;
|
526 | }
|
527 | |
528 |
|
529 |
|
530 | const defaultRenderer: Renderer;
|
531 | }
|
532 |
|
\ | No newline at end of file |