1 | import { ISignal } from '@phosphor/signaling';
|
2 | import { StackedPanel } from './stackedpanel';
|
3 | import { TabBar } from './tabbar';
|
4 | import { Widget } from './widget';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | export declare class TabPanel extends Widget {
|
17 | |
18 |
|
19 |
|
20 |
|
21 |
|
22 | constructor(options?: TabPanel.IOptions);
|
23 | /**
|
24 | * A signal emitted when the current tab is changed.
|
25 | *
|
26 | * #### Notes
|
27 | * This signal is emitted when the currently selected tab is changed
|
28 | * either through user or programmatic interaction.
|
29 | *
|
30 | * Notably, this signal is not emitted when the index of the current
|
31 | * tab changes due to tabs being inserted, removed, or moved. It is
|
32 | * only emitted when the actual current tab node is changed.
|
33 | */
|
34 | readonly currentChanged: ISignal<this, TabPanel.ICurrentChangedArgs>;
|
35 | /**
|
36 | * Get the index of the currently selected tab.
|
37 | *
|
38 | * #### Notes
|
39 | * This will be `-1` if no tab is selected.
|
40 | */
|
41 | /**
|
42 | * Set the index of the currently selected tab.
|
43 | *
|
44 | * #### Notes
|
45 | * If the index is out of range, it will be set to `-1`.
|
46 | */
|
47 | currentIndex: number;
|
48 | /**
|
49 | * Get the currently selected widget.
|
50 | *
|
51 | * #### Notes
|
52 | * This will be `null` if there is no selected tab.
|
53 | */
|
54 | /**
|
55 | * Set the currently selected widget.
|
56 | *
|
57 | * #### Notes
|
58 | * If the widget is not in the panel, it will be set to `null`.
|
59 | */
|
60 | currentWidget: Widget | null;
|
61 | /**
|
62 | * Get the whether the tabs are movable by the user.
|
63 | *
|
64 | * #### Notes
|
65 | * Tabs can always be moved programmatically.
|
66 | */
|
67 | /**
|
68 | * Set the whether the tabs are movable by the user.
|
69 | *
|
70 | * #### Notes
|
71 | * Tabs can always be moved programmatically.
|
72 | */
|
73 | tabsMovable: boolean;
|
74 | /**
|
75 | * Get the tab placement for the tab panel.
|
76 | *
|
77 | * #### Notes
|
78 | * This controls the position of the tab bar relative to the content.
|
79 | */
|
80 | /**
|
81 | * Set the tab placement for the tab panel.
|
82 | *
|
83 | * #### Notes
|
84 | * This controls the position of the tab bar relative to the content.
|
85 | */
|
86 | tabPlacement: TabPanel.TabPlacement;
|
87 | /**
|
88 | * The tab bar used by the tab panel.
|
89 | *
|
90 | * #### Notes
|
91 | * Modifying the tab bar directly can lead to undefined behavior.
|
92 | */
|
93 | readonly tabBar: TabBar<Widget>;
|
94 | /**
|
95 | * The stacked panel used by the tab panel.
|
96 | *
|
97 | * #### Notes
|
98 | * Modifying the panel directly can lead to undefined behavior.
|
99 | */
|
100 | readonly stackedPanel: StackedPanel;
|
101 | /**
|
102 | * A read-only array of the widgets in the panel.
|
103 | */
|
104 | readonly widgets: ReadonlyArray<Widget>;
|
105 | /**
|
106 | * Add a widget to the end of the tab panel.
|
107 | *
|
108 | * @param widget - The widget to add to the tab panel.
|
109 | *
|
110 | * #### Notes
|
111 | * If the widget is already contained in the panel, it will be moved.
|
112 | *
|
113 | * The widget's `title` is used to populate the tab.
|
114 | */
|
115 | addWidget(widget: Widget): void;
|
116 | /**
|
117 | * Insert a widget into the tab panel at a specified index.
|
118 | *
|
119 | * @param index - The index at which to insert the widget.
|
120 | *
|
121 | * @param widget - The widget to insert into to the tab panel.
|
122 | *
|
123 | * #### Notes
|
124 | * If the widget is already contained in the panel, it will be moved.
|
125 | *
|
126 | * The widget's `title` is used to populate the tab.
|
127 | */
|
128 | insertWidget(index: number, widget: Widget): void;
|
129 | /**
|
130 | * Handle the `currentChanged` signal from the tab bar.
|
131 | */
|
132 | private _onCurrentChanged;
|
133 | /**
|
134 | * Handle the `tabActivateRequested` signal from the tab bar.
|
135 | */
|
136 | private _onTabActivateRequested;
|
137 | /**
|
138 | * Handle the `tabCloseRequested` signal from the tab bar.
|
139 | */
|
140 | private _onTabCloseRequested;
|
141 | /**
|
142 | * Handle the `tabMoved` signal from the tab bar.
|
143 | */
|
144 | private _onTabMoved;
|
145 | /**
|
146 | * Handle the `widgetRemoved` signal from the stacked panel.
|
147 | */
|
148 | private _onWidgetRemoved;
|
149 | private _tabPlacement;
|
150 | private _currentChanged;
|
151 | }
|
152 | /**
|
153 | * The namespace for the `TabPanel` class statics.
|
154 | */
|
155 | export declare namespace TabPanel {
|
156 | |
157 |
|
158 |
|
159 | type TabPlacement = (
|
160 | |
161 |
|
162 |
|
163 | 'top' |
|
164 | |
165 |
|
166 |
|
167 | 'left' |
|
168 | |
169 |
|
170 |
|
171 | 'right' |
|
172 | |
173 |
|
174 |
|
175 | 'bottom');
|
176 | |
177 |
|
178 |
|
179 | interface IOptions {
|
180 | |
181 |
|
182 |
|
183 |
|
184 |
|
185 | tabsMovable?: boolean;
|
186 | |
187 |
|
188 |
|
189 |
|
190 |
|
191 | tabPlacement?: TabPlacement;
|
192 | |
193 |
|
194 |
|
195 |
|
196 |
|
197 | renderer?: TabBar.IRenderer<Widget>;
|
198 | }
|
199 | |
200 |
|
201 |
|
202 | interface ICurrentChangedArgs {
|
203 | |
204 |
|
205 |
|
206 | previousIndex: number;
|
207 | |
208 |
|
209 |
|
210 | previousWidget: Widget | null;
|
211 | |
212 |
|
213 |
|
214 | currentIndex: number;
|
215 | |
216 |
|
217 |
|
218 | currentWidget: Widget | null;
|
219 | }
|
220 | }
|