1 | import { Layout } from './layout';
|
2 | import { Widget } from './widget';
|
3 | /**
|
4 | * A concrete layout implementation which holds a single widget.
|
5 | *
|
6 | * #### Notes
|
7 | * This class is useful for creating simple container widgets which
|
8 | * hold a single child. The child should be positioned with CSS.
|
9 | */
|
10 | export declare class SingletonLayout extends Layout {
|
11 | /**
|
12 | * Dispose of the resources held by the layout.
|
13 | */
|
14 | dispose(): void;
|
15 | /**
|
16 | * Get the child widget for the layout.
|
17 | */
|
18 | get widget(): Widget | null;
|
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 | set widget(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 | [Symbol.iterator](): IterableIterator<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 widget - The widget to attach to the parent.
|
56 | *
|
57 | * #### Notes
|
58 | * This method is called automatically by the single layout at the
|
59 | * appropriate time. It should not be called directly by user code.
|
60 | *
|
61 | * The default implementation adds the widgets's node to the parent's
|
62 | * node at the proper location, and sends the appropriate attach
|
63 | * messages to the widget if the parent is attached to the DOM.
|
64 | *
|
65 | * Subclasses may reimplement this method to control how the widget's
|
66 | * node is added to the parent's node.
|
67 | */
|
68 | protected attachWidget(widget: Widget): void;
|
69 | /**
|
70 | * Detach a widget from the parent's DOM node.
|
71 | *
|
72 | * @param widget - The widget to detach from the parent.
|
73 | *
|
74 | * #### Notes
|
75 | * This method is called automatically by the single layout at the
|
76 | * appropriate time. It should not be called directly by user code.
|
77 | *
|
78 | * The default implementation removes the widget's node from the
|
79 | * parent's node, and sends the appropriate detach messages to the
|
80 | * widget if the parent is attached to the DOM.
|
81 | *
|
82 | * Subclasses may reimplement this method to control how the widget's
|
83 | * node is removed from the parent's node.
|
84 | */
|
85 | protected detachWidget(widget: Widget): void;
|
86 | private _widget;
|
87 | }
|