swing-ui 0.1.25 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/LICENSE +5 -4
  2. package/README.md +144 -7
  3. package/SwingUI.js +2611 -0
  4. package/classes/Arc.js +185 -0
  5. package/classes/Button.js +55 -0
  6. package/classes/CheckBox.js +33 -0
  7. package/classes/CheckBoxMenuItem.js +24 -0
  8. package/classes/ComboBox.js +329 -0
  9. package/classes/ComponentContainer.js +828 -0
  10. package/classes/ContextMenu.js +141 -0
  11. package/classes/DocumentEditor.js +168 -0
  12. package/classes/Ellipse.js +76 -0
  13. package/classes/InternalWindow.js +397 -0
  14. package/classes/InternalWindowContainer.js +93 -0
  15. package/classes/Label.js +52 -0
  16. package/classes/Line.js +105 -0
  17. package/classes/List.js +452 -0
  18. package/classes/MediaPlayer.js +504 -0
  19. package/classes/Menu.js +74 -0
  20. package/classes/MenuBar.js +56 -0
  21. package/classes/MenuItem.js +92 -0
  22. package/classes/Panel.js +50 -0
  23. package/classes/PasswordField.js +47 -0
  24. package/classes/Polygon.js +236 -0
  25. package/classes/Polyline.js +240 -0
  26. package/classes/ProgressBar.js +62 -0
  27. package/classes/RadioButton.js +110 -0
  28. package/classes/RadioButtonMenuItem.js +106 -0
  29. package/classes/Rectangle.js +199 -0
  30. package/classes/ScrollPane.js +53 -0
  31. package/classes/ScrollableComponent.js +141 -0
  32. package/classes/Separator.js +24 -0
  33. package/classes/Shape.js +584 -0
  34. package/classes/ShapeContainer.js +231 -0
  35. package/classes/Slider.js +172 -0
  36. package/classes/Spinner.js +172 -0
  37. package/classes/SplitView.js +82 -0
  38. package/classes/Stroke.js +115 -0
  39. package/classes/Table.js +982 -0
  40. package/classes/Tabs.js +228 -0
  41. package/classes/TextArea.js +125 -0
  42. package/classes/TextComponent.js +207 -0
  43. package/classes/TextField.js +128 -0
  44. package/classes/TextShape.js +123 -0
  45. package/classes/ToggleButton.js +147 -0
  46. package/classes/ToolBar.js +120 -0
  47. package/classes/TrayIcon.js +54 -0
  48. package/classes/Tree.js +569 -0
  49. package/classes/UIComponent.js +2154 -0
  50. package/classes/Window.js +609 -0
  51. package/enums.js +298 -0
  52. package/fonts.conf +32 -0
  53. package/functions.js +254 -0
  54. package/icon.png +0 -0
  55. package/index.js +109 -4
  56. package/jar/gui-11.jar +0 -0
  57. package/jar/lib/flatlaf.jar +0 -0
  58. package/jar/lib/jna.jar +0 -0
  59. package/package.json +58 -33
  60. package/typedefs.js +973 -0
  61. package/types/SwingUI.d.ts +727 -0
  62. package/types/classes/Arc.d.ts +111 -0
  63. package/types/classes/Button.d.ts +38 -0
  64. package/types/classes/CheckBox.d.ts +22 -0
  65. package/types/classes/CheckBoxMenuItem.d.ts +18 -0
  66. package/types/classes/ComboBox.d.ts +172 -0
  67. package/types/classes/ComponentContainer.d.ts +131 -0
  68. package/types/classes/ContextMenu.d.ts +74 -0
  69. package/types/classes/DocumentEditor.d.ts +95 -0
  70. package/types/classes/Ellipse.d.ts +34 -0
  71. package/types/classes/InternalWindow.d.ts +163 -0
  72. package/types/classes/InternalWindowContainer.d.ts +36 -0
  73. package/types/classes/Label.d.ts +33 -0
  74. package/types/classes/Line.d.ts +48 -0
  75. package/types/classes/List.d.ts +223 -0
  76. package/types/classes/MediaPlayer.d.ts +381 -0
  77. package/types/classes/Menu.d.ts +43 -0
  78. package/types/classes/MenuBar.d.ts +26 -0
  79. package/types/classes/MenuItem.d.ts +57 -0
  80. package/types/classes/Panel.d.ts +28 -0
  81. package/types/classes/PasswordField.d.ts +22 -0
  82. package/types/classes/Polygon.d.ts +93 -0
  83. package/types/classes/Polyline.d.ts +96 -0
  84. package/types/classes/ProgressBar.d.ts +36 -0
  85. package/types/classes/RadioButton.d.ts +70 -0
  86. package/types/classes/RadioButtonMenuItem.d.ts +71 -0
  87. package/types/classes/Rectangle.d.ts +82 -0
  88. package/types/classes/ScrollPane.d.ts +23 -0
  89. package/types/classes/ScrollableComponent.d.ts +81 -0
  90. package/types/classes/Separator.d.ts +14 -0
  91. package/types/classes/Shape.d.ts +223 -0
  92. package/types/classes/ShapeContainer.d.ts +92 -0
  93. package/types/classes/Slider.d.ts +107 -0
  94. package/types/classes/Spinner.d.ts +129 -0
  95. package/types/classes/SplitView.d.ts +47 -0
  96. package/types/classes/Stroke.d.ts +99 -0
  97. package/types/classes/Table.d.ts +652 -0
  98. package/types/classes/Tabs.d.ts +118 -0
  99. package/types/classes/TextArea.d.ts +45 -0
  100. package/types/classes/TextComponent.d.ts +136 -0
  101. package/types/classes/TextField.d.ts +94 -0
  102. package/types/classes/TextShape.d.ts +73 -0
  103. package/types/classes/ToggleButton.d.ts +84 -0
  104. package/types/classes/ToolBar.d.ts +82 -0
  105. package/types/classes/TrayIcon.d.ts +43 -0
  106. package/types/classes/Tree.d.ts +354 -0
  107. package/types/classes/UIComponent.d.ts +966 -0
  108. package/types/classes/Window.d.ts +334 -0
  109. package/types/enums.d.ts +437 -0
  110. package/types/functions.d.ts +109 -0
  111. package/types/index.d.ts +188 -0
  112. package/types/typedefs.d.ts +1626 -0
  113. package/ui-process-manager.js +317 -0
  114. package/video-devices-linux.sh +72 -0
  115. package/video-devices-mac.sh +33 -0
  116. package/CHANGES.md +0 -3
@@ -0,0 +1,966 @@
1
+ /**
2
+ * Base component class that other UI components extend. Not to be instantiated by itself.
3
+ * Most methods in this class are used by other classes that extend this class.
4
+ * @class
5
+ * @global
6
+ */
7
+ export class UIComponent {
8
+ static "__#1@#controls_id": number;
9
+ static "__#1@#_freed_ids": any[];
10
+ static "__#1@#_components": any[];
11
+ /**
12
+ * This is used to be notified when the component loses all references to it, to notify SwingUI to destroy the component for garbage collection
13
+ * @private
14
+ */
15
+ private static "__#1@#refRegistry";
16
+ /**
17
+ * Makes one class implements methods, setters, and getters of another class.
18
+ * @param toClass
19
+ * @param fromClass
20
+ * @throws {Error} When one or more parameters are `null`.
21
+ * @internal
22
+ * @ignore
23
+ */
24
+ static implementClass(toClass: any, fromClass: any): void;
25
+ /**
26
+ * Removes references to UI component with provided ID. Make sure to destroy all other references to the component to truly destroy it to free RAM.
27
+ *
28
+ * @internal
29
+ * @ignore
30
+ * @private
31
+ * @param {number} id - ID of a component to be destroyed
32
+ * @return {void} Doesn't return a value
33
+ */
34
+ private static destroy;
35
+ /**
36
+ * Get UI component by ID.
37
+ *
38
+ * @param {number} id - ID of requested component
39
+ * @return {any|undefined} Returns UI component or `undefined` if there is no valid component with specified ID.
40
+ */
41
+ static get(id: number): any | undefined;
42
+ /**
43
+ * Returns last visible non-PopUp Window or null if no Window component is not found.
44
+ *
45
+ * @internal
46
+ * @static
47
+ * @readonly
48
+ * @returns {Window|null} Returns Window component or null.
49
+ */
50
+ static readonly getVisibleWindow(): Window | null;
51
+ /**
52
+ * Not to be instantiated by itself. This call is extended dby other UI components.
53
+ *
54
+ * @param {string} type - Component type.
55
+ * @param {boolean} leaf - `true` if the UI component was not extended by a custom class.
56
+ * @param {...any} [data] - Additional component init data (used by some UI components).
57
+ * @internal
58
+ * @ignore
59
+ */
60
+ constructor(type: string, leaf: boolean, ...data?: any[]);
61
+ parent_id: null;
62
+ callback: {
63
+ onError: ((e: any) => any)[];
64
+ onRectangleUpdate: ((e: any) => void)[];
65
+ };
66
+ /**
67
+ * Locks methods from being overwritten or deleted.
68
+ * @param {Function} prototype_class
69
+ * @ignore
70
+ * @internal
71
+ */
72
+ finalize(..._classes: any[]): void;
73
+ /**
74
+ * @internal
75
+ * @ignore
76
+ */
77
+ isFinalized(methodName: any): boolean;
78
+ /**
79
+ * @internal
80
+ * @readonly
81
+ * @ignore
82
+ * @type {object}
83
+ */
84
+ readonly get prop(): object;
85
+ /**
86
+ * Returns a unique ID of the component. ID is reusable, so one component may have an ID of a previously destroyed component.
87
+ * @readonly
88
+ * @type {number}
89
+ */
90
+ readonly get id(): number;
91
+ /**
92
+ * Gets a parent container component. If this component wasn't added to any container component, then `null` is returned.
93
+ * @readonly
94
+ * @type {UIComponent|null}
95
+ */
96
+ readonly get parent(): UIComponent | null;
97
+ /**
98
+ * Gets a previous sibling component. If this component wasn't added to any container component, then `null` is returned.
99
+ * @readonly
100
+ * @type {UIComponent|null}
101
+ * @since 1.0.2
102
+ */
103
+ readonly get previousSibling(): UIComponent | null;
104
+ /**
105
+ * Gets a next sibling component. If this component wasn't added to any container component, then `null` is returned.
106
+ * @readonly
107
+ * @type {UIComponent|null}
108
+ * @since 1.0.2
109
+ */
110
+ readonly get nextSibling(): UIComponent | null;
111
+ /**
112
+ * Gets an array of sibling components.
113
+ * @readonly
114
+ * @type {UIComponent[]}
115
+ * @since 1.0.2
116
+ */
117
+ readonly get siblings(): UIComponent[];
118
+ /**
119
+ * Gets a Window component containing this component. Returns `null` if no Window contain this component.
120
+ * @readonly
121
+ * @type {Window|null}
122
+ */
123
+ readonly get window(): Window | null;
124
+ /**
125
+ * Returns `true` if the component is a container (other components can be added to it), otherwise returns false.
126
+ * @readonly
127
+ * @type {boolean}
128
+ */
129
+ readonly get isContainer(): boolean;
130
+ /**
131
+ * Gets a position of this component relative to primary screen. Returns `null` if the component wasn't added to a container that is visible, or of this component is a Window and it was never visible.
132
+ *
133
+ * @readonly
134
+ * @type {Point|null}
135
+ * @see Point
136
+ * @see ui#screens
137
+ */
138
+ readonly get screenPosition(): Point | null;
139
+ /**
140
+ * Adds this component to a parent container component. An optional index specifies the Z-order position at which to insert the component. It calls {@link ComponentContainer#addChild}.
141
+ *
142
+ * @param {ComponentContainer} parent - The container component to which this component will be added.
143
+ * @param {number|object} [data_or_index] - An parameter to pass some extra data (such as Tab Name to add Panel to Tabs), or index at which to insert the child.
144
+ * @returns {this} Returns an instance of this component for chaining.
145
+ * @see ComponentContainer#addChild
146
+ * @example <h2>Adding a component at specified index</h2>
147
+ * let checkbox = new CheckBox("Enabled checkbox").addTo(panel, 5).position(10, 15); // adds to panel and positions at (10,15) coordinates
148
+ *
149
+ * @example <h2>Adding a component at specified index</h2>
150
+ * let panel = new Panel().addTo(tabs, {text: "Registration", enabled: true, tooltip: "Create new account", icon: "images/user.png"});
151
+ */
152
+ addTo(parent: ComponentContainer, ...args: any[]): this;
153
+ /**
154
+ * Removes this component from its parent.
155
+ *
156
+ * @param {boolean} [recursive] - Boolean indicates if all descendents of this child should also be removed.
157
+ * @returns {this} Returns this component for method chaining
158
+ * @example
159
+ * child.remove(); // Removes child from it's parent container
160
+ * child.remove(true); // Removes child component from it's parent and all its descendants recursively
161
+ */
162
+ remove(...args: any[]): this;
163
+ /**
164
+ * Removes the component from its container, destroys event callbacks, unregisters the component, recycles the component ID. Also prepares this component to be garbage-collected in JavaScript and GUI to free RAM.
165
+ *
166
+ * @param {boolean} [recursive=false] - Set to true to also destroy all of its descendants recursively
167
+ * @returns {void}
168
+ */
169
+ destroy(...args: any[]): void;
170
+ destroyed: boolean | undefined;
171
+ /**
172
+ * This function may be called to make sure the component wasn't destroyed yet before performing another operation with the component. If it's already destroyed, Exception is thrown.
173
+ *
174
+ * @return {this} Returns this component.
175
+ */
176
+ verifyComponent(): this;
177
+ /**
178
+ * Checks if this component is inside specified ancestor component (at any level, not just direct child).
179
+ * @param {Object} ancestor - Ancestor component to test against
180
+ * @return {boolean}
181
+ * @see ComponentContainer#contains
182
+ */
183
+ insideOf(ancestor: Object): boolean;
184
+ /**
185
+ * Sets or gets component's visibility.
186
+ * NOTE: Window and InternalWindow components visibility is set to `false` by default. Use .visible(true) or .show() to make it visible.
187
+ *
188
+ * @param {boolean} [visible] - `true` to make it visible, `false` to hide it.
189
+ * @return {boolean|this} If called with an argument, then `this` component instance is returned, otherwise `boolean` value is returned.
190
+ */
191
+ visible(...args: any[]): boolean | this;
192
+ /**
193
+ * Convenience function that calls this.visible(true)
194
+ * @return {this}
195
+ */
196
+ show(): this;
197
+ /**
198
+ * Convenience function that calls this.visible(false)
199
+ * @return {this}
200
+ */
201
+ hide(): this;
202
+ /**
203
+ * Enables or disables the component.
204
+ *
205
+ * @param {boolean} [enabled] `true` to enable, `false` to disable the component. Omit to get current value.
206
+ * @return {boolean|this} If called with an argument, then `this` component instance is returned, otherwise `boolean` value is returned.
207
+ */
208
+ enabled(...args: any[]): boolean | this;
209
+ /**
210
+ * Sets or gets the size of the component.
211
+ *
212
+ * For {@link Window}, the returned and assigned size represents the entire window, including the title bar and borders. The actual area available for placing child components is smaller. Use {@link Window#innerSize} when you need to specify the content area size instead.
213
+ *
214
+ * @param {number|Size} [width_or_size] - Number as width, or `Size` formatted object.
215
+ * @param {number} [height] - Height of component. Required if first argument is `number`.
216
+ * @return {Size|this} Component size object if no arguments are set, otherwise returns `this` component.
217
+ * @see Size
218
+ * @example
219
+ * // Usage examples:
220
+ * button.size(100, 25);
221
+ * button.size({width: 100, height: 25});
222
+ * let size = button.size();
223
+ */
224
+ size(...args: any[]): Size | this;
225
+ /**
226
+ * Convenience method to set or get the width of component.
227
+ *
228
+ * @param {number} [width] - New width of the component.
229
+ * @return {number|UIComponent} Returns width if no argument is set, otherwise returns `this` component.
230
+ * @see UIComponent#size
231
+ */
232
+ width(...args: any[]): number | UIComponent;
233
+ /**
234
+ * Convenience method to set or get the height of component.
235
+ *
236
+ * @param {number} [height] - New height of the component.
237
+ * @return {number|UIComponent} Returns height if no argument is set, otherwise returns `this` component.
238
+ * @see UIComponent#size
239
+ */
240
+ height(...args: any[]): number | UIComponent;
241
+ /**
242
+ * Sets or gets text content of the component. Even though some components don't show text, you can still set text to it.
243
+ *
244
+ * @param {string} [text=undefined] - Can be plain text or HTML. HTML is only supported in some components (e.g. Label, Button, TextDocument, ...) and should be surrounded with HTML tags. Check example below.
245
+ * @param {TextAction} [action=TextAction.Set] - Specific action to perform with text. Replace, append, prepend, or insert. Applies only to some components. Do not use this argument for HTML content.
246
+ * @param {number} [insert_position=undefined] - Position where to insert text. Applies only if `action` argument is TextAction.Insert.
247
+ * @return {string|this} Returns text value if no argument is set, otherwise returns `this` component.
248
+ * @example
249
+ * const txt = textfield.text(); // gets text value
250
+ * textfield.text("New Text"); // sets new text value
251
+ * textfield.text("Appended Text", TextAction.Append); // Appends new text to the end of current text
252
+ * textfield.text("Inserted Text", TextAction.Insert); // Inserts at current caret position
253
+ * textfield.text("Inserted Text", TextAction.Insert, textfield.caretPosition() - 50); // Inserts at specified position
254
+ * textfield.text("New Text", TextAction.ReplaceSelection); // Replaces selected text or inserts at current cursor position if no text is selected (applies only to text editing components, like TextField, TextArea, ...).
255
+ */
256
+ text(...args: any[]): string | this;
257
+ /**
258
+ * @internal
259
+ * @ignore
260
+ * @private
261
+ * @param {string} property
262
+ * @param {any} value
263
+ * @return {any}
264
+ */
265
+ private property;
266
+ /**
267
+ * Registers, unregisters, and gets an event handler callback function for a specified events.
268
+ *
269
+ * - component.event(name, function, true); // unregisters one callback function (even if the same callback was registered multiple times)
270
+ * - component.event(name, function); // registers callback to be called when the event is emitted
271
+ * - component.event(name); // returns all callback functions for specified event
272
+ *
273
+ * @param {string} name - Name of event
274
+ * @param {function(Object):any|null} [callback=undefined] - Callback function. Pass `null` to unregister all handler functions.
275
+ * @param {boolean} [remove=false] - Set to true to unregister the callback function.
276
+ * @return {Function[]|this} If only the `name` argument is provided, returns an array of registered callback functions. Otherwise, returns `this` component.
277
+ * @internal
278
+ * @ignore
279
+ * @private
280
+ * @example
281
+ * const _callbacks_array = button.event("onAction"); // gets an array of previously registered handler functions
282
+ * button.event("onAction", _callbacks_array[0], true); // unregisters callback function, same as button.onAction(_callbacks_array[0], true);
283
+ * button.event("onAction", e => {console.debug(e);}); // registers new event handler function, same as button.onAction(e => {console.debug(e);});
284
+ */
285
+ private event;
286
+ /**
287
+ * Sets or gets the background color of the component. <br />
288
+ * <br />
289
+ * Accepts three formats: <br />
290
+ * - RGB hex (e.g. `"#FF0000"`) <br />
291
+ * - RGBA hex with alpha (e.g. `"#FF000050"`) <br />
292
+ * - The string `"transparent"` (equivalent to `"#00000000"`)
293
+ *
294
+ * @param {string} [value] - Background color in supported formats. Panel and Window components also accept gradient, image position and other info like in CSS. If omitted, returns the current value.
295
+ * @param {boolean} [update] - For Panel or Window only. Specifies whether to update specified background attributes instead of replacing all previously set background attributes.
296
+ * @returns {this|string} Returns `this` when setting value, or the current background color string when getting.
297
+ *
298
+ * @example
299
+ * component.background("#FF0000"); // Red background
300
+ * component.background("#00FF0080"); // Semi-transparent green
301
+ * component.background("transparent"); // Fully transparent
302
+ *
303
+ * // For Panel and Window components the background value can be a string that contains a mixture of background color,
304
+ * // image, linear-gradient, radial-gradient, like in CSS in web browsers. Some features may not be supported though.
305
+ * panel.background("#FF000055 url(images/bg.png) center no-repeat opacity=0.6 10px 15px linear-gradient(#DDDDDD55, #F8F8F855 10%) / auto);
306
+ * panel.background("url(data:image/png;base64,As8fE4fdt1r.....)", true); // supports base64 encoded image string
307
+ */
308
+ background(...args: any[]): this | string;
309
+ /**
310
+ * Sets or gets a foreground color of component (usually text color).
311
+ *
312
+ * @param {string} value Three formats are acceptable, regular RGB "#FF0000", with alpha RGBA "#FF000050", and "transparent" string, which is equivalent to "#00000000".
313
+ * @return {string|this} Returns color value if no argument is set, otherwise returns `this` component.
314
+ */
315
+ color(...args: any[]): string | this;
316
+ /**
317
+ * Sets or gets the position of the component relative to its parent component's top-let corner (or to the screen's top-left corner when component is Window).
318
+ *
319
+ * @param {number|Point} [x_or_position] - X position. Alternatively, provide a single `Point` object parameter to specify the position.
320
+ * @param {number} [y] - Y position.
321
+ * @param {number} [right] - Resizes the component so that its right edge is this many pixels from the right edge of the parent component or screen.
322
+ * @param {number} [bottom] - Resizes the component so that its bottom edge is this many pixels from the bottom edge of the parent component or screen.
323
+ * @return {Point|this} If no arguments are provided, returns a {x: number, y: number} position object. Otherwise, returns `this` component.
324
+ * @see Point
325
+ * @example
326
+ * panel.size(50, 100); // sets position
327
+ * panel.size({x: 50, y: 100}); // sets position
328
+ * panel.size(50, 100, 20); // sets position of left, top and right sides relative to sides of parent component.
329
+ * const window = new Window("New Window").size(50, 100, 20, 20); // sets position of each side relative to sides of screen.
330
+ */
331
+ position(...args: any[]): Point | this;
332
+ /**
333
+ * Convenience method to set or get left position of component.
334
+ *
335
+ * @param {number} [value]
336
+ * @return {number} Returns left position if no argument is set, otherwise returns `this` component.
337
+ * @see UIComponent#position
338
+ */
339
+ x(...args: any[]): number;
340
+ /**
341
+ * Convenience method to set or get top position of component.
342
+ *
343
+ * @param {number} [value]
344
+ * @return {number} Returns top position if no argument is set, otherwise returns `this` component.
345
+ * @see UIComponent#position
346
+ */
347
+ y(...args: any[]): number;
348
+ /**
349
+ * Convenience method to get or set the distance between the right edge of this component and the right edge of its parent.
350
+ *
351
+ * @param {number} [value] - Distance from the parent's right edge.
352
+ * @param {boolean} [reize] - `True` to resize the width to accommodate for specified `right` position instead of moving the object. `false` to move the component.
353
+ * @return {number|this} Returns the current right distance if no argument is provided; otherwise, returns `this` component.
354
+ */
355
+ right(...args: any[]): number | this;
356
+ /**
357
+ * Convenience method to get or set the distance between the bottom edge of this component and the bottom edge of its parent.
358
+ *
359
+ * @param {number} [value] - Distance from the parent's bottom edge to this component's bottom edge.
360
+ * @param {boolean} [reize] - `True` to resize the height to accommodate for specified `bottom` position instead of moving the object. `false` to move the component.
361
+ * @return {number|this} Returns the current bottom distance if no argument is provided; otherwise, returns `this` component.
362
+ */
363
+ bottom(...args: any[]): number | this;
364
+ /**
365
+ * Moves the component by adding the specified x and y values to its current position.
366
+ * The function shifts the element's position relative to current position.
367
+ *
368
+ * @param {number} [dx=0] - Delta x (can be positive or negative number)
369
+ * @param {number} [dy=0] - Delta y (can be positive or negative number)
370
+ * @return {this} Returns `this` component.
371
+ */
372
+ move(dx?: number, dy?: number): this;
373
+ /**
374
+ * When called without arguments and repainting is not disabled, it flushes message queue, revalidates and repaints the component.
375
+ * When the first argument is `true`, it enables repainting (enabled by default) and flushes the message queue.
376
+ * When the first argument is `false`, it disables repainting.
377
+ *
378
+ * @param {boolean} repaint_enabled - `false` to pause repainting this element. `true` to resume repainting
379
+ * @return {this} Returns `this` component.
380
+ */
381
+ update(...args: any[]): this;
382
+ /**
383
+ * Sets or gets context menu component for this UI component.
384
+ *
385
+ * @param {ContextMenu} [menu] - ContextMenu component to be assigned to this component. Set to `null` to remove ContextMenu.
386
+ * @return {ContextMenu|null|this} Returns the current context menu if no argument is provided; otherwise, returns `this` component.
387
+ */
388
+ contextMenu(...args: any[]): ContextMenu | null | this;
389
+ /**
390
+ * Sets or gets component `focusable` property whether component can retain focus.
391
+ *
392
+ * @param {boolean} [value]
393
+ * @return {boolean|this} If called with an argument, then `this` component instance is returned, otherwise `boolean` value is returned.
394
+ */
395
+ focusable(...args: any[]): boolean | this;
396
+ /**
397
+ * If value is passed, it makes component to get or loose focus, otherwise returns `boolean` indicating if it has focus or not.
398
+ *
399
+ * @param {boolean} [value] - `true` to get focus, `false` to attempt to shift focus to next component (if it has focus), usually by switching focus to next component.
400
+ * @returns {boolean|this} If called with an argument, then `this` component instance is returned, otherwise `boolean` value is returned.
401
+ */
402
+ focused(...args: any[]): boolean | this;
403
+ /**
404
+ * Sets or gets an index (z-order) of this component if it is added to a container, otherwise returns null.
405
+ * Larger value brings component forward, smaller to the back, like z-index in CSS.
406
+ *
407
+ * @param {number} [index]
408
+ * @returns {this|null|number} If called with an argument, then `this` component instance is returned, if component has no parent then `null` is returned, otherwise index is returned.
409
+ */
410
+ index(...args: any[]): this | null | number;
411
+ /**
412
+ * Sets or gets a layer at which this component resides in Panel container. This is separate from z-index.
413
+ * This applies only to components that are added to Panel or Window components.
414
+ * For example components in layer 2 are always on top of components in layer 1, regardless on their z-index.
415
+ * Larger value brings component forward, smaller to the back, like width z-index.
416
+ *
417
+ * @param {number} layer_index
418
+ * @returns {number|this} If called with an argument, then `this` component instance is returned, otherwise `number` value is returned.
419
+ */
420
+ layer(...args: any[]): number | this;
421
+ /**
422
+ * Gets or sets the font used for the component's text. See the example for font object format.
423
+ *
424
+ * @param {Font} [font] - Font formatted object.
425
+ * @param {boolean} [update] - If `true`, only the specified font properties will be updated instead of replacing the entire font.
426
+ * @return {this|Font}
427
+ * @see Font
428
+ * @example <h2>Full list of supported font properties:</h2>
429
+ * Font {
430
+ * name: string, // Font name or family name from {@link FontFamily} enum (e.g., "sans-serif")
431
+ * size: number, // Font size in pixels
432
+ * bold: boolean, // Whether the text is bold
433
+ * italic: boolean, // Whether the text is italic
434
+ * underlined: boolean, // Whether the text is underlined
435
+ * strikethrough: boolean, // Whether the text has a strikethrough
436
+ * direction: string, // Text direction: "ltr" or "rtl"
437
+ * kerning: boolean, // Enable or disable kerning
438
+ * ligatures: boolean, // Enable or disable font ligatures
439
+ * tracking: number // Letter spacing adjustment: -1, 0 (default), or 1
440
+ * };
441
+ * @example <h2>Usage examples:</h2>
442
+ * // Sets new font
443
+ * textarea.font({name: "sans-serif", size: 14, italic: true});
444
+ *
445
+ * // Set a new font; previously set italic style will be removed
446
+ * textarea.font({name: "sans-serif", size: 14});
447
+ *
448
+ * // Update only the font size, preserving other properties
449
+ * textarea.font({size: 20}, true);
450
+ *
451
+ * // get component's font
452
+ * const font = textarea.font();
453
+ * @see Font
454
+ * @see FontFamily
455
+ */
456
+ font(...args: any[]): this | Font;
457
+ /**
458
+ * Sets or gets an icon image of this component. You can set icon to any component even though not all components display the icon.
459
+ * When a component is added to Tabs, that component's icon is used as a Tab icon by default.
460
+ * Following image types are supported: ICO, PNG, JPG, JPEG, GIF, BMP, WBMP, TIFF/TIF, and base64 encoded images of such types.
461
+ * If FFMPEG with support of these image types is installed, the following image types are also supported from local relative or absolute paths: WEBP, HEIC, HEIF, AVIF.
462
+ *
463
+ * @param {string|null} image_path - Relative or absolute path to image file, base64 encoded image string, or NULL to remove existing icon.
464
+ * @returns {this|string|null} Returns `this` component if no arguments are set, a string of a previously set icon, or `null` if icon hasn't been set.
465
+ */
466
+ icon(...args: any[]): this | string | null;
467
+ /**
468
+ * Sets an cursor to the control. Passing NULL value removes custom cursor.
469
+ *
470
+ * @param {number|null|string} cursor - A value from Cursor enum, or a relative path to image file for custom cursor icon.
471
+ * @param {number} x - Used with custom image cursor to set pointer point on the image.
472
+ * @param {number} y - Used with custom image cursor to set pointer point on the image.
473
+ * @returns {this} Returns `this` component.
474
+ */
475
+ cursor(cursor: number | null | string, ...point: any[]): this;
476
+ /**
477
+ * Sets or gets the drag action for this component (e.g., `Copy`, `Move`), and enables or disables dragging accordingly.
478
+ * Passing `None` disables dragging; all other values enable it.
479
+ *
480
+ * @param {DragDropAction} [action] - One of enum values: DragDropAction.[None|Copy|Move|CopyOrMove|Link]. `None` is default.
481
+ * @returns {string|this} Returns `this` component if argument is provided, otherwise returns `string` value as one of the DragDropAction enum values.
482
+ */
483
+ dragAction(...args: any[]): string | this;
484
+ /**
485
+ * Sets or gets which type of drop action is accepted by the component (e.g., `Copy`, `Move`). Setting any action other
486
+ * than `None` enables dropping on the component. Action `None` disables dropping.
487
+ *
488
+ * @param {DragDropAction} [action] - One of enum values: DragDropAction.[None|Copy|Move|CopyOrMove|Link]. `None` is default.
489
+ * @returns {string|this} Returns `this` component if argument is provided, otherwise returns `string` value as one of the DragDropAction enum values.
490
+ */
491
+ dropAction(...args: any[]): string | this;
492
+ /**
493
+ * Sets or gets the types of data that should be transffered during drag operation. The data itself can be set using dragData(...) method.
494
+ * More than one type can be specified by setting multiple arguments or passing an array of values.
495
+ *
496
+ * @param {...DataType|DataType[]} data_type - DataType.[None|Text|Image|...]
497
+ * @returns {string[]|this}
498
+ * @example
499
+ * // Usage examples:
500
+ * label.dragDataType(DataType.Text, DataType.HTML); // setting by multiple arguments
501
+ * label.dragDataType([DataType.Text, DataType.HTML]); // setting by an array of values
502
+ * const _types = label.dragDataType(); // getting an array of data types
503
+ */
504
+ dragDataType(...args: any[]): string[] | this;
505
+ /**
506
+ * Sets custom data that should be passed when dragging this component instead of passing component's data, such as text or icon.
507
+ * Without setting this data a default component data will be dragged, such as text, list item, icon, what what ever applies to this component.
508
+ *
509
+ * @arg {string|string[]} data - String data or array of strings. For a list of files or URLs use array or separate them by new line character \n.
510
+ * @return {this} Returns `this` component.
511
+ */
512
+ dragData(...args: any[]): this;
513
+ /**
514
+ * Sets acceptable data types that may be dropped on this component during drag and drop operation.
515
+ *
516
+ * @param {...DataType|DataType[]} data_type - DataType.[None|All|Text|Image|...]. Use `All` to accept all data types.
517
+ * @return {string[]|this} Returns `this` component is argument is provided, otherwise returns `string[]` value.
518
+ * @example
519
+ * // Usage examples:
520
+ * label.dropDataType(DataType.All); // Setting to accept all data types
521
+ * label.dropDataType(.DataType.Text, DataType.HTML); // setting by multiple arguments
522
+ * label.dropDataType([DataType.Text, DataType.HTML]); // setting by an array of values
523
+ * const _types = label.dropDataType(); // getting an array of data types
524
+ */
525
+ dropDataType(...args: any[]): string[] | this;
526
+ /**
527
+ * Sets a drop mode for components: Table, List, Tree.
528
+ *
529
+ * @param {DropMode} [mode] - Enum value: DropMode.[On|Insert|OnOrInsert]. On - allows data to be dropped on list items. Insert - allows to drop data between list items.
530
+ * @returns {DropMode|this} Returns `this` component if an argument is provided; otherwise, returns the current drop mode as one of the DropMode enum values.
531
+ * @see DropMode
532
+ */
533
+ dropMode(...args: any[]): DropMode | this;
534
+ /**
535
+ * Sets, updates, or gets component border object. Border object should contain only properties that you want to set or update.
536
+ *
537
+ * @param {Border} [border] - Border object.
538
+ * @param {boolean} [update] - Set to `true` to only change specified border properties instead of replacing existing border.
539
+ * @return {this|Border|null} - If called without arguments a `Border` object is returned or `null` if the component's border wasn't set. Otherwise and instance of the component is returned.
540
+ * @see UIComponent#border
541
+ */
542
+ border(...args: any[]): this | Border | null;
543
+ /**
544
+ * Sets or gets an alignment of icon relative to text of a Label, Button, or items of a List.
545
+ *
546
+ * @param {string} [alignment] - A combination of one or more words: "top right bottom left center leading trailing"
547
+ * @return {this|string} Returns `this` component if an argument is provided, otherwise returns `string` value.
548
+ */
549
+ iconAlignment(...args: any[]): this | string;
550
+ /**
551
+ * Sets or gets an alignment of the component's content relative to the component, such as Label, Button, CheckBox, RadioBox, or items of a List.
552
+ *
553
+ * @param {string} [alignment] - A combination of one or more words: "top bottom right left center leading trailing"
554
+ * @return {this|string} Returns `this` component if an argument is provided, otherwise returns `string` value.
555
+ */
556
+ alignment(...args: any[]): this | string;
557
+ /**
558
+ * Sets or get a gap in pixel between icon and text of a List item, Button, Label, ComboBox, CheckBox, and RadioBox.
559
+ *
560
+ * @param {number} [gap] - The gap in pixels (must be an integer ≥ 0). If omitted, returns the current gap.
561
+ * @return {this|number} Returns `number` if argument is omitted, otherwise returns `this` component instance.
562
+ */
563
+ iconTextGap(...args: any[]): this | number;
564
+ /**
565
+ * Captures an image of the component and all subcomponents. Returns the image as a base 64 encoded string in format "data:image/FORMAT;base64,As8fE4fdt1r.....".
566
+ *
567
+ * @param {string} [format="png"] - Image format: `png`, `jpg`, `jpeg`, `bmp`, `gif`.
568
+ * @param {Object} [crop] - Object that holds position and size of the cropped area. Format: {x: number, y: number, width: number, height: number}.
569
+ * @return {string} Returns base 64 encoded string representation of the image. To get its binary data you must extract the base 64 string, then decode it from base 64 to bytes.
570
+ */
571
+ snapshot(format?: string, crop?: Object): string;
572
+ /**
573
+ * Sets or gets the anchor style of the component that indicates how to resize this component based on the resizing parent component.
574
+ * Anchor defines which sides (top, right, bottom, left) of the component stay attached to the parent's edge when parent gets resized.
575
+ * Set anchors after the component and its ancestors are added to a container to ensure expected behaviour.
576
+ *
577
+ * @param {string} [anchors] - Space-separated list of sides to anchor (e.g., `"top left"`). If omitted, returns the current anchor value.
578
+ * @returns {this|string} Returns `this` component when setting, or the current anchor `string` when getting value.
579
+ * @example
580
+ * const txt1 = new TextArea().anchor("top left right"); // Horizontally resizable
581
+ * const txt2 = new TextArea().anchor("top left bottom"); // Vertically resizable
582
+ */
583
+ anchor(...args: any[]): this | string;
584
+ /**
585
+ * Sets or gets tooltip text for the component. It's the text that pops up when cursor hovers the component.
586
+ *
587
+ * @param {string} text - Can be plain text or HTML. HTML string should be surrounded with HTML tags. See example.
588
+ * @return {string|this} Returns `this` component if argument is set, otherwise returns `string` value.
589
+ * @example
590
+ * button.tooltip("<html>This is line 1<br />This is line 2</html>"); // Setting HTML string with 2 lines of text
591
+ */
592
+ tooltip(...args: any[]): string | this;
593
+ /**
594
+ * Indicates the minimum size the component can be resized to.
595
+ *
596
+ * @param {number|Size} width_or_size - Minimum width, or a Size formatted object as a sole parameter.
597
+ * @param {number} height - Minimum height of the component.
598
+ * @returns {Size|this|null} If called without parameters, current minimum Size is returned or `null` if it wasn't previously set; otherwise returns `this` component instance for chaining.
599
+ * @see Size
600
+ */
601
+ minSize(...args: any[]): Size | this | null;
602
+ /**
603
+ * Indicates the maximum size the component can be resized to.
604
+ *
605
+ * @param {number|Size} width_or_size - Maximum width, or a Size formatted object as a sole parameter.
606
+ * @param {number} height - Maximum height of the component.
607
+ * @returns {Size|this|null} If called without parameters, current maximum Size is returned or `null` if it wasn't previously set; otherwise returns `this` component instance for chaining.
608
+ * @see Size
609
+ */
610
+ maxSize(...args: any[]): Size | this | null;
611
+ /**
612
+ * Positions the component in the center of it's parent component, owner Window (if Window has an owner Window), or screen (Window only).
613
+ * Applies only to components that have position() property (not like menu, menu item, tray icon, etc.)
614
+ *
615
+ * @arg {Object} [component] - If provided, `this` component will be positioned in the center of the provided component.
616
+ * @return {this} Returns `this` component.
617
+ */
618
+ center(component?: Object): this;
619
+ /**
620
+ * Enables/disables onKey() events to be emitted for focus traversal key (usually Tab key). By default onKey() event doesn't emit for such keys.
621
+ *
622
+ * @param {boolean} [enable] - `true` - enabled. `false` - disabled.
623
+ * @return {this|boolean} Returns `this` component if argumen is provided, otherwise returns `boolean` value.
624
+ */
625
+ emitFocusKeyEvents(...args: any[]): this | boolean;
626
+ /**
627
+ * Finds and returns first ancestor component of specified class. e.g. panel.getAncestor(Window) will return Window component that panel is in, or null if panel doesn't have a parent or ancestor with specified class.
628
+ *
629
+ * @param {Function} ancestor_class - UI Component class that comes with `swing-ui` module.
630
+ * @return {Object|null}
631
+ */
632
+ getAncestor(ancestor_class: Function): Object | null;
633
+ /**
634
+ * Emits a specified event with a custom event object for this component. This event will be sent to all event handlers registered with the specified event name.
635
+ *
636
+ * @param {string} event_name - Name of the event is same as name of an event handler registering function, such as `onAction` or `onChange`.
637
+ * @param {object} event - Custom event object
638
+ * @returns {this} Returns an instance of this component.
639
+ * @example
640
+ * button.emit("onAction", {type: "action", command: "Click Me"}); // emits a custom event without user clicking on the button
641
+ */
642
+ emit(event_name: string, event?: object): this;
643
+ /**
644
+ * Gets or sets the minimum size of the icon's largest side (in pixels).
645
+ * If the icon's largest side is smaller than the specified minimum, it will be scaled up proportionally.
646
+ * Applies to Button, Label, List, and ComboBox.
647
+ *
648
+ * @param {number|null} [min_size] - Sets the minimum size of a larger side of icon, or resets to no minimum when `null` is passed.
649
+ * @return {number|null|Object} If called without arguments, returns `number` value, otherwise returns `this` component instance.
650
+ */
651
+ minIconSize(...args: any[]): number | null | Object;
652
+ /**
653
+ * Gets or sets the maximum size of the icon's largest side (in pixels).
654
+ * If the icon's largest side is larger than the specified maximum, it will be scaled down proportionally.
655
+ * Applies to Button, Label, List, and ComboBox.
656
+ *
657
+ * @param {number|null} [max_size] - Sets the maximum size of a larger side of icon, or resets to no maximum when `null` is passed.
658
+ * @return {number|null|Object} If called without arguments, returns `number` value, otherwise returns `this` component instance.
659
+ */
660
+ maxIconSize(...args: any[]): number | null | Object;
661
+ /**
662
+ * Sets or gets an array of keyboard shortcuts handled by {@link UIComponent#onShortcut|onShortcut()} event handler.
663
+ *
664
+ * @param {object[]|string[]} [shortcuts] - An array of shortcut objects {shortcut:{string}, scope: {ShortcutScope}}, or an Array of String shortcuts (for strings a default {@link ShortcutScope} will be assigned).
665
+ * @returns {this|object[]} If called without arguments, then current shortcuts array is returned, otherwise an instance of `this` component is returned.
666
+ * @see ShortcutScope
667
+ * @example <h2>Setting shortcuts as strings</h2>
668
+ * window.shortcuts(["f1", "ctrl+s"]);
669
+ * @example <h2>Setting shortcuts as objects</h2>
670
+ * window.shortcuts([
671
+ * {
672
+ * key: "control+s",
673
+ * scope: ShortcutScope.Window, // optional
674
+ * action: "save_file" // optional
675
+ * }
676
+ * ]);
677
+ * @example <h2>Clearing all shortcuts</h2>
678
+ * window.shortcuts([]); // pass an empty array
679
+ * @example <h2>Retrieving current shortcuts</h2>
680
+ * const shortcuts = window.shortcuts(); // returns an Array of objects with `key` and `scope` properties.
681
+ */
682
+ shortcuts(...args: any[]): this | object[];
683
+ /**
684
+ * Overrides current error handler.
685
+ *
686
+ * @param {function(ErrorEvent): any} [callback=undefined] - The event handler function receiving an {@link ErrorEvent} object. Pass `null` to unregister all handler functions.
687
+ * @return {this}
688
+ * @see ErrorEvent
689
+ */
690
+ onError(callback?: (arg0: ErrorEvent) => any): this;
691
+ /**
692
+ * Registers or unregisters a handler function for an event when the component gets disposed, either by calling destroy() method or loosing all references to the component.
693
+ *
694
+ * @param {function(DisposeEvent): any} [callback=undefined] - The event handler function receiving {@link DisposeEvent} object. Pass `null` to unregister all handler functions.
695
+ * @param {boolean} [remove=false] - Set to `true` to remove this event handler
696
+ * @return {this}
697
+ * @see DisposeEvent
698
+ */
699
+ onDispose(callback?: (arg0: DisposeEvent) => any, remove?: boolean): this;
700
+ /**
701
+ * Gets, registers or unregisters a handler function for component's primary action event.
702
+ *
703
+ * @param {function(ActionEvent): any} [callback=undefined] - The event handler function that receives a {@link ActionEvent} object. Pass `null` to unregister all handler functions.
704
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
705
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
706
+ * @see ActionEvent
707
+ * @example
708
+ * // Example event object:
709
+ * const e = {
710
+ * target: object, // The component that triggered the event.
711
+ * command: string, // Button text or a specified command using .command("") method
712
+ * modifiers: number, // Keyboard modifiers (bitmask or flags).
713
+ * alt: boolean, // Indicates if ALT key was pressed.
714
+ * shift: boolean, // Indicates if SHIFT key was pressed.
715
+ * ctrl: boolean, // Indicates if CTRL key was pressed.
716
+ * type: string, // `action` or `index_change`. Present when applicable.
717
+ * x: number, // Mouse x position relative to component
718
+ * y: number, // Mouse y position relative to component
719
+ * screenX: number, // Mouse x position relative to default screen
720
+ * screenY: number, // Mouse y position relative to default screen
721
+ * interactive: boolean, // Indicates if the action was triggered by user's interaction (not programmatically). Present when applicable.
722
+ * selected: false // Present when applicable.
723
+ * };
724
+ */
725
+ onAction(...args: any[]): this | Function[];
726
+ /**
727
+ * Gets, registers or unregisters a mouse buttons event handler function.
728
+ *
729
+ * @param {function(MouseEvent): any} [callback=undefined] - The event handler function that receives a {@link MouseEvent} object. Pass `null` to unregister all handler functions.
730
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
731
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
732
+ * @see MouseEvent
733
+ * @example
734
+ * // Example event object:
735
+ * const e = {
736
+ * target: object, // The component that triggered the event.
737
+ * type: string, // `click`, `down`, `up`, `enter`, or `leave`.
738
+ * button: number, // Button number. One of MouseButton enum values.
739
+ * clicks: number, // Amount of time the click happened. Present when applicable.
740
+ * modifiers: number, // Keyboard modifiers (bitmask or flags).
741
+ * alt: boolean, // Indicates if ALT key was pressed.
742
+ * shift: boolean, // Indicates if SHIFT key was pressed.
743
+ * ctrl: boolean, // Indicates if CTRL key was pressed.
744
+ * x: number, // Present when applicable.
745
+ * y: number, // Present when applicable.
746
+ * screenX: number, // Present when applicable.
747
+ * screenY: number, // Present when applicable.
748
+ * };
749
+ */
750
+ onMouseEvents(...args: any[]): this | Function[];
751
+ /**
752
+ * Gets, registers or unregisters a mouse motion event handler function.
753
+ *
754
+ * @param {function(MouseMotionEvent): any} [callback=undefined] - The event handler function that receives a {@link MouseMotionEvent} object. Pass `null` to unregister all handler functions.
755
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
756
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
757
+ * @see MouseMotionEvent
758
+ * @example
759
+ * // Example event object:
760
+ * const e = {
761
+ * target: object, // The component that triggered the event.
762
+ * type: string, // `move` or `drag`.
763
+ * button: number, // Button number. One of MouseButton enum values. Present when applicable.
764
+ * modifiers: number, // Keyboard modifiers (bitmask or flags).
765
+ * x: number, // Mouse x position relative to component
766
+ * y: number, // Mouse y position relative to component
767
+ * screenX: number, // Mouse x position relative to default screen
768
+ * screenY: number, // Mouse y position relative to default screen
769
+ * };
770
+ */
771
+ onMouseMotion(...args: any[]): this | Function[];
772
+ /**
773
+ * Gets, registers or unregisters a mouse wheel event handler function.
774
+ *
775
+ * @param {function(MouseWheelEvent): any} [callback=undefined] - The event handler function that receives a {@link MouseWheelEvent} object. Pass `null` to unregister all handler functions.
776
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
777
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
778
+ * @see MouseWheelEvent
779
+ * @example
780
+ * // Example event object:
781
+ * const e = {
782
+ * target: object, // The component that triggered the event.
783
+ * type: string, // `wheel`.
784
+ * button: number, // Button number. One of MouseButton enum values. Present when applicable.
785
+ * scrollAmount: number, // Returns the number of units that should be scrolled per click of mouse wheel rotation.
786
+ * rotation: number, // Indicates the number of "clicks" the mouse wheel was rotated.
787
+ * // A partial rotation may occur if the mouse supports a high-resolution wheel.
788
+ * // In this case, the number is zero until a full "click" has been accumulated.
789
+ * modifiers: number, // Keyboard modifiers (bitmask or flags).
790
+ * alt: boolean, // Indicates if ALT key was pressed.
791
+ * shift: boolean, // Indicates if SHIFT key was pressed.
792
+ * ctrl: boolean, // Indicates if CTRL key was pressed.
793
+ * x: number, // Mouse x position relative to component
794
+ * y: number, // Mouse y position relative to component
795
+ * screenX: number, // Mouse x position relative to default screen
796
+ * screenY: number, // Mouse y position relative to default screen
797
+ * };
798
+ */
799
+ onMouseWheel(...args: any[]): this | Function[];
800
+ /**
801
+ * Gets, registers or unregisters a keyboard keys' event handler function.
802
+ *
803
+ * @param {function(KeyEvent): any} [callback=undefined] - The event handler function that receives a {@link KeyEvent} object. Pass `null` to unregister all handler functions.
804
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
805
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
806
+ * @see KeyEvent
807
+ * @example
808
+ * // Example event object:
809
+ * const e = {
810
+ * target: object, // The component that triggered the event.
811
+ * type: string, // `up`, `down`, `type`.
812
+ * keyCode: number // Numeric code associated with the key
813
+ * extendedKeyCode: number // The extended key code is a unique id assigned to a key on the keyboard just like keyCode. However, unlike keyCode, this value depends on the current keyboard layout.
814
+ * keyChar: string // Key character
815
+ * modifiers: number, // Keyboard modifiers (bitmask or flags).
816
+ * modifiersText: string // Modifiers representation as a string.
817
+ * alt: boolean, // Indicates if ALT key was pressed.
818
+ * shift: boolean, // Indicates if SHIFT key was pressed.
819
+ * ctrl: boolean, // Indicates if CTRL key was pressed.
820
+ * keyLocation: string // `standard`, `numpad`, `left`, `right`. Location of the key on keyboard. Only present when type is `up` or `down`.
821
+ * };
822
+ */
823
+ onKey(...args: any[]): this | Function[];
824
+ /**
825
+ * Gets, registers or unregisters a focus event handler function.
826
+ *
827
+ * @param {function(FocusEvent): any} [callback=undefined] - The event handler function that receives a {@link FocusEvent} object. Pass `null` to unregister all handler functions.
828
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
829
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
830
+ * @see FocusEvent
831
+ * @example
832
+ * // Example event object:
833
+ * const e = {
834
+ * target: object, // The component that triggered the event.
835
+ * type: string, // `focus`, `blur`.
836
+ * cause: string // `UNKNOWN`, `ACTIVATION`, `TRAVERSAL_FORWARD`, `TRAVERSAL_BACKWARD`.
837
+ * temporary: boolean, // Identifies the focus change event as temporary or permanent
838
+ * };
839
+ */
840
+ onFocusEvents(...args: any[]): this | Function[];
841
+ /**
842
+ * Gets, registers or unregisters an event handler function for events: resize, move, show, hide.
843
+ *
844
+ * @param {function(ComponentEvent): any} [callback=undefined] - The event handler function that receives a {@link ComponentEvent} object. Pass `null` to unregister all handler functions.
845
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
846
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
847
+ * @see ComponentEvent
848
+ * @example
849
+ * // Example event object:
850
+ * const e = {
851
+ * target: object, // The component that triggered the event.
852
+ * type: string, // `resize`, `move`, `show`, `hide`.
853
+ * interactive: boolean, // Indicates if the event was triggered by user's interaction (not programmatically). Present when e.type is `move` or `resize`.
854
+ * x: number, // New x position of component.
855
+ * y: number, // New y position of component.
856
+ * width: number, // New width of component. Present when e.type is `resize`.
857
+ * height: number, // New height of component. Present when e.type is `resize`.
858
+ * innerWidth: number, // New width of content area of the component. Present when e.type is `resize` and component is Window or InternalWindow.
859
+ * innerHeight: number, // New height of content area of the component. Present when e.type is `resize` and component is Window or InternalWindow.
860
+ *};
861
+ */
862
+ onComponentEvents(...args: any[]): this | Function[];
863
+ /**
864
+ * Gets, registers or unregisters an event handler that listens for changes to this component's properties.
865
+ *
866
+ * @param {function(PropertyChangeEvent): any} [callback=undefined] - The event handler function that receives a {@link PropertyChangeEvent} object. Pass `null` to unregister all handler functions.
867
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
868
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
869
+ * @see PropertyChangeEvent
870
+ * @example
871
+ * // Example event object:
872
+ * const e = {
873
+ * target: object, // The container component that triggered the event.
874
+ * type: string, // `change`.
875
+ * property: string, // The property that was changed
876
+ * oldValue: any, // Previous value of the changed property
877
+ * newValue: any // New value of the changed property
878
+ * };
879
+ */
880
+ onPropertyChange(...args: any[]): this | Function[];
881
+ /**
882
+ * Gets, registers or unregisters a handler function for drag related events. Call without parameters to get an array of already registered handler functions.
883
+ *
884
+ * @param {function(DragEvent): any} [callback=undefined] - The event handler function that receives a {@link DragEvent} object. Pass `null` to unregister all handler functions.
885
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
886
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
887
+ * @see DragEvent
888
+ *
889
+ * @example
890
+ * // Example event object:
891
+ * const e = {
892
+ * target: object, // The component that triggered the event.
893
+ * type: string, // `dragstart`, `dragend`, `cancel`.
894
+ * action: string // One of DragDropAction enum values. Present when applicable.
895
+ * x: number, // X position of a pointer relative to this component. Present when e.type is `dragstart` or `dragend`.
896
+ * y: number, // Y position of a pointer relative to this component. Present when e.type is `dragstart` or `dragend`.
897
+ * screenX: number, // X position of a pointer relative to default screen. Present when e.type is `dragstart` or `dragend`.
898
+ * screenY: number, // Y position of a pointer relative to default screen. Present when e.type is `dragstart` or `dragend`.
899
+ * button: number, // Indicates a pointing device button involved in dragging. Value of MouseButton enum.
900
+ * modifiers: number, // Keyboard modifiers (bitmask or flags). Present when e.type is `dragstart`.
901
+ * modifiersText: string, // Keyboard modifiers. Present when e.type is `dragstart`.
902
+ * alt: boolean, // Indicates if ALT key was pressed. Present when e.type is `dragstart`.
903
+ * shift: boolean, // Indicates if SHIFT key was pressed. Present when e.type is `dragstart`.
904
+ * ctrl: boolean, // Indicates if CTRL key was pressed. Present when e.type is `dragstart`.
905
+ * selected: number[] // Array of selected indexes of a List component whose items are being dragged. Present when List items are being dragged.
906
+ * };
907
+ */
908
+ onDragEvents(...args: any[]): this | Function[];
909
+ /**
910
+ * Gets, registers or unregisters a handler function for drop related events. Call without parameters to get an array of already registered handler functions.
911
+ *
912
+ * @param {function(DropEvent): any} [callback=undefined] - The event handler function that receives a {@link DropEvent} object. Pass `null` to unregister all handler functions.
913
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
914
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
915
+ * @see DropEvent
916
+ * @example <h2>{@link DropEvent} object format:</h2>
917
+ * const e = {
918
+ * target: object, // The component that triggered the event.
919
+ * type: string, // `dragenter`, `dragover`, `dragleave`, `drop`.
920
+ * action: string // One of the values of enum DragDropAction. Present when applicable.
921
+ * data: object // An object that contains the data that is being dropped. Present only when e.type is `drop` or `dragenter`.
922
+ * source: object, // A component that is being dragged or dropped onto this component.
923
+ * // Present only when a another UI component is dragged onto this component and `DataType.Component` is of the types set by dragDataType().
924
+ * x: number, // X position of a pointer relative to this component. Present when e.type is `dragstart` or `drop`.
925
+ * y: number, // Y position of a pointer relative to this component. Present when e.type is `dragstart` or `drop`.
926
+ * screenX: number, // X position of a pointer relative to default screen. Present when e.type is `dragstart` or `drop`.
927
+ * screenY: number, // Y position of a pointer relative to default screen. Present when e.type is `dragstart` or `drop`.
928
+ * selected: number[] // Array of selected indexes of a List component whose items are being dragged. Present when List items are being dragged.
929
+ * };
930
+ */
931
+ onDropEvents(...args: any[]): this | Function[];
932
+ /**
933
+ * Gets, registers or unregisters a handler function for component's text value change event. Applied to components where text can be changed by user, such as TextField, PasswordField, TextArea, DocumentEditor, ComboBox, Spinner, etc.
934
+ *
935
+ * @param {function(ChangeEvent): any} [callback=undefined] - The event handler function that receives a {@link ChangeEvent} object. Pass `null` to unregister all handler functions.
936
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
937
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
938
+ * @see ChangeEvent
939
+ */
940
+ onChange(...args: any[]): this | Function[];
941
+ /**
942
+ * Gets, registers or unregisters a handler function for component's event when ancestor is added, removed, or moved.
943
+ *
944
+ * @param {function(AncestorEvent): any} [callback=undefined] - The event handler function that receives a {@link AncestorEvent} object. Pass `null` to unregister all handler functions.
945
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
946
+ * @returns {this|function[]} An array of handler functions if no arguments are passed, otherwise `this` component for method chaining.
947
+ * @see AncestorEvent
948
+ * @example
949
+ * // Example event object:
950
+ * const e = {
951
+ * target: object, // The component that triggered the event.
952
+ * type: string, // `add`, `remove`, `move`.
953
+ * ancestor: object, // The ancestor component.
954
+ * };
955
+ */
956
+ onAncestorEvents(...args: any[]): this | Function[];
957
+ /**
958
+ * Gets, registers or unregisters a handler function for component's {@link ShortcutEvent} when a shortcut is invoked.
959
+ *
960
+ * @param {function(ShortcutEvent): any} [callback=undefined] - The event handler function that receives a {@link ShortcutEvent} object. Pass `null` to unregister all handler functions.
961
+ * @param {boolean} [remove=false] - Set to `true` to unregister the event handler.
962
+ * @returns {Function[]|UIComponent}
963
+ */
964
+ onShortcut(...args: any[]): Function[] | UIComponent;
965
+ #private;
966
+ }