aboutsummaryrefslogtreecommitdiff
path: root/core/.ui.dialogs.luadoc
blob: 0a18e6e147d33d2a896157b9fa196df3ad6b5250 (plain)
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
-- Copyright 2007-2016 Mitchell mitchell.att.foicica.com. See LICENSE.
-- This is a DUMMY FILE used for making LuaDoc for built-in functions in the
-- ui.dialogs table.

--- Provides a set of interactive dialog prompts for user input.
module('ui.dialogs')

---
-- Prompts the user with a generic message box dialog defined by dialog options
-- table *options*, returning the selected button's index.
-- If *options*.`string_output` is `true`, returns the selected button's label.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the message box.
--
--   * `title`: The dialog's title text.
--   * `text`: The dialog's main message text.
--   * `informative_text`: The dialog's extra informative text.
--   * `icon`: The dialog's GTK stock icon name. Examples are
--     "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and
--     "gtk-dialog-warning". The dialog does not display an icon by default.
--   * `icon_file`: The dialog's icon file path. This option has no effect when
--     `icon` is set.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code
-- @usage ui.dialogs.msgbox{title = 'EOL Mode', text = 'Which EOL?',
--   icon = 'gtk-dialog-question', button1 = 'CRLF', button2 = 'CR',
--   button3 = 'LF'}
function msgbox(options) end

---
-- Prompts the user with a generic message box dialog defined by dialog options
-- table *options* and with localized "Ok" and "Cancel" buttons, returning the
-- selected button's index.
-- If *options*.`string_output` is `true`, returns the selected button's label.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the message box.
--
--   * `title`: The dialog's title text.
--   * `text`: The dialog's main message text.
--   * `informative_text`: The dialog's extra informative text.
--   * `icon`: The dialog's GTK stock icon name. Examples are
--     "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and
--     "gtk-dialog-warning". The dialog does not display an icon by default.
--   * `icon_file`: The dialog's icon file path. This option has no effect when
--     `icon` is set.
--   * `no_cancel`: Do not display the "Cancel" button. The default value is
--     `false`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code
function ok_msgbox(options) end

---
-- Prompts the user with a generic message box dialog defined by dialog options
-- table *options* and with localized "Yes", "No", and "Cancel" buttons,
-- returning the selected button's index.
-- If *options*.`string_output` is `true`, returns the selected button's label.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the message box.
--
--   * `title`: The dialog's title text.
--   * `text`: The dialog's main message text.
--   * `informative_text`: The dialog's extra informative text.
--   * `icon`: The dialog's GTK stock icon name. Examples are
--     "gtk-dialog-error", "gtk-dialog-info", "gtk-dialog-question", and
--     "gtk-dialog-warning". The dialog does not display an icon by default.
--   * `icon_file`: The dialog's icon file path. This option has no effect when
--     `icon` is set.
--   * `no_cancel`: Do not display the "Cancel" button. The default value is
--     `false`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code
function yesno_msgbox(options) end

---
-- Prompts the user with an inputbox dialog defined by dialog options table
-- *options*, returning the selected button's index along with the user's
-- input text (the latter as a string or table, depending on the type of
-- *options*.`informative_text`).
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the user's input text.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
--   * `title`: The dialog's title text.
--   * `informative_text`: The dialog's main message text. If the value is a
--     table, the first table value is the main message text and any subsequent
--     values are used as the labels for multiple entry boxes. Providing a
--     single label has no effect.
--   * `text`: The dialog's initial input text. If the value is a table, the
--     table values are used to populate the multiple entry boxes defined by
--     `informative_text`.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
-- @usage ui.dialogs.inputbox{title = 'Goto Line', informative_text = 'Line:',
--   text = '1'}
function inputbox(options) end

---
-- Prompts the user with an inputbox dialog defined by dialog options table
-- *options* and with localized "Ok" and "Cancel" buttons, returning the
-- selected button's index along with the user's input text (the latter as a
-- string or table, depending on the type of *options*.`informative_text`).
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the user's input text.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
--   * `title`: The dialog's title text.
--   * `informative_text`: The dialog's main message text. If the value is a
--     table, the first table value is the main message text and any subsequent
--     values are used as the labels for multiple entry boxes. Providing a
--     single label has no effect.
--   * `text`: The dialog's initial input text. If the value is a table, the
--     table values are used to populate the multiple entry boxes defined by
--     `informative_text`.
--   * `no_cancel`: Do not display the "Cancel" button. The default value is
--     `false`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
function standard_inputbox(options) end

---
-- Prompts the user with a masked inputbox dialog defined by dialog options
-- table *options*, returning the selected button's index along with the user's
-- input text (the latter as a string or table, depending on the type of
-- *options*.`informative_text`).
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the user's input text.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
--   * `title`: The dialog's title text.
--   * `informative_text`: The dialog's main message text. If the value is a
--     table, the first table value is the main message text and any subsequent
--     values are used as the labels for multiple entry boxes. Providing a
--     single label has no effect.
--   * `text`: The dialog's initial input text. If the value is a table, the
--     table values are used to populate the multiple entry boxes defined by
--     `informative_text`.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
function secure_inputbox(options) end

---
-- Prompts the user with a masked inputbox dialog defined by dialog options
-- table *options* and with localized "Ok" and "Cancel" buttons, returning the
-- selected button's index along with the user's input text (the latter as a
-- string or table, depending on the type of *options*.`informative_text`).
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the user's input text.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the inputbox.
--
--   * `title`: The dialog's title text.
--   * `informative_text`: The dialog's main message text. If the value is a
--     table, the first table value is the main message text and any subsequent
--     values are used as the labels for multiple entry boxes. Providing a
--     single label has no effect.
--   * `text`: The dialog's initial input text. If the value is a table, the
--     table values are used to populate the multiple entry boxes defined by
--     `informative_text`.
--   * `no_cancel`: Do not display the "Cancel" button. The default value is
--     `false`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, input text
function secure_standard_inputbox(options) end

---
-- Prompts the user with a file selection dialog defined by dialog options
-- table *options*, returning the string file selected.
-- If *options*.`select_multiple` is `true`, returns the list of files selected.
-- If the user canceled the dialog, returns `nil`.
-- @param options Table of key-value option pairs for the dialog.
--
--   * `title`: The dialog's title text.
--   * `with_directory`: The initial filesystem directory to show.
--   * `with_file`: The initially selected filename. This option requires
--     `with_directory` to be set.
--   * `with_extension`: The list of extensions selectable files must have.
--   * `select_multiple`: Allow the user to select multiple files. The default
--     value is `false`.
--   * `select_only_directories`: Only allow the user to select directories. The
--     default value is `false`.
-- @return filename, list of filenames, or nil
-- @usage ui.dialogs.fileselect{title = 'Open C File', with_directory = _HOME,
--   with_extension = {'c', 'h'}, select_multiple = true}
function fileselect(options) end

---
-- Prompts the user with a file save dialog defined by dialog options table
-- *options*, returning the string file chosen.
-- If the user canceled the dialog, returns `nil`.
-- @param options Table of key-value option pairs for the dialog.
--
--   * `title`: The dialog's title text.
--   * `with_directory`: The initial filesystem directory to show.
--   * `with_file`: The initially chosen filename. This option requires
--     `with_directory` to be set.
--   * `with_extension`: The list of extensions selectable files must have.
--   * `no_create_directories`: Prevent the user from creating new directories.
--     The default value is `false`.
-- @return filename or nil
function filesave(options) end

---
-- Prompts the user with a multiple-line textbox dialog defined by dialog
-- options table *options*, returning the selected button's index.
-- If *options*.`string_output` is `true`, returns the selected button's label.
-- If *options*.`editable` is `true`, also returns the textbox's text. If the
-- dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the dialog.
--
--   * `title`: The dialog's title text.
--   * `informative_text`: The dialog's main message text.
--   * `text`: The dialog's initial textbox text.
--   * `text_from_file`: The filename whose contents are loaded into the
--     textbox. This option has no effect when `text` is given.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `editable`: Allows the user to edit the textbox's text. The default value
--     is `false`.
--   * `focus_textbox`: Focus the textbox instead of the buttons. The default
--     value is `false`.
--   * `scroll_to`: Where to scroll the textbox's text.
--     The available values are `"top"` and `"bottom"`. The default value is
--     `"top"`.
--   * `selected`: Select all of the textbox's text. The default value is
--     `false`.
--   * `monospaced_font`: Use a monospaced font in the textbox instead of a
--     proportional one. The default value is `false`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) or the dialog's exit status instead of the button's index (instead
--     of its exit code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, textbox text
-- @usage ui.dialogs.textbox{title = 'License Agreement',
--   informative_text = 'You agree to:', text_from_file = _HOME..'/LICENSE'}
function textbox(options) end

---
-- Prompts the user with a drop-down item selection dialog defined by dialog
-- options table *options*, returning the selected button's index along with the
-- index of the selected item.
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the selected item's text.
-- If the dialog closed due to *options*.`exit_onchange`, returns `4` along with
-- either the selected item's index or its text. If the dialog timed out,
-- returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or
-- `"delete"`.
-- @param options Table of key-value option pairs for the drop-down dialog.
--
--   * `title`: The dialog's title text.
--   * `text`: The dialog's main message text.
--   * `items`: The list of string items to show in the drop-down.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `exit_onchange`: Close the dialog after selecting a new item. The default
--     value is `false`.
--   * `select`: The index of the initially selected list item. The default
--     value is `1`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) and the selected item's text (instead of its index). If no item
--     was selected, returns the dialog's exit status (instead of its exit
--     code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, selected item
-- @usage ui.dialogs.dropdown{title = 'Select Encoding', width = 200,
--   items = io.encodings, string_output = true}
function dropdown(options) end

---
-- Prompts the user with a drop-down item selection dialog defined by dialog
-- options table *options* and with localized "Ok" and "Cancel" buttons,
-- returning the selected button's index along with the selected item's index.
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the selected item's text.
-- If the dialog closed due to *options*.`exit_onchange`, returns `4` along with
-- either the selected item's index or its text. If the dialog timed out,
-- returns `0` or `"timeout"`. If the user canceled the dialog, returns `-1` or
-- `"delete"`.
-- @param options Table of key-value option pairs for the drop-down dialog.
--
--   * `title`: The dialog's title text.
--   * `text`: The dialog's main message text.
--   * `items`: The list of string items to show in the drop-down.
--   * `no_cancel`: Do not display the "Cancel" button. The default value is
--     `false`.
--   * `exit_onchange`: Close the dialog after selecting a new item. The default
--     value is `false`.
--   * `select`: The index of the initially selected list item. The default
--     value is `1`.
--   * `string_output`: Return the selected button's label (instead of its
--     index) and the selected item's text (instead of its index). If no item
--     was selected, returns the dialog's exit status (instead of its exit
--     code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, selected item
function standard_dropdown(options) end

---
-- Prompts the user with a filtered list item selection dialog defined by dialog
-- options table *options*, returning the selected button's index along with the
-- index or indices of the selected item or items (depending on whether or not
-- *options*.`select_multiple` is `true`).
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the text of the selected item or items.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- Spaces in the filter text are treated as wildcards.
-- @param options Table of key-value option pairs for the filtered list dialog.
--
--   * `title`: The dialog's title text.
--   * `informative_text`: The dialog's main message text.
--   * `text`: The dialog's initial input text.
--   * `columns`: The list of string column names for list rows.
--   * `items`: The list of string items to show in the filtered list.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `select_multiple`: Allow the user to select multiple items. The default
--     value is `false`.
--   * `search_column`: The column number to filter the input text against. The
--     default value is `1`. This option requires `columns` to be set and
--     contain at least *n* column names.
--   * `output_column`: The column number to use for `string_output`. The
--     default value is `1`. This option requires `columns` to be set and
--     contain at least *n* column names.
--   * `string_output`: Return the selected button's label (instead of its
--     index) and the selected item's text (instead of its index). If no item
--     was selected, returns the dialog's exit status (instead of its exit
--     code). The default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, selected item or list of selected items
-- @usage ui.dialogs.filteredlist{title = 'Title', columns = {'Foo', 'Bar'},
--   items = {'a', 'b', 'c', 'd'}}
function filteredlist(options) end

---
-- Prompts the user with an option selection dialog defined by dialog options
-- table *options*, returning the selected button's index along with the indices
-- of the selected options.
-- If *options*.`string_output` is `true`, returns the selected button's label
-- along with the text of the selected options.
-- If the dialog timed out, returns `0` or `"timeout"`. If the user canceled the
-- dialog, returns `-1` or `"delete"`.
-- @param options Table of key-value option pairs for the option select dialog.
--
--   * `title`: The dialog's title text.
--   * `text`: The dialog's main message text.
--   * `items`: The list of string options to show in the option group.
--   * `button1`: The right-most button's label. The default value is
--     `_L['_OK']`.
--   * `button2`: The middle button's label.
--   * `button3`: The left-most button's label. This option requires `button2`
--     to be set.
--   * `select`: The indices of initially selected options.
--   * `string_output`: Return the selected button's label or the dialog's exit
--     status along with the selected options' text instead of the button's
--     index or the dialog's exit code along with the options' indices. The
--     default value is `false`.
--   * `width`: The dialog's pixel width.
--   * `height`: The dialog's pixel height.
--   * `float`: Show the dialog on top of all desktop windows. The default value
--     is `false`.
--   * `timeout`: The integer number of seconds the dialog waits for the user to
--     select a button before timing out. Dialogs do not time out by default.
-- @return selected button or exit code, list of selected options
-- @usage ui.dialogs.optionselect{title = 'Language',
--   informative_text = 'Check the languages you understand'
--   items = {'English', 'Romanian'}, select = 1, string_output = true}
function optionselect(options) end