UNPKG

3.91 kBTypeScriptView Raw
1import { BoxLayout } from './boxlayout';
2import { Panel } from './panel';
3import { Widget } from './widget';
4/**
5 * A panel which arranges its widgets in a single row or column.
6 *
7 * #### Notes
8 * This class provides a convenience wrapper around a {@link BoxLayout}.
9 */
10export declare class BoxPanel extends Panel {
11 /**
12 * Construct a new box panel.
13 *
14 * @param options - The options for initializing the box panel.
15 */
16 constructor(options?: BoxPanel.IOptions);
17 /**
18 * Get the layout direction for the box panel.
19 */
20 get direction(): BoxPanel.Direction;
21 /**
22 * Set the layout direction for the box panel.
23 */
24 set direction(value: BoxPanel.Direction);
25 /**
26 * Get the content alignment for the box panel.
27 *
28 * #### Notes
29 * This is the alignment of the widgets in the layout direction.
30 *
31 * The alignment has no effect if the widgets can expand to fill the
32 * entire box layout.
33 */
34 get alignment(): BoxPanel.Alignment;
35 /**
36 * Set the content alignment for the box panel.
37 *
38 * #### Notes
39 * This is the alignment of the widgets in the layout direction.
40 *
41 * The alignment has no effect if the widgets can expand to fill the
42 * entire box layout.
43 */
44 set alignment(value: BoxPanel.Alignment);
45 /**
46 * Get the inter-element spacing for the box panel.
47 */
48 get spacing(): number;
49 /**
50 * Set the inter-element spacing for the box panel.
51 */
52 set spacing(value: number);
53 /**
54 * A message handler invoked on a `'child-added'` message.
55 */
56 protected onChildAdded(msg: Widget.ChildMessage): void;
57 /**
58 * A message handler invoked on a `'child-removed'` message.
59 */
60 protected onChildRemoved(msg: Widget.ChildMessage): void;
61}
62/**
63 * The namespace for the `BoxPanel` class statics.
64 */
65export declare namespace BoxPanel {
66 /**
67 * A type alias for a box panel direction.
68 */
69 type Direction = BoxLayout.Direction;
70 /**
71 * A type alias for a box panel alignment.
72 */
73 type Alignment = BoxLayout.Alignment;
74 /**
75 * An options object for initializing a box panel.
76 */
77 interface IOptions {
78 /**
79 * The layout direction of the panel.
80 *
81 * The default is `'top-to-bottom'`.
82 */
83 direction?: Direction;
84 /**
85 * The content alignment of the panel.
86 *
87 * The default is `'start'`.
88 */
89 alignment?: Alignment;
90 /**
91 * The spacing between items in the panel.
92 *
93 * The default is `4`.
94 */
95 spacing?: number;
96 /**
97 * The box layout to use for the box panel.
98 *
99 * If this is provided, the other options are ignored.
100 *
101 * The default is a new `BoxLayout`.
102 */
103 layout?: BoxLayout;
104 }
105 /**
106 * Get the box panel stretch factor for the given widget.
107 *
108 * @param widget - The widget of interest.
109 *
110 * @returns The box panel stretch factor for the widget.
111 */
112 function getStretch(widget: Widget): number;
113 /**
114 * Set the box panel stretch factor for the given widget.
115 *
116 * @param widget - The widget of interest.
117 *
118 * @param value - The value for the stretch factor.
119 */
120 function setStretch(widget: Widget, value: number): void;
121 /**
122 * Get the box panel size basis for the given widget.
123 *
124 * @param widget - The widget of interest.
125 *
126 * @returns The box panel size basis for the widget.
127 */
128 function getSizeBasis(widget: Widget): number;
129 /**
130 * Set the box panel size basis for the given widget.
131 *
132 * @param widget - The widget of interest.
133 *
134 * @param value - The value for the size basis.
135 */
136 function setSizeBasis(widget: Widget, value: number): void;
137}