-
Notifications
You must be signed in to change notification settings - Fork 0
/
IDialog.hx
157 lines (125 loc) · 5.23 KB
/
IDialog.hx
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
package api.dialog;
import api.dialog.DialogTypes;
import api.IdeckiaApi.Promise;
import haxe.ds.Option;
@:autoBuild(api.macros.Macros.addExposeMetadata('Dialog'))
interface IDialog {
/**
Set default options for the dialogs.
@param options Any option to send.
**/
function setDefaultOptions(options:WindowOptions):Void;
/**
Shows notification
@param title The title of the notification.
@param text The text of the notification.
**/
function notify(title:String, text:String, ?options:WindowOptions):Void;
/**
Shows information window
@param title The title of the window
@param text The information text.
**/
function info(title:String, text:String, ?options:WindowOptions):Void;
/**
Shows warning window
@param title The title of the window
@param text The warning text.
**/
function warning(title:String, text:String, ?options:WindowOptions):Void;
/**
Shows error window
@param title The title of the window
@param text The error text.
**/
function error(title:String, text:String, ?options:WindowOptions):Void;
/**
Shows YES/NO question window
@param title The title of the window
@param text The text of the question
@returns A promise with value true if OK is clicked, false otherwise.
**/
function question(title:String, text:String, ?options:WindowOptions):Promise<Bool>;
/**
Select one or multiple file or directories
@param title The title of the window
@param isDirectory Do you want to select a directory instead of a file?
@param openDirectory Open the dialog in an directory
@param multiple Allow multiple selection
@param fileFilter Filter to show files
@returns A promise with selected files paths
**/
function selectFile(title:String, isDirectory:Bool = false, ?openDirectory:String, multiple:Bool = false, ?fileFilter:FileFilter,
?options:WindowOptions):Promise<Option<Array<String>>>;
/**
Open a dialog to save file
@param title The title of the window
@param saveName Optional name for saving
@param openDirectory Open the dialog in an directory
@param fileFilter Filter to show files
@returns A promise with selected files paths
**/
function saveFile(title:String, ?saveName:String, ?openDirectory:String, ?fileFilter:FileFilter, ?options:WindowOptions):Promise<Option<String>>;
/**
Open a dialog to get user input text
@param title The title of the window
@param text The text of the window
@param placeholder The input text placeholder.
@returns A promise with the entered text
**/
function entry(title:String, text:String, ?placeholder:String, ?options:WindowOptions):Promise<Option<String>>;
/**
Open a dialog to get user input password
@param title The title of the window
@param text The text of the window
@param showUsername Display the username field
@returns A promise with the an object containing username (if required) and password
**/
function password(title:String, text:String, showUsername:Bool = false, ?options:WindowOptions):Promise<Option<{username:String, password:String}>>;
/**
Create and show a progress dialog
@param title The title of the window
@param text The text of the window
@param autoClose Close automatically when finished
@returns A Progress instance
**/
function progress(title:String, text:String, autoClose:Bool = true, ?options:WindowOptions):Progress;
/**
Open a color selection dialog
@param title The title of the window
@param initialColor The initial selected color.
@returns A promise with the selected color
**/
function color(title:String, initialColor:String = "#FFFFFF", ?options:WindowOptions):Promise<Option<Color>>;
/**
Open a dialog to get user input text
@param title The title of the window
@param text The text of the window
@param year Set the calendar year
@param mont Set the calendar mont
@param day Set the calendar day
@param dateFormat Set the format for the returned date. The default depends on the user locale or be set with the strftime style. For example %A %d/%m/%y
@returns A promise with the entered date
**/
function calendar(title:String, text:String, ?year:UInt, ?month:UInt, ?day:UInt, ?dateFormat:String, ?options:WindowOptions):Promise<Option<String>>;
/**
Shows a list dialog
@param title The title of the window
@param text The text of the window
@param multiple Allow multiple selection
@param columnHeader Set the column header.
@param values Values to list.
@returns A promise with the selected items
**/
function list(title:String, text:String, columnHeader:String, values:Array<String>, multiple:Bool = false,
?options:WindowOptions):Promise<Option<Array<String>>>;
/**
Custom dialog. Passing a path to the dialog definition file the implementation will render it. When closed, it will return an array with filled values.
@param definitionPath The path of the definition file of the dialog
@returns A promise for an array with {id:String, value:Any}. Being `id` the identifier of the field and `value` the value of that field
**/
function custom(definitionPath:String):Promise<Option<Array<IdValue<String>>>>;
}
interface Progress {
function progress(percentage:UInt):Void;
}