UNPKG

5.93 kBTypeScriptView Raw
1import { IDisposable } from '@lumino/disposable';
2import { ISignal } from '@lumino/signaling';
3import { VirtualElement } from '@lumino/virtualdom';
4/**
5 * An object which holds data related to an object's title.
6 *
7 * #### Notes
8 * A title object is intended to hold the data necessary to display a
9 * header for a particular object. A common example is the `TabPanel`,
10 * which uses the widget title to populate the tab for a child widget.
11 *
12 * It is the responsibility of the owner to call the title disposal.
13 */
14export declare class Title<T> implements IDisposable {
15 /**
16 * Construct a new title.
17 *
18 * @param options - The options for initializing the title.
19 */
20 constructor(options: Title.IOptions<T>);
21 /**
22 * A signal emitted when the state of the title changes.
23 */
24 readonly changed: ISignal<this, void>;
25 /**
26 * The object which owns the title.
27 */
28 readonly owner: T;
29 /**
30 * Get the label for the title.
31 *
32 * #### Notes
33 * The default value is an empty string.
34 */
35 /**
36 * Set the label for the title.
37 */
38 label: string;
39 /**
40 * Get the mnemonic index for the title.
41 *
42 * #### Notes
43 * The default value is `-1`.
44 */
45 /**
46 * Set the mnemonic index for the title.
47 */
48 mnemonic: number;
49 /**
50 * Get the icon renderer for the title.
51 *
52 * #### Notes
53 * The default value is undefined.
54 *
55 * DEPRECATED: if set to a string value, the .icon field will function as
56 * an alias for the .iconClass field, for backwards compatibility
57 */
58 /**
59 * Set the icon renderer for the title.
60 *
61 * #### Notes
62 * A renderer is an object that supplies a render and unrender function.
63 *
64 * DEPRECATED: if set to a string value, the .icon field will function as
65 * an alias for the .iconClass field, for backwards compatibility
66 */
67 icon: VirtualElement.IRenderer | undefined | string;
68 /**
69 * Get the icon class name for the title.
70 *
71 * #### Notes
72 * The default value is an empty string.
73 */
74 /**
75 * Set the icon class name for the title.
76 *
77 * #### Notes
78 * Multiple class names can be separated with whitespace.
79 */
80 iconClass: string;
81 /**
82 * Get the icon label for the title.
83 *
84 * #### Notes
85 * The default value is an empty string.
86 */
87 /**
88 * Set the icon label for the title.
89 *
90 * #### Notes
91 * Multiple class names can be separated with whitespace.
92 */
93 iconLabel: string;
94 /**
95 * @deprecated Use `icon` instead.
96 */
97 /**
98 * @deprecated Use `icon` instead.
99 */
100 iconRenderer: VirtualElement.IRenderer | undefined;
101 /**
102 * Get the caption for the title.
103 *
104 * #### Notes
105 * The default value is an empty string.
106 */
107 /**
108 * Set the caption for the title.
109 */
110 caption: string;
111 /**
112 * Get the extra class name for the title.
113 *
114 * #### Notes
115 * The default value is an empty string.
116 */
117 /**
118 * Set the extra class name for the title.
119 *
120 * #### Notes
121 * Multiple class names can be separated with whitespace.
122 */
123 className: string;
124 /**
125 * Get the closable state for the title.
126 *
127 * #### Notes
128 * The default value is `false`.
129 */
130 /**
131 * Set the closable state for the title.
132 *
133 * #### Notes
134 * This controls the presence of a close icon when applicable.
135 */
136 closable: boolean;
137 /**
138 * Get the dataset for the title.
139 *
140 * #### Notes
141 * The default value is an empty dataset.
142 */
143 /**
144 * Set the dataset for the title.
145 *
146 * #### Notes
147 * This controls the data attributes when applicable.
148 */
149 dataset: Title.Dataset;
150 /**
151 * Test whether the title has been disposed.
152 */
153 readonly isDisposed: boolean;
154 /**
155 * Dispose of the resources held by the title.
156 *
157 * #### Notes
158 * It is the responsibility of the owner to call the title disposal.
159 */
160 dispose(): void;
161 private _label;
162 private _caption;
163 private _mnemonic;
164 private _icon;
165 private _iconClass;
166 private _iconLabel;
167 private _className;
168 private _closable;
169 private _dataset;
170 private _changed;
171 private _isDisposed;
172}
173/**
174 * The namespace for the `Title` class statics.
175 */
176export declare namespace Title {
177 /**
178 * A type alias for a simple immutable string dataset.
179 */
180 type Dataset = {
181 readonly [key: string]: string;
182 };
183 /**
184 * An options object for initializing a title.
185 */
186 interface IOptions<T> {
187 /**
188 * The object which owns the title.
189 */
190 owner: T;
191 /**
192 * The label for the title.
193 */
194 label?: string;
195 /**
196 * The mnemonic index for the title.
197 */
198 mnemonic?: number;
199 /**
200 * The icon renderer for the title.
201 *
202 * DEPRECATED: if set to a string value, the .icon field will function as
203 * an alias for the .iconClass field, for backwards compatibility
204 */
205 icon?: VirtualElement.IRenderer | string;
206 /**
207 * The icon class name for the title.
208 */
209 iconClass?: string;
210 /**
211 * The icon label for the title.
212 */
213 iconLabel?: string;
214 /**
215 * @deprecated Use `icon` instead.
216 */
217 iconRenderer?: VirtualElement.IRenderer;
218 /**
219 * The caption for the title.
220 */
221 caption?: string;
222 /**
223 * The extra class name for the title.
224 */
225 className?: string;
226 /**
227 * The closable state for the title.
228 */
229 closable?: boolean;
230 /**
231 * The dataset for the title.
232 */
233 dataset?: Dataset;
234 }
235}
236//# sourceMappingURL=title.d.ts.map
\No newline at end of file