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