forked from docsforadobe/Types-for-Adobe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptUI.d.ts
More file actions
3007 lines (2562 loc) · 120 KB
/
Copy pathScriptUI.d.ts
File metadata and controls
3007 lines (2562 loc) · 120 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// <reference path="JavaScript.d.ts" />
declare enum _Alignment {
TOP = 1,
BOTTOM = 2,
LEFT = 3,
RIGHT = 4,
FILL = 5,
CENTER = 6,
}
declare enum _FontStyle {
REGULAR,
BOLD,
ITALIC,
BOLDITALIC,
}
declare const enum _BrushOrPenType {
SOLID_COLOR,
THEME_COLOR,
}
type _Bounds = Bounds
type _Dimension = Dimension
type _Margins = Margins | number
type _AlignmentProperty =
| "left"
| "right"
| "fill"
| "center"
| "top"
| "bottom"
| "fill"
| "center"
| ["left" | "right" | "fill" | "center", "top" | "bottom" | "fill" | "center"]
| [
_Alignment.LEFT | _Alignment.RIGHT | _Alignment.FILL | _Alignment.CENTER,
_Alignment.TOP | _Alignment.BOTTOM | _Alignment.FILL | _Alignment.CENTER,
]
type _AlignmentPropertyTitleLayout =
| ["left" | "right" | "center", "top" | "bottom" | "center"]
| [
_Alignment.LEFT | _Alignment.RIGHT | _Alignment.CENTER,
_Alignment.TOP | _Alignment.BOTTOM | _Alignment.CENTER,
]
type _Justify = "left" | "center" | "right"
type _Orientation = "row" | "column" | "stack"
type _Truncate = "middle" | "end" | "none"
/**
* A global class containing central information about ScriptUI. Not instantiable.
*/
declare class ScriptUI {
/**
* Collects the enumerated values that can be used in the alignment and alignChildren properties of controls and containers.
* Predefined alignment values are: TOP, BOTTOM, LEFT, RIGHT, FILL, CENTER
*/
static readonly Alignment: typeof _Alignment
/**
* Collects the enumerated values that can be used as the style argument to the ScriptUI.newFont() method.
* Predefined styles are REGULAR, BOLD, ITALIC, BOLDITALIC.
*/
static readonly FontStyle: typeof _FontStyle
/**
* The font constants defined by the host application.
*/
static readonly applicationFonts: object
/**
* An object whose properties are the names of compatibility modes supported by the host application.
* The presence of ScriptUI.compatibility.su1PanelCoordinates means that the application allows backward compatibility with the coordinate system of Panel elements in ScriptUI version 1.
*/
static readonly compatibility: object
/**
* A string containing the internal version number of the ScriptUI module.
*/
static readonly coreVersion: string
/**
* An object whose properties define attributes of the environment in which ScriptUI operates.
*/
static readonly environment: Environment
/**
* An object whose properties and methods provide access to objects used in the ScriptUI event system.
* It contains one function, createEvent(), which allows you to create event objects in order to simulate user-interaction event
*/
static readonly events: Events
/**
* A string containing the name of the UI component framework with which this version of ScriptUI is compatible.
*/
static readonly frameworkName: string
/**
* A string containing the version number of the ScriptUI component framework
*/
static readonly version: any
/**
* Finds and returns the resource for a given text string from the host application's resource data.
* If no string resource matches the given text, the text itself is returned.
* @param text The text to match.
*/
static getResourceText(text: string): string
/**
* Creates a new font object for use in text controls and titles.
* @param name The font name, or the font family name.
* @param style The font style; can be string, or one of the values of ScriptUI.FontStyle.
* @param size The font size in points.
*/
static newFont(name: string, style: string, size: number): ScriptUIFont
/**
* Loads a new image from resources or disk files into an image object.
* Creates a new global image object for use in controls that can display images, loading the associated images from the specified resources or image files.
* @param normal The resource name or the disk file path to the image used for the normal state.
* @param disabled The resource name, or the disk file path to the image used for the disabled state.
* @param pressed The resource name, or the file-system path to the image used for the pressed state.
* @param rollover The resource name, or the file-system path to the image used for the rollover state.
*/
static newImage(
normal: string,
disabled?: string,
pressed?: string,
rollover?: string,
): ScriptUIImage
}
/**
* The instance represents a top-level window or dialog box, which contains user-interface elements.
* The globally available Window object provides access to predefined and script-defined windows.
*/
declare class Window extends _Control {
/**
* Set to true to make this window active.
* A modal dialog that is visible is by definition the active dialog.
* An active palette is the front-most window.
* An active control is the one with focus—that is, the one that accepts keystrokes, or in the case of a Button, be selected when the user typesReturn or Enter.
*/
active: boolean
/**
* Tells the layout manager how unlike-sized children of this container should be aligned within a column or row.
* Order of creation determines which children are at the top of a column or the left of a row; the earlier a child is created, the closer it is to the top or left of its column or row. If defined, alignment for a child element overrides the alignChildren setting for the parent container. See alignment property for values.
*/
alignChildren: _AlignmentProperty
/**
* For windows of type dialog, the UI element to notify when the user presses a cancellation key combination.
* The cancellation key is the Esc key. By default, looks for a button whose name or text is "cancel" (case disregarded).
*/
cancelElement: object
/**
* A number of characters for which to reserve space when calculating the preferred size of the window.
*/
characters: number
/**
* The collection of UI elements that have been added to this container.
* An array indexed by number or by a string containing an element's name. The length property of this array is the number of child elements for container elements, and is zero for controls.
*/
readonly children: _Control[]
/**
* For windows of type dialog, the UI element to notify when the user presses a Enter key.
* By default, looks for a button whose name or text is "ok" (case disregarded).
*/
defaultElement: object
/**
* The bounds of the window frame in screen coordinates.
* The frame consists of the title bar and borders that enclose the content region of a window, depending on the windowing system.
*/
readonly frameBounds: _Bounds
/**
* The top left corner of the window frame in screen coordinates.
* The same as [frameBounds.x, frameBounds.y]. Set this value to move the window frame to the specified location on the screen. The frameBounds value changes accordingly.
*/
frameLocation: Point
/**
* The size and location of the window's frame in screen coordinates.
*/
readonly frameSize: _Dimension
/**
* Deprecated. Use ScriptUI.frameworkName instead.
*/
static readonly frameworkName: string
/**
* The graphics object that can be used to customize the window’s appearance, in response to the onDraw event.
*/
readonly graphics: ScriptUIGraphics
/**
* The default text justification style for child text elements.
* One of left, center, or right. Justification only works if this value is set on creation of the element.
*/
justify: _Justify
/**
* The layout manager for this container.
* The first time a container object is made visible, ScriptUI invokes this layout manager by calling its layout() function. Default is an instance of the LayoutManager class that is automatically created when the container element is created.
*/
layout: AutoLayoutManager
/**
* The number of pixels between the edges of a container and the outermost child elements.
* You can specify different margins for each edge of the container. The default value is based on the type of container, and is chosen to match the standard Adobe UI guidelines.
*/
margins: _Margins
/**
* True if the window is expanded.
*/
maximized: boolean
/**
* True if the window is minimized or iconified.
*/
minimized: boolean
/**
* The opacity of the window, in the range [0..1].
* A value of 1.0 (the default) makes the window completely opaque, a value of 0 makes it completely transparent. Intermediate values make it partially transparent to any degree.
*/
opacity: number
/**
* The layout orientation of children in a container.
* Interpreted by the layout manager for the container. The default LayoutManager Object accepts the (case-insensitive) values row, column, or stack.For window and panel, the default is column, and for group the default is row. The allowed values for the container’s alignChildren and its children’s alignment properties depend on the orientation.
*/
orientation: _Orientation
/**
* The keypress combination that invokes this element's onShortcutKey() callback.
*/
shortcutKey: string
/**
* The number of pixels separating one child element from its adjacent sibling element.
* Because each container holds only a single row or column of children, only a single spacing value is needed for a container. The default value is based on the type of container, and is chosen to match standard Adobe UI guidelines.
*/
spacing: number
/**
* The title, label, or displayed text, a localizable string.
* Does not apply to containers of type group.
*/
text: string
/**
* Deprecated. Use ScriptUI.version instead.
*/
static readonly version: any
/**
* Creates a new window.
* @param type The window type. One of: window: Creates a simple window that can be used as a main window for an application. (Not supported by Photoshop CS3.) palette: Creates a modeless dialog, also called a floating palette. (Not supported by Photoshop CS3.) dialog: Creates a modal dialog. This argument can also be a ScriptUI resource specification; in that case, all other arguments are ignored.
* @param title The window title, a localizable string.
* @param bounds The window's position and size.
* @param properties An object containing creation-only properties.
*/
constructor(
type: "dialog" | "palette" | "window",
title?: string,
bounds?: _Bounds,
properties?: _AddControlPropertiesWindow,
)
/**
* Creates and returns a new control or container object and adds it to the children of this window.
* @param type The type of the child element, as specified for the type property. Control types are listed in the JavaScript Tools Guide.
* @param bounds A bounds specification that describes the size and position of the new control or container, relative to its parent. If supplied, this value creates a new Bounds object which is assigned to the new object’s bounds property.
* @param text The text or label, a localizable string. Initial text to be displayed in the control as the title, label, or contents, depending on the control type. If supplied, this value is assigned to the new object’s text property.
* @param properties An object that contains one or more creation properties of the new child (properties used only when the element is created). The creation properties depend on the element type. See properties property of each control type.
*/
add: _AddControl
/**
* Displays a platform-standard dialog containing a short message and an OK button.
* @param message TThe string for the displayed message.
* @param title A string to appear as the title of the dialog, if the platform supports a title. Ignored in Mac OS, which does not support titles for alert dialogs. The default title string is "Script Alert".
* @param errorIcon When true, the platform-standard alert icon is replaced by the platform-standard error icon in the dialog. Ignored in Mac OS, which does not support icons for alert dialogs.
*/
static alert(message: string, title?: string, errorIcon?: boolean): void
/**
* Centers this window on screen or with respect to another window.
* @param window The relative window. If not specified, centers on the screen.
*/
center(window?: Window): void
/**
* Closes this window.
* . If an onClose() callback is defined for the window, calls that function before closing the window.
* @param return_ A number to be returned from the show() method that invoked this window as a modal dialog.
*/
close(return_?: any): void
/**
* Displays a platform-standard dialog containing a short message and two buttons labeled Yes and No.
* Returns true if the user clicked Yes, false if the user clicked No.
* @param message The string for the displayed message.
* @param noAsDefault When true, the No button is the default choice, selected when the user types Enter. Default is false, meaning that Yes is the default choice.
* @param title A string to appear as the title of the dialog, if the platform supports a title. Ignored in Mac OS, which does not support titles for alert dialogs. The default title string is "Script Alert".
*/
static confirm(message: string, noAsDefault: boolean, title?: string): boolean
/**
* Use this method to find an existing window.
* This includes windows defined by ScriptUI resource strings, windows already created by a script, and windows created by the application (if the application supports this case). This function is not supported by all applications. Returns a Window object found or generated from the resource, or null if no such window or resource exists.
* @param type The name of a predefined resource available to JavaScript in the current application; or the window type. If a title is specified, the type is used if more than one window with that title is found. Can be null or the empty string.
* @param title The window title.
*/
static find(type: string, title: string): Window
/**
* Sends a notification message to all listeners, simulating the specified user interaction event.
* @param eventName The event name; if omitted, the default event is sent. One of: onClose, onMove, onMoving, onResize, onResizing, onShow
*/
notify(eventName?: string): void
/**
* An event-handler callback function, called when the window acquires the keyboard focus.
* Called when the user gives the window the keyboard focus by clicking it or otherwise making it the active window.
*/
onActivate(): void
/**
* An event-handler callback function, called when the window is about to be closed.
* Called when a request is made to close the window, either by an explicit call to the close() function or by a user action (clicking the OS-specific close icon in the title bar). The function is called before the window actually closes; it can return false to cancel the close operation.
*/
onClose(): void | boolean
/**
* An event-handler callback function, called when the window loses the keyboard focus.
* Called when the user moves the keyboard focus from the previously active window to another window.
*/
onDeactivate(): void
/**
* An event-handler callback function, called when the window has been moved
*/
onMove(): void
/**
* An event-handler callback function, called when the window is being moved
* Called while a window in being moved, each time the position changes. A handler can monitor the move operation.
*/
onMoving(): void
/**
* An event-handler callback function, called after the window has been resized
*/
onResize(): void
/**
* An event-handler callback function, called while a window is being resized
* Called while a window is being resized, each time the height or width changes. A handler can monitor the resize operation.
*/
onResizing(): void
/**
* In Windows only, an event-handler callback function, called a shortcut-key sequence is typed that matches the shortcutKey value for this window.
*/
onShortcutKey(): void
/**
* An event-handler callback function, called just before the window is displayed
* Called when a request is made to open the window using the show() method, before the window is made visible, but after automatic layout is complete. A handler can modify the results of the automatic layout.
*/
onShow(): void
/**
* Displays a modal dialog that returns the user’s text input.
* Returns the value of the text edit field if the user clicked OK, null if the user clicked Cancel.
* @param prompt The string for the displayed message.
* @param default_ The initial value to be displayed in the text edit field.
* @param title A string to appear as the title of the dialog. In Windows, this appears in the window’s frame; in Mac OS it appears above the message. The default title string is "Script Prompt".
*/
static prompt(prompt: string, default_?: string, title?: string): string | null
/**
* Removes the specified child control from this window’s children array.
* No error results if the child does not exist.
* @param what The child control to remove, specified by 0-based index, text property value, or as a control object.
*/
remove(what: any): void
}
/**
* Controls the automatic layout behavior for a window or container.
* The subclass AutoLayoutManager implements the default automatic layout behavior.
*/
declare class AutoLayoutManager {
/**
* Invokes the automatic layout behavior for the managed container.
* Adjusts sizes and positions of the child elements of this window or container according to the placement and alignment property values in the parent and children.
* Invoked automatically the first time the window is displayed. Thereafter, the script must invoke it explicitly to change the layout in case of changes in the size or position of the parent or children.
*
* @param recalculate Optional. When true, forces the layout manager to recalculate the container size for this and any child containers. Default is false.
*/
layout(recalculate?: boolean): void
/**
* Performs a layout after a Window is resized, based on the new size.
* Resizes the child elements of the managed container with a given alignment type, after the window has been resized by the user.
*/
resize(): void
}
/**
* A drawing pen that defines a color and line width used to stroke paths.
* Create with ScriptUIGraphics.newPen(). Use as a value of foregroundColor properties, and pass as an argument to drawString() and strokePath() methods.
*/
declare class ScriptUIPen {
/**
* The pen color.
* The paint color to use when the type is SOLID_COLOR. An array in the form [R, B, G, A] specifying the red, green, blue values of the color and the opacity (alpha channel) value as numbers in the range [0.0..1.0]. An opacity of 0 is fully transparent, and an opacity of 1 is fully opaque.
*/
readonly color: number[]
/**
* The pixel width of the drawing line.
*/
lineWidth: number
/**
* The theme name.
* The name of a color theme to use for drawing when the type is THEME_COLOR. Theme colors are defined by the host application.
*/
readonly theme: string
/**
* The pen type, solid or theme.
* One of these constants: ScriptUIGraphics.PenType.SOLID_COLOR or ScriptUIGraphics.PenType.THEME_COLOR
*/
readonly type: typeof ScriptUIGraphics.PenType
}
/**
* A painting brush that encapsulates a color or pattern used to fill paths.
* Create with ScriptUIGraphics.newBrush(). Use as a value of backgroundColor properties, and pass as an argument to the fillPath() method.
*/
declare class ScriptUIBrush {
/**
* The brush color.
* The paint color to use when the type is SOLID_COLOR. An array in the form [R, B, G, A] specifying the red, green, blue values of the color and the opacity (alpha channel) value as numbers in the range [0.0..1.0]. An opacity of 0 is fully transparent, and an opacity of 1 is fully opaque.
*/
readonly color: number[]
/**
* The theme name.
* The name of a color theme to use for drawing when the type is THEME_COLOR. Theme colors are defined by the host application.
*/
readonly theme: string
/**
* The brush type, solid or theme.
* One of these constants: ScriptUIGraphics.BrushType.SOLID_COLOR or ScriptUIGraphics.BrushType.THEME_COLOR
*/
readonly type: typeof ScriptUIGraphics.BrushType
}
/**
* A helper object that encapsulates a drawing path for a figure to be drawn into a window or control.
* Create with the newPath(), moveto(), lineto(), rectPath(), and ellipsePath() methods.Used as value of currentPath, where it is acted upon by methods such as closePath().Pass as optional argument to fillPath() and strokePath(), which otherwise act upon the current path.
*/
declare class ScriptUIPath {}
/**
* An object used to draw custom graphics, found in the graphics property of window, container, and control objects.
* Allows a script to customize aspects of the element’s appearance, such as the color and font. Use an onDraw callback function to set these properties or call the functions.All measurements are in pixels.
*/
declare class ScriptUIGraphics {
/**
* Contains the enumerated constants for the type argument of newBrush().
* Type constants are: SOLID_COLOR, THEME_COLOR.
*/
static readonly BrushType: typeof _BrushOrPenType
/**
* Contains the enumerated constants for the type argument of newPen().
* Type constants are: SOLID_COLOR, THEME_COLOR.
*/
static readonly PenType: typeof _BrushOrPenType
/**
* The background color for containers; for non-containers, the parent background color.
* The paint color and style is defined in this brush object.This property is only supported for controls like dropdownlist, edittext, and listbox.
*/
backgroundColor: ScriptUIBrush
/**
* The current drawing path, encapsulated in a path object.
*/
readonly currentPath: ScriptUIPath
/**
* The current position in the current drawing path.
*/
readonly currentPoint: Point
/**
* The background color for containers when disabled or inactive; for non-containers, the parent background color.
* The paint color and style is defined in this brush object.This property is only supported for controls like dropdownlist, edittext, and listbox.
*/
disabledBackgroundColor: ScriptUIBrush
/**
* The text color when the element is disabled or inactive.
* The paint color and style is defined in this pen object.
*/
disabledForegroundColor: ScriptUIPen
/**
* The default font to use for displaying text.
*/
font: ScriptUIFont
/**
* The text color.
* The paint color and style is defined in this pen object.
*/
foregroundColor: ScriptUIPen
/**
* Closes the current path.
* Defines a line from the current position (currentPoint) to the start point of the current path (the value of currentPath).
*/
closePath(): void
/**
* Draws a focus ring within a region of this element.
* @param left The left coordinate of the region. Value is relative to the origin of this element.
* @param top The top coordinate of the region. Value is relative to the origin of this element.
* @param width The width of the region in pixels.
* @param height The height of the region in pixels.
*/
drawFocusRing(left: number, top: number, width: number, height: number): void
/**
* Draws an image within a given region of the element.
* Uses the version of the image that is appropriate to the element's current state.
* @param image The image to draw. This object contains different versions of an image appropriate to various element states, such as a dimmed version for the disabled state.
* @param left The left coordinate of the region, relative to the origin of this element.
* @param top The top coordinate of the region, relative to the origin of this element.
* @param width The width in pixels. If provided, the image is stretched or shrunk to fit. If omitted, uses the original image width.
* @param height The height in pixels. If provided, the image is stretched or shrunk to fit. If omitted, uses the original image height.
*/
drawImage(image: ScriptUIImage, left: number, top: number, width?: number, height?: number): void
/**
* Draw the platform-specific control associated with this element.
*/
drawOSControl(): void
/**
* Draw a string of text starting at a given point in this element, using a given drawing pen and font.
* @param text The text string.
* @param pen The drawing pen to use.
* @param x The left coordinate, relative to the origin of this element.
* @param y The top coordinate, relative to the origin of this element.
* @param font The font to use. Default is the font value in this object.
*/
drawString(text: string, pen: ScriptUIPen, x: number, y: number, font?: ScriptUIFont): void
/**
* Defines an elliptical path within a given rectangular area in the currentPath object, which can be filled using fillPath() or stroked using strokePath().
* Returns a Point object for the upper left corner of the area, which is the new currentPoint.
* @param left The left coordinate of the region, relative to the origin of this element.
* @param top The top coordinate of the region, relative to the origin of this element.
* @param width The width of the region in pixels.
* @param height The height of the region in pixels.
*/
ellipsePath(left: number, top: number, width: number, height: number): Point
/**
* Fills a path using a given painting brush.
* @param brush The brush object that defines the fill color.
* @param path The path object. Default is the currentPath.
*/
fillPath(brush: ScriptUIBrush, path?: ScriptUIPath): void
/**
* Adds a path segment to the currentPath.
* The line is defined from the currentPoint to the specified destination point. Returns the Point object for the destination point, which becomes the new value of currentPoint.
* @param x The X coordinate for the destination point, relative to the origin of this element.
* @param y The Y coordinate for the destination point, relative to the origin of this element.
*/
lineTo(x: number, y: number): Point
/**
* Calculates the size needed to display a string using the given font.
* Returns a Dimension object that contains the height and width of the string in pixels.
* @param text The text string to measure.
* @param font The font to use. Default is the font value in this object.
* @param boundingWidth The bounding width.
*/
measureString(text: string, font?: ScriptUIFont, boundingWidth?: number): _Dimension
/**
* Adds a given point to the currentPath, and makes it the current drawing position.
* Returns the Point object which is the new value of currentPoint.
* @param x The X coordinate for the new point, relative to the origin of this element.
* @param y The Y coordinate for the new point, relative to the origin of this element.
*/
moveTo(x: number, y: number): Point
/**
* Creates a new painting brush object.
* @param type The brush type, solid or theme. One of the constants ScriptUIGraphics.BrushType.SOLID_COLOR or ScriptUIGraphics.BrushType.THEME_COLOR.
* @param color The brush color. If type is SOLID_COLOR, the color expressed as an array of three or four values, in the form [R, B, G, A] specifying the red, green, and blue values of the color and, optionally, the opacity (alpha channel). All values are numbers in the range [0.0..1.0]. An opacity of 0 is fully transparent, and an opacity of 1 is fully opaque. If the type is THEME_COLOR, the name string of the theme. Theme colors are defined by the host application.
*/
newBrush(type: typeof ScriptUIGraphics.BrushType, color: number[]): ScriptUIBrush
/**
* Creates a new, empty path object.
* Replaces any existing path in currentPath.
*/
newPath(): ScriptUIPath
/**
* Creates a new drawing pen object.
* @param type The pen type, solid or theme. One of the constants ScriptUIGraphics.PenType.SOLID_COLOR or ScriptUIGraphics.PenType.THEME_COLOR.
* @param color The pen color. If type is SOLID_COLOR, the color expressed as an array of three or four values, in the form [R, B, G, A] specifying the red, green, and blue values of the color and, optionally, the opacity (alpha channel). All values are numbers in the range [0.0..1.0]. An opacity of 0 is fully transparent, and an opacity of 1 is fully opaque. If the type is THEME_COLOR, the name string of the theme. Theme colors are defined by the host application.
* @param width The width of the pen line in pixels. The line is centered around the current point. For example, if the value is 2, drawing a line from (0, 10) to (5, 10) paints the two rows of pixels directly above and below y-position 10.
*/
newPen(type: typeof ScriptUIGraphics.PenType, color: number[], width: number): ScriptUIPen
/**
* Defines a rectangular path in the currentPath object.
* The rectangle can be filled using fillPath() or stroked using strokePath().Returns the Point object for the upper left corner of the rectangle, which becomes the new value of currentPoint.
* @param left The left coordinate relative to the origin of this element.
* @param top The top coordinate relative to the origin of this element.
* @param width The width in pixels.
* @param height The height in pixels.
*/
rectPath(left: number, top: number, width: number, height: number): Point
/**
* Strokes the path segments of a path with a given drawing pen.
* @param pen The drawing pen that defines the color and line width.
* @param path The path object. Default is the currentPath.
*/
strokePath(pen: ScriptUIPen, path?: ScriptUIPath): void
}
/**
* Describes an input state at the time of the triggering ScriptUIGraphics.onDraw() event.
* Contains properties that report whether the current control has the input focus, and the particular mouse button and keypress state. Passed in as argument to ScriptUIGraphics.onDraw().
*/
declare class DrawState {
/**
* True if the Alt key is being pressed (in Windows only).
*/
readonly altKeyPressed: boolean
/**
* True if the Caps Lock key is being pressed.
*/
readonly capsLockKeyPressed: boolean
/**
* True if the Command key is being pressed (in Mac OS only).
*/
readonly cmdKeyPressed: boolean
/**
* True if the Ctrl key is being pressed.
*/
readonly ctrlKeyPressed: boolean
/**
* True if the element has the input focus.
*/
readonly hasFocus: boolean
/**
* True if the left mouse button is being pressed.
*/
readonly leftButtonPressed: boolean
/**
* True if the middle mouse button is being pressed.
*/
readonly middleButtonPressed: boolean
/**
* True if the cursor is hovering over this element.
*/
readonly mouseOver: boolean
/**
* True if the Num Lock key is being pressed.
*/
readonly numLockKeyPressed: boolean
/**
* True if the Option key is being pressed (in Mac OS only).
*/
readonly optKeyPressed: boolean
/**
* True if the right mouse button is being pressed.
*/
readonly rightButtonPressed: boolean
/**
* True if the Shift key is being pressed.
*/
readonly shiftKeyPressed: boolean
}
/**
* Encapsulates the qualities of a font used to draw text into a control.
* Create with the newFont() method.Used as a value of font. Passed as an argument to drawString() and measureString().
*/
declare class ScriptUIFont {
/**
* The font family name.
*/
readonly family: string
/**
* The complete font name, consisting of the family and style, if specified.
*/
readonly name: string
/**
* The font point size.
*/
readonly size: number
/**
* The font style. One of the constants in ScriptUI.FontStyle.
*/
readonly style: typeof ScriptUI.FontStyle
/**
* The name of a substitution font, a fallback font to substitute for this font if the requested font family or style is not available.
*/
readonly substitute: string
}
/**
* Encapsulates a set of images that can be drawn into a control.
* Different images can reflect the current state, such as a dimmed version for a disabled control. Create with the newImage() method. Passed as an argument to drawImage().
*/
declare class ScriptUIImage {
/**
* The image format. One of: resource, JPEG, GIF, TIFF, PNG, or PICT (Macintosh).
*/
readonly format: string
/**
* The image name. Either the file name, or the resource name.
*/
readonly name: string
/**
* The full path to the file that contains the image.
*/
readonly pathname: string
/**
* The image size in pixels.
*/
readonly size: _Dimension
}
/**
* A text label that the user cannot change.
*/
declare class StaticText extends _Control {
/**
* Always false. This element cannot have input focus.
* An active control is the one with keyboard focus—that is, the one that accepts keystrokes, or in the case of a Button, is selected when the user types Return or Enter in Windows, or the space bar in Mac OS.
*/
active: boolean
/**
* A number of characters for which to reserve space when calculating the preferred size of the element.
*/
characters: number
/**
* An array of child elements.
*/
readonly children: object[]
/**
* The graphics object that can be used to customize the element's appearance, in response to the onDraw() event.
*/
readonly graphics: ScriptUIGraphics
/**
* The text justification style.
* One of left, center, or right. Justification only works if this value is set on creation of the element.
*/
justify: _Justify
/**
* The key sequence that invokes the onShortcutKey() callback for this element (in Windows only).
*/
shortcutKey: string
/**
* The text to display, a localizable string.
*/
text: string
/**
* Sends a notification message, simulating the specified user interaction event.
* @param eventName The name of the control event handler to call. One of: onClick, onChange, onChanging. By default, simulates the onChange event for an edittext control, an onClick event for controls that support that event.
*/
notify(eventName?: string): void
/**
* An event-handler callback function, called when the window is about to be drawn.
* Allows the script to modify or control the appearance, using the control’s associated ScriptUIGraphics object. Handler takes one argument, a DrawState object.
*/
onDraw(): void
/**
* An event-handler callback function, called when the element's shortcutKey sequence is typed in the active window.
* In Windows only.
*/
onShortcutKey(): void
}
/**
* A pushbutton element containing a mouse-sensitive text string.
* Calls the onClick() callback if the control is clicked or if its notify() method is called.
*/
declare class Button extends _Control {
/**
* True if this element is active.
* An active control is the one with keyboard focus—that is, the one that accepts keystrokes, or in the case of a Button, is selected when the user types Return or Enter in Windows, or the space bar in Mac OS.
*/
active: boolean
/**
* A number of characters for which to reserve space when calculating the preferred size of the element.
*/
characters: number
/**
* An array of child elements.
*/
readonly children: object[]
/**
* The graphics object that can be used to customize the element's appearance, in response to the onDraw() event.
*/
readonly graphics: ScriptUIGraphics
/**
* The text justification style.
* One of left, center, or right. Justification only works if this value is set on creation of the element.
*/
justify: _Justify
/**
* The key sequence that invokes the onShortcutKey() callback for this element (in Windows only).
*/
shortcutKey: string
/**
* The text to display, a localizable string.
*/
text: string
/**
* Sends a notification message, simulating the specified user interaction event.
* @param eventName The name of the control event handler to call. One of: onClick, onChange, onChanging. By default, simulates the onChange event for an edittext control, an onClick event for controls that support that event.
*/
notify(eventName?: string): void
/**
* An event-handler callback function, called when the element acquires the keyboard focus.
* Called when the user gives the control the keyboard focus by clicking it or tabbing into it.
*/
onActivate(): void
/**
* An event-handler callback function, called when the element has been clicked
*/
onClick(): void
/**
* An event-handler callback function, called when the element loses the keyboard focus.
* Called when the user moves the keyboard focus from the previously active control to another control.
*/
onDeactivate(): void
/**
* An event-handler callback function, called when the window is about to be drawn.
* Allows the script to modify or control the appearance, using the control’s associated ScriptUIGraphics object. Handler takes one argument, a DrawState object.
*/
onDraw(): void
/**
* An event-handler callback function, called when the element's shortcutKey sequence is typed in the active window.
* In Windows only.
*/
onShortcutKey(): void
}
/**
* A mouse-sensitive pushbutton that displays an image instead of text.
* Calls the onClick() callback if the control is clicked or if its notify() method is called.
*/
declare class IconButton extends _Control {
/**
* True if this element is active.
* An active control is the one with keyboard focus—that is, the one that accepts keystrokes, or in the case of a Button, is selected when the user types Return or Enter in Windows, or the space bar in Mac OS.
*/
active: boolean
/**
* An array of child elements.
*/
readonly children: object[]
/**
* The graphics object that can be used to customize the element's appearance, in response to the onDraw() event.
*/
readonly graphics: ScriptUIGraphics
/**
* The image object that defines the image to be drawn.
*/
image: ScriptUIImage
/**
* The image object that defines the image to be drawn.
* Same as IconButton.image.
*/
icon: ScriptUIImage
/**
* The key sequence that invokes the onShortcutKey() callback for this element (in Windows only).
*/
shortcutKey: string
title: string
titleLayout: _TitleLayout
/**
* Sends a notification message, simulating the specified user interaction event.
* @param eventName The name of the control event handler to call. One of: onClick, onChange, onChanging. By default, simulates the onChange event for an edittext control, an onClick event for controls that support that event.
*/
notify(eventName?: string): void
/**
* An event-handler callback function, called when the element acquires the keyboard focus.
* Called when the user gives the control the keyboard focus by clicking it or tabbing into it.
*/
onActivate(): void
/**
* An event-handler callback function, called when the element has been clicked.
*/
onClick(): void
/**
* An event-handler callback function, called when the element loses the keyboard focus.
* Called when the user moves the keyboard focus from the previously active control to another control.
*/
onDeactivate(): void
/**
* An event-handler callback function, called when the window is about to be drawn.
* Allows the script to modify or control the appearance, using the control’s associated ScriptUIGraphics object. Handler takes one argument, a DrawState object.
*/
onDraw(): void
/**
* An event-handler callback function, called when the element's shortcutKey sequence is typed in the active window.
* In Windows only.
*/
onShortcutKey(): void
}