UNPKG

5.54 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 get 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 get label(): string;
36 /**
37 * Set the label for the title.
38 */
39 set label(value: string);
40 /**
41 * Get the mnemonic index for the title.
42 *
43 * #### Notes
44 * The default value is `-1`.
45 */
46 get mnemonic(): number;
47 /**
48 * Set the mnemonic index for the title.
49 */
50 set mnemonic(value: number);
51 /**
52 * Get the icon renderer for the title.
53 *
54 * #### Notes
55 * The default value is undefined.
56 */
57 get icon(): VirtualElement.IRenderer | undefined;
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 set icon(value: VirtualElement.IRenderer | undefined);
65 /**
66 * Get the icon class name for the title.
67 *
68 * #### Notes
69 * The default value is an empty string.
70 */
71 get iconClass(): string;
72 /**
73 * Set the icon class name for the title.
74 *
75 * #### Notes
76 * Multiple class names can be separated with whitespace.
77 */
78 set iconClass(value: string);
79 /**
80 * Get the icon label for the title.
81 *
82 * #### Notes
83 * The default value is an empty string.
84 */
85 get iconLabel(): string;
86 /**
87 * Set the icon label for the title.
88 *
89 * #### Notes
90 * Multiple class names can be separated with whitespace.
91 */
92 set iconLabel(value: string);
93 /**
94 * Get the caption for the title.
95 *
96 * #### Notes
97 * The default value is an empty string.
98 */
99 get caption(): string;
100 /**
101 * Set the caption for the title.
102 */
103 set caption(value: string);
104 /**
105 * Get the extra class name for the title.
106 *
107 * #### Notes
108 * The default value is an empty string.
109 */
110 get className(): string;
111 /**
112 * Set the extra class name for the title.
113 *
114 * #### Notes
115 * Multiple class names can be separated with whitespace.
116 */
117 set className(value: string);
118 /**
119 * Get the closable state for the title.
120 *
121 * #### Notes
122 * The default value is `false`.
123 */
124 get closable(): boolean;
125 /**
126 * Set the closable state for the title.
127 *
128 * #### Notes
129 * This controls the presence of a close icon when applicable.
130 */
131 set closable(value: boolean);
132 /**
133 * Get the dataset for the title.
134 *
135 * #### Notes
136 * The default value is an empty dataset.
137 */
138 get dataset(): Title.Dataset;
139 /**
140 * Set the dataset for the title.
141 *
142 * #### Notes
143 * This controls the data attributes when applicable.
144 */
145 set dataset(value: Title.Dataset);
146 /**
147 * Test whether the title has been disposed.
148 */
149 get isDisposed(): boolean;
150 /**
151 * Dispose of the resources held by the title.
152 *
153 * #### Notes
154 * It is the responsibility of the owner to call the title disposal.
155 */
156 dispose(): void;
157 private _label;
158 private _caption;
159 private _mnemonic;
160 private _icon;
161 private _iconClass;
162 private _iconLabel;
163 private _className;
164 private _closable;
165 private _dataset;
166 private _changed;
167 private _isDisposed;
168}
169/**
170 * The namespace for the `Title` class statics.
171 */
172export declare namespace Title {
173 /**
174 * A type alias for a simple immutable string dataset.
175 */
176 type Dataset = {
177 readonly [key: string]: string;
178 };
179 /**
180 * An options object for initializing a title.
181 */
182 interface IOptions<T> {
183 /**
184 * The object which owns the title.
185 */
186 owner: T;
187 /**
188 * The label for the title.
189 */
190 label?: string;
191 /**
192 * The mnemonic index for the title.
193 */
194 mnemonic?: number;
195 /**
196 * The icon renderer for the title.
197 */
198 icon?: VirtualElement.IRenderer;
199 /**
200 * The icon class name for the title.
201 */
202 iconClass?: string;
203 /**
204 * The icon label for the title.
205 */
206 iconLabel?: string;
207 /**
208 * The caption for the title.
209 */
210 caption?: string;
211 /**
212 * The extra class name for the title.
213 */
214 className?: string;
215 /**
216 * The closable state for the title.
217 */
218 closable?: boolean;
219 /**
220 * The dataset for the title.
221 */
222 dataset?: Dataset;
223 }
224}