UNPKG

5.54 kBTypeScriptView Raw
1import { IIterator } from '@lumino/algorithm';
2import { Layout } from './layout';
3import { Widget } from './widget';
4/**
5 * A concrete layout implementation suitable for many use cases.
6 *
7 * #### Notes
8 * This class is suitable as a base class for implementing a variety of
9 * layouts, but can also be used directly with standard CSS to layout a
10 * collection of widgets.
11 */
12export declare class PanelLayout extends Layout {
13 /**
14 * Dispose of the resources held by the layout.
15 *
16 * #### Notes
17 * This will clear and dispose all widgets in the layout.
18 *
19 * All reimplementations should call the superclass method.
20 *
21 * This method is called automatically when the parent is disposed.
22 */
23 dispose(): void;
24 /**
25 * A read-only array of the widgets in the layout.
26 */
27 readonly widgets: ReadonlyArray<Widget>;
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 * Add a widget to the end of the layout.
36 *
37 * @param widget - The widget to add to the layout.
38 *
39 * #### Notes
40 * If the widget is already contained in the layout, it will be moved.
41 */
42 addWidget(widget: Widget): void;
43 /**
44 * Insert a widget into the layout at the specified index.
45 *
46 * @param index - The index at which to insert the widget.
47 *
48 * @param widget - The widget to insert into the layout.
49 *
50 * #### Notes
51 * The index will be clamped to the bounds of the widgets.
52 *
53 * If the widget is already added to the layout, it will be moved.
54 *
55 * #### Undefined Behavior
56 * An `index` which is non-integral.
57 */
58 insertWidget(index: number, widget: Widget): void;
59 /**
60 * Remove a widget from the layout.
61 *
62 * @param widget - The widget to remove from the layout.
63 *
64 * #### Notes
65 * A widget is automatically removed from the layout when its `parent`
66 * is set to `null`. This method should only be invoked directly when
67 * removing a widget from a layout which has yet to be installed on a
68 * parent widget.
69 *
70 * This method does *not* modify the widget's `parent`.
71 */
72 removeWidget(widget: Widget): void;
73 /**
74 * Remove the widget at a given index from the layout.
75 *
76 * @param index - The index of the widget to remove.
77 *
78 * #### Notes
79 * A widget is automatically removed from the layout when its `parent`
80 * is set to `null`. This method should only be invoked directly when
81 * removing a widget from a layout which has yet to be installed on a
82 * parent widget.
83 *
84 * This method does *not* modify the widget's `parent`.
85 *
86 * #### Undefined Behavior
87 * An `index` which is non-integral.
88 */
89 removeWidgetAt(index: number): void;
90 /**
91 * Perform layout initialization which requires the parent widget.
92 */
93 protected init(): void;
94 /**
95 * Attach a widget to the parent's DOM node.
96 *
97 * @param index - The current index of the widget in the layout.
98 *
99 * @param widget - The widget to attach to the parent.
100 *
101 * #### Notes
102 * This method is called automatically by the panel layout at the
103 * appropriate time. It should not be called directly by user code.
104 *
105 * The default implementation adds the widgets's node to the parent's
106 * node at the proper location, and sends the appropriate attach
107 * messages to the widget if the parent is attached to the DOM.
108 *
109 * Subclasses may reimplement this method to control how the widget's
110 * node is added to the parent's node.
111 */
112 protected attachWidget(index: number, widget: Widget): void;
113 /**
114 * Move a widget in the parent's DOM node.
115 *
116 * @param fromIndex - The previous index of the widget in the layout.
117 *
118 * @param toIndex - The current index of the widget in the layout.
119 *
120 * @param widget - The widget to move in the parent.
121 *
122 * #### Notes
123 * This method is called automatically by the panel layout at the
124 * appropriate time. It should not be called directly by user code.
125 *
126 * The default implementation moves the widget's node to the proper
127 * location in the parent's node and sends the appropriate attach and
128 * detach messages to the widget if the parent is attached to the DOM.
129 *
130 * Subclasses may reimplement this method to control how the widget's
131 * node is moved in the parent's node.
132 */
133 protected moveWidget(fromIndex: number, toIndex: number, widget: Widget): void;
134 /**
135 * Detach a widget from the parent's DOM node.
136 *
137 * @param index - The previous index of the widget in the layout.
138 *
139 * @param widget - The widget to detach from the parent.
140 *
141 * #### Notes
142 * This method is called automatically by the panel layout at the
143 * appropriate time. It should not be called directly by user code.
144 *
145 * The default implementation removes the widget's node from the
146 * parent's node, and sends the appropriate detach messages to the
147 * widget if the parent is attached to the DOM.
148 *
149 * Subclasses may reimplement this method to control how the widget's
150 * node is removed from the parent's node.
151 */
152 protected detachWidget(index: number, widget: Widget): void;
153 private _widgets;
154}
155//# sourceMappingURL=panellayout.d.ts.map
\No newline at end of file