UNPKG

6.51 kBTypeScriptView Raw
1import { Message } from '@lumino/messaging';
2import { ISignal } from '@lumino/signaling';
3import { Panel } from './panel';
4import { SplitLayout } from './splitlayout';
5import { Widget } from './widget';
6/**
7 * A panel which arranges its widgets into resizable sections.
8 *
9 * #### Notes
10 * This class provides a convenience wrapper around a [[SplitLayout]].
11 */
12export declare class SplitPanel extends Panel {
13 /**
14 * Construct a new split panel.
15 *
16 * @param options - The options for initializing the split panel.
17 */
18 constructor(options?: SplitPanel.IOptions);
19 /**
20 * Dispose of the resources held by the panel.
21 */
22 dispose(): void;
23 /**
24 * Get the layout orientation for the split panel.
25 */
26 /**
27 * Set the layout orientation for the split panel.
28 */
29 orientation: SplitPanel.Orientation;
30 /**
31 * Get the content alignment for the split panel.
32 *
33 * #### Notes
34 * This is the alignment of the widgets in the layout direction.
35 *
36 * The alignment has no effect if the widgets can expand to fill the
37 * entire split panel.
38 */
39 /**
40 * Set the content alignment for the split panel.
41 *
42 * #### Notes
43 * This is the alignment of the widgets in the layout direction.
44 *
45 * The alignment has no effect if the widgets can expand to fill the
46 * entire split panel.
47 */
48 alignment: SplitPanel.Alignment;
49 /**
50 * Get the inter-element spacing for the split panel.
51 */
52 /**
53 * Set the inter-element spacing for the split panel.
54 */
55 spacing: number;
56 /**
57 * The renderer used by the split panel.
58 */
59 readonly renderer: SplitPanel.IRenderer;
60 /**
61 * A signal emitted when a split handle has moved.
62 */
63 readonly handleMoved: ISignal<this, void>;
64 /**
65 * A read-only array of the split handles in the panel.
66 */
67 readonly handles: ReadonlyArray<HTMLDivElement>;
68 /**
69 * Get the relative sizes of the widgets in the panel.
70 *
71 * @returns A new array of the relative sizes of the widgets.
72 *
73 * #### Notes
74 * The returned sizes reflect the sizes of the widgets normalized
75 * relative to their siblings.
76 *
77 * This method **does not** measure the DOM nodes.
78 */
79 relativeSizes(): number[];
80 /**
81 * Set the relative sizes for the widgets in the panel.
82 *
83 * @param sizes - The relative sizes for the widgets in the panel.
84 *
85 * #### Notes
86 * Extra values are ignored, too few will yield an undefined layout.
87 *
88 * The actual geometry of the DOM nodes is updated asynchronously.
89 */
90 setRelativeSizes(sizes: number[]): void;
91 /**
92 * Handle the DOM events for the split panel.
93 *
94 * @param event - The DOM event sent to the panel.
95 *
96 * #### Notes
97 * This method implements the DOM `EventListener` interface and is
98 * called in response to events on the panel's DOM node. It should
99 * not be called directly by user code.
100 */
101 handleEvent(event: Event): void;
102 /**
103 * A message handler invoked on a `'before-attach'` message.
104 */
105 protected onBeforeAttach(msg: Message): void;
106 /**
107 * A message handler invoked on an `'after-detach'` message.
108 */
109 protected onAfterDetach(msg: Message): void;
110 /**
111 * A message handler invoked on a `'child-added'` message.
112 */
113 protected onChildAdded(msg: Widget.ChildMessage): void;
114 /**
115 * A message handler invoked on a `'child-removed'` message.
116 */
117 protected onChildRemoved(msg: Widget.ChildMessage): void;
118 /**
119 * Handle the `'keydown'` event for the split panel.
120 */
121 private _evtKeyDown;
122 /**
123 * Handle the `'mousedown'` event for the split panel.
124 */
125 private _evtMouseDown;
126 /**
127 * Handle the `'mousemove'` event for the split panel.
128 */
129 private _evtMouseMove;
130 /**
131 * Handle the `'mouseup'` event for the split panel.
132 */
133 private _evtMouseUp;
134 /**
135 * Release the mouse grab for the split panel.
136 */
137 private _releaseMouse;
138 private _handleMoved;
139 private _pressData;
140}
141/**
142 * The namespace for the `SplitPanel` class statics.
143 */
144export declare namespace SplitPanel {
145 /**
146 * A type alias for a split panel orientation.
147 */
148 type Orientation = SplitLayout.Orientation;
149 /**
150 * A type alias for a split panel alignment.
151 */
152 type Alignment = SplitLayout.Alignment;
153 /**
154 * A type alias for a split panel renderer.
155 */
156 type IRenderer = SplitLayout.IRenderer;
157 /**
158 * An options object for initializing a split panel.
159 */
160 interface IOptions {
161 /**
162 * The renderer to use for the split panel.
163 *
164 * The default is a shared renderer instance.
165 */
166 renderer?: IRenderer;
167 /**
168 * The layout orientation of the panel.
169 *
170 * The default is `'horizontal'`.
171 */
172 orientation?: Orientation;
173 /**
174 * The content alignment of the panel.
175 *
176 * The default is `'start'`.
177 */
178 alignment?: Alignment;
179 /**
180 * The spacing between items in the panel.
181 *
182 * The default is `4`.
183 */
184 spacing?: number;
185 /**
186 * The split layout to use for the split panel.
187 *
188 * If this is provided, the other options are ignored.
189 *
190 * The default is a new `SplitLayout`.
191 */
192 layout?: SplitLayout;
193 }
194 /**
195 * The default implementation of `IRenderer`.
196 */
197 class Renderer implements IRenderer {
198 /**
199 * Create a new handle for use with a split panel.
200 *
201 * @returns A new handle element for a split panel.
202 */
203 createHandle(): HTMLDivElement;
204 }
205 /**
206 * The default `Renderer` instance.
207 */
208 const defaultRenderer: Renderer;
209 /**
210 * Get the split panel stretch factor for the given widget.
211 *
212 * @param widget - The widget of interest.
213 *
214 * @returns The split panel stretch factor for the widget.
215 */
216 function getStretch(widget: Widget): number;
217 /**
218 * Set the split panel stretch factor for the given widget.
219 *
220 * @param widget - The widget of interest.
221 *
222 * @param value - The value for the stretch factor.
223 */
224 function setStretch(widget: Widget, value: number): void;
225}
226//# sourceMappingURL=splitpanel.d.ts.map
\No newline at end of file