Skip to content

Commit 96cad4d

Browse files
committed
refactor _AddControl interface
1 parent ea57b68 commit 96cad4d

File tree

1 file changed

+36
-81
lines changed

1 file changed

+36
-81
lines changed

shared/ScriptUI.d.ts

Lines changed: 36 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,20 +2598,10 @@ declare class _Control {
25982598
}
25992599

26002600
/**
2601-
* Creation properties of a Button.
2602-
* But the third argument to the add() method that creates it can be the initial text value.
2603-
* @param name A unique name for the control. Special name "ok" makes the button primary for parent dialog, and the special name "cancel" makes the button default cancel button for parent dialog.
2604-
*/
2605-
interface _AddControlPropertiesButton {
2606-
name: string
2607-
}
2608-
2609-
/**
2610-
* Creation properties of a CheckBox.
2611-
* The third argument to the add() method that creates it is the text to be displayed.
2601+
* Creation properties.
26122602
* @param name A unique name for the control.
26132603
*/
2614-
interface _AddControlPropertiesCheckbox {
2604+
interface _AddControlProperties {
26152605
name: string
26162606
}
26172607

@@ -2647,22 +2637,6 @@ interface _AddControlPropertiesEditText {
26472637
wantReturn: boolean
26482638
}
26492639

2650-
/**
2651-
* Creation properties of a FlashPlayer.
2652-
* @param name A unique name for the control.
2653-
*/
2654-
interface _AddControlPropertiesFlashPlayer {
2655-
name: string
2656-
}
2657-
2658-
/**
2659-
* Creation properties of a Group.
2660-
* @param name A unique name for the control.
2661-
*/
2662-
interface _AddControlPropertiesGroup {
2663-
name: string
2664-
}
2665-
26662640
/**
26672641
* Creation properties of an IconButton.
26682642
* @param name A unique name for the control.
@@ -2675,14 +2649,6 @@ interface _AddControlPropertiesIconButton {
26752649
toggle: boolean
26762650
}
26772651

2678-
/**
2679-
* Creation properties of an Image.
2680-
* @param name A unique name for the control.
2681-
*/
2682-
interface _AddControlPropertiesImage {
2683-
name: string
2684-
}
2685-
26862652
/**
26872653
* Creation properties of a ListBox.
26882654
* @param name A unique name for the control.
@@ -2717,42 +2683,6 @@ interface _AddControlPropertiesPanel {
27172683
su1PanelCoordinates: boolean
27182684
}
27192685

2720-
/**
2721-
* Creation properties of a ProgressBar.
2722-
* The third argument of the add() method that creates it is the initial value (default 0), and the fourth argument is the maximum value of the range (default 100).
2723-
* @param name A unique name for the control.
2724-
*/
2725-
interface _AddControlPropertiesProgressbar {
2726-
name: string
2727-
}
2728-
2729-
/**
2730-
* Creation properties of a RadioButton.
2731-
* The third argument of the add() method that creates can be the label text.
2732-
* @param name A unique name for the control.
2733-
*/
2734-
interface _AddControlPropertiesRadioButton {
2735-
name: string
2736-
}
2737-
2738-
/**
2739-
* Creation properties of a Scrollbar.
2740-
* The third argument of the add() method that creates it is the initial value, and the fourth and fifth arguments are the minimum and maximum values of the range.
2741-
* @param name A unique name for the control.
2742-
*/
2743-
interface _AddControlPropertiesScrollbar {
2744-
name: string
2745-
}
2746-
2747-
/**
2748-
* Creation properties of a Slider.
2749-
* The third argument of the add() method that creates it is the initial value, and the fourth and fifth arguments are the minimum and maximum values of the range.
2750-
* @param name A unique name for the control.
2751-
*/
2752-
interface _AddControlPropertiesSlider {
2753-
name: string
2754-
}
2755-
27562686
/**
27572687
* Creation properties of a StaticText.
27582688
* @param name A unique name for the control.
@@ -2798,18 +2728,27 @@ interface _AddControlPropertiesWindow {
27982728
}
27992729

28002730
interface _AddControl {
2731+
/**
2732+
* Creation of a Button.
2733+
* The third argument can be the initial text value.
2734+
* Special name "ok" makes the button primary for parent dialog, and the special name "cancel" makes the button default cancel button for parent dialog.
2735+
*/
28012736
(
28022737
type: "button",
28032738
bounds?: Bounds | [number, number, number, number],
28042739
text?: string,
2805-
properties?: Partial<_AddControlPropertiesButton>,
2740+
properties?: Partial<_AddControlProperties>,
28062741
): Button
28072742

2743+
/**
2744+
* Creation of a CheckBox.
2745+
* The third argument is the text to be displayed.
2746+
*/
28082747
(
28092748
type: "checkbox",
28102749
bounds?: Bounds | [number, number, number, number],
28112750
text?: string,
2812-
properties?: Partial<_AddControlPropertiesCheckbox>,
2751+
properties?: Partial<_AddControlProperties>,
28132752
): Checkbox
28142753

28152754
(
@@ -2830,13 +2769,13 @@ interface _AddControl {
28302769
type: "flashplayer",
28312770
bounds?: Bounds | [number, number, number, number],
28322771
movieToLoad?: string | File,
2833-
properties?: Partial<_AddControlPropertiesFlashPlayer>,
2772+
properties?: Partial<_AddControlProperties>,
28342773
): FlashPlayer
28352774

28362775
(
28372776
type: "group",
28382777
bounds?: Bounds | [number, number, number, number],
2839-
properties?: Partial<_AddControlPropertiesGroup>,
2778+
properties?: Partial<_AddControlProperties>,
28402779
): Group
28412780

28422781
(
@@ -2850,7 +2789,7 @@ interface _AddControl {
28502789
type: "image",
28512790
bounds?: Bounds | [number, number, number, number],
28522791
icon?: string | File,
2853-
properties?: Partial<_AddControlPropertiesImage>,
2792+
properties?: Partial<_AddControlProperties>,
28542793
): Image
28552794

28562795
(
@@ -2867,37 +2806,53 @@ interface _AddControl {
28672806
properties?: Partial<_AddControlPropertiesPanel>,
28682807
): Panel
28692808

2809+
/**
2810+
* Creation of a ProgressBar.
2811+
* The third argument is the initial value (default 0), and the fourth argument is the maximum value of the range (default 100).
2812+
*/
28702813
(
28712814
type: "progressbar",
28722815
bounds?: Bounds | [number, number, number, number],
28732816
value?: number,
28742817
max?: number,
2875-
properties?: Partial<_AddControlPropertiesProgressbar>,
2818+
properties?: Partial<_AddControlProperties>,
28762819
): Progressbar
28772820

2821+
/**
2822+
* Creation of a RadioButton.
2823+
* The third argument can be the label text.
2824+
*/
28782825
(
28792826
type: "radiobutton",
28802827
bounds?: Bounds | [number, number, number, number],
28812828
text?: string,
2882-
properties?: Partial<_AddControlPropertiesRadioButton>,
2829+
properties?: Partial<_AddControlProperties>,
28832830
): RadioButton
28842831

2832+
/**
2833+
* Creation of a Scrollbar.
2834+
* The third argument is the initial value, and the fourth and fifth arguments are the minimum and maximum values of the range.
2835+
*/
28852836
(
28862837
type: "scrollbar",
28872838
bounds?: Bounds | [number, number, number, number],
28882839
value?: number,
28892840
min?: number,
28902841
max?: number,
2891-
properties?: Partial<_AddControlPropertiesScrollbar>,
2842+
properties?: Partial<_AddControlProperties>,
28922843
): Scrollbar
28932844

2845+
/**
2846+
* Creation of a Slider.
2847+
* The third argument is the initial value, and the fourth and fifth arguments are the minimum and maximum values of the range.
2848+
*/
28942849
(
28952850
type: "slider",
28962851
bounds?: Bounds | [number, number, number, number],
28972852
value?: number,
28982853
min?: number,
28992854
max?: number,
2900-
properties?: Partial<_AddControlPropertiesSlider>,
2855+
properties?: Partial<_AddControlProperties>,
29012856
): Slider
29022857

29032858
(

0 commit comments

Comments
 (0)