UNPKG

3.16 kBTypeScriptView Raw
1import { IIterator } from '@lumino/algorithm';
2import { Layout } from './layout';
3import { Widget } from './widget';
4/**
5 * A concrete layout implementation which holds a single widget.
6 *
7 * #### Notes
8 * This class is useful for creating simple container widgets which
9 * hold a single child. The child should be positioned with CSS.
10 */
11export declare class SingletonLayout extends Layout {
12 /**
13 * Dispose of the resources held by the layout.
14 */
15 dispose(): void;
16 /**
17 * Get the child widget for the layout.
18 */
19 /**
20 * Set the child widget for the layout.
21 *
22 * #### Notes
23 * Setting the child widget will cause the old child widget to be
24 * automatically disposed. If that is not desired, set the parent
25 * of the old child to `null` before assigning a new child.
26 */
27 widget: Widget | null;
28 /**
29 * Create an iterator over the widgets in the layout.
30 *
31 * @returns A new iterator over the widgets in the layout.
32 */
33 iter(): IIterator<Widget>;
34 /**
35 * Remove a widget from the layout.
36 *
37 * @param widget - The widget to remove from the layout.
38 *
39 * #### Notes
40 * A widget is automatically removed from the layout when its `parent`
41 * is set to `null`. This method should only be invoked directly when
42 * removing a widget from a layout which has yet to be installed on a
43 * parent widget.
44 *
45 * This method does *not* modify the widget's `parent`.
46 */
47 removeWidget(widget: Widget): void;
48 /**
49 * Perform layout initialization which requires the parent widget.
50 */
51 protected init(): void;
52 /**
53 * Attach a widget to the parent's DOM node.
54 *
55 * @param index - The current index of the widget in the layout.
56 *
57 * @param widget - The widget to attach to the parent.
58 *
59 * #### Notes
60 * This method is called automatically by the single layout at the
61 * appropriate time. It should not be called directly by user code.
62 *
63 * The default implementation adds the widgets's node to the parent's
64 * node at the proper location, and sends the appropriate attach
65 * messages to the widget if the parent is attached to the DOM.
66 *
67 * Subclasses may reimplement this method to control how the widget's
68 * node is added to the parent's node.
69 */
70 protected attachWidget(widget: Widget): void;
71 /**
72 * Detach a widget from the parent's DOM node.
73 *
74 * @param widget - The widget to detach from the parent.
75 *
76 * #### Notes
77 * This method is called automatically by the single layout at the
78 * appropriate time. It should not be called directly by user code.
79 *
80 * The default implementation removes the widget's node from the
81 * parent's node, and sends the appropriate detach messages to the
82 * widget if the parent is attached to the DOM.
83 *
84 * Subclasses may reimplement this method to control how the widget's
85 * node is removed from the parent's node.
86 */
87 protected detachWidget(widget: Widget): void;
88 private _widget;
89}
90//# sourceMappingURL=singletonlayout.d.ts.map
\No newline at end of file