| 1 | #ifndef _Ui_h_ |
| 2 | #define _Ui_h_ |
| 3 | /* Ui.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007-2024,2026 Paul Boersma |
| 6 | * |
| 7 | * This code is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This code is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 | * See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "Graphics.h" |
| 22 | #include "Gui.h" |
| 23 | #include "Interpreter.h" |
| 24 | Thing_declare (EditorCommand); |
| 25 | |
| 26 | #include "Ui_enums.h" |
| 27 | |
| 28 | /* Forms for getting arguments from the user. */ |
| 29 | |
| 30 | /* Example of usage: |
| 31 | { |
| 32 | static autoUiForm dia; |
| 33 | if (! dia) { |
| 34 | dia = UiForm_create |
| 35 | (topShell, // the parent GuiWindow of the dialog window |
| 36 | nullptr, // an optional editor |
| 37 | U"Create a new person", // the window title |
| 38 | DO_Person_create, // the function to call when the user clicks OK |
| 39 | nullptr, // the last argument to the OK routine (also for the other buttons); could be a ScriptEditor, or an EditorCommand, or an Interpreter, or nullptr |
| 40 | U"Create person...", // the invoking button title |
| 41 | U"Create person..."); // the help string; may be nullptr |
| 42 | static integer age; |
| 43 | UiForm_addNatural0 (dia.get(), & age, U"age", U"Age (years)", U"18"); |
| 44 | static double length; |
| 45 | UiForm_addPositive (dia.get(), & length, U"length", U"Length (metres)", U"1.68 (= average)"); |
| 46 | static bool beard; |
| 47 | UiForm_addBoolean (dia.get(), & beard, U"beard", U"Beard", false); |
| 48 | static int sex; |
| 49 | UiForm_addChoice (dia.get(), & sex, U"sex", U"Sex", 1); |
| 50 | UiForm_addOption (dia.get(), U"Female"); |
| 51 | UiForm_addOption (dia.get(), U"Male"); |
| 52 | UiForm_addWord (dia.get(), colour, U"colour", U"Colour", U"black"); |
| 53 | UiForm_addComment (dia.get(), U"features", U"Some less conspicuous features:"); |
| 54 | static integer numberOfBirthMarks; |
| 55 | UiForm_addNatural0 (dia.get(), & numberOfBirthMarks, U"numberOfBirthMarks", U"Number of birth marks", U"28"); |
| 56 | static char *favouriteGreeting; |
| 57 | UiForm_addSentence (dia.get(), & favouriteGreeting, U"favouriteGreeting", U"Favourite greeting", U"Good morning"); |
| 58 | UiForm_finish (dia.get()); |
| 59 | } |
| 60 | UiForm_setReal (dia.get(), & length, myLength); |
| 61 | UiForm_setInteger (dia.get(), & numberOfBirthMarks, 30); |
| 62 | UiForm_do (dia.get(), false); // show dialog box |
| 63 | } |
| 64 | Real, Nonnegative, Positive, Integer, Natural0, Natural1, Channel, Word, and Sentence show a label and an editable text field. |
| 65 | Choice shows a label and has Option children stacked below it. |
| 66 | OptionMenu shows a label and has Option children in a menu. |
| 67 | Heading and Comment show only their value. |
| 68 | Text, RealVector and RealVector show an editable text field over the whole width of the form. |
| 69 | Boolean shows a labeled toggle button which is on (true) or off (false). |
| 70 | Option does the same inside a choice box or option menu. |
| 71 | List shows a scrollable list. |
| 72 | Colour shows a label and an editable text field for a grey value between 0.0 and 1.0, a colour name, or {r,g,b}. |
| 73 | Channel shows a label and an editable text field for a natural number or one of the texts "Left", "Right", "Mono" or "Stereo". |
| 74 | As shown in the example, Real, Nonnegative, Positive, Integer, Natural 0 and Natural1 may contain extra text; |
| 75 | this text is considered a comment. |
| 76 | When you click "Standards", the standard values (including comments) |
| 77 | are restored to all items in the form. |
| 78 | */ |
| 79 | |
| 80 | Thing_define (UiOption, Thing) { |
| 81 | GuiRadioButton radioButton; |
| 82 | GuiObject menuItem; |
| 83 | }; |
| 84 | |
| 85 | enum class _kUiField_type { |
| 86 | REAL_ = 1, |
| 87 | LABELLED_TEXT_MIN_ = REAL_, |
| 88 | REAL_OR_UNDEFINED_ = 2, |
| 89 | NONNEGATIVE_ = 3, |
| 90 | POSITIVE_ = 4, |
| 91 | INTEGER_ = 5, |
| 92 | NATURAL0_ = 6, |
| 93 | NATURAL1_ = 7, |
| 94 | WORD_ = 8, |
| 95 | SENTENCE_ = 9, |
| 96 | COLOUR_ = 10, |
| 97 | CHANNEL_ = 11, |
| 98 | LABELLED_TEXT_MAX_ = CHANNEL_, |
| 99 | |
| 100 | HEADING_ = 12, |
| 101 | COMMENT_MIN_ = HEADING_, |
| 102 | COMMENT_ = 13, |
| 103 | CAPTION_ = 14, |
| 104 | COMMENT_MAX_ = CAPTION_, |
| 105 | |
| 106 | TEXT_ = 15, |
| 107 | FORMULA_ = 16, |
| 108 | INFILE_ = 17, |
| 109 | OUTFILE_ = 18, |
| 110 | FOLDER_ = 19, |
| 111 | REALVECTOR_ = 20, |
| 112 | NONNEGATIVEVECTOR_ = 21, |
| 113 | POSITIVEVECTOR_ = 22, |
| 114 | INTEGERVECTOR_ = 23, |
| 115 | NATURAL0VECTOR_ = 24, |
| 116 | NATURAL1VECTOR_ = 25, |
| 117 | REALMATRIX_ = 26, |
| 118 | STRINGARRAY_ = 27, |
| 119 | BOOLEAN_ = 28, |
| 120 | CHOICE_ = 29, |
| 121 | OPTIONMENU_ = 30, |
| 122 | LIST_ = 31, |
| 123 | }; |
| 124 | inline bool _kUiField_type_isLabelledText (_kUiField_type type) { |
| 125 | return type >= _kUiField_type :: LABELLED_TEXT_MIN_ && type <= _kUiField_type :: LABELLED_TEXT_MAX_; |
| 126 | } |
| 127 | inline bool _kUiField_type_isComment (_kUiField_type type) { |
| 128 | return type >= _kUiField_type :: COMMENT_MIN_ && type <= _kUiField_type :: COMMENT_MAX_; |
| 129 | } |
| 130 | |
| 131 | Thing_define (UiField, Thing) { |
| 132 | _kUiField_type type; |
| 133 | autostring32 labelText; |
| 134 | double realValue; |
| 135 | integer integerValue, integerDefaultValue; |
| 136 | autostring32 stringValue, stringDefaultValue; |
| 137 | kUi_realVectorFormat realVectorDefaultFormat; // for REALVECTOR_, NONNEGATIVEVECTOR_, POSITIVEVECTOR_ |
| 138 | autoVEC realVectorValue, realVectorDefaultValue; // for REALVECTOR_, NONNEGATIVEVECTOR_, POSITIVEVECTOR_ |
| 139 | kUi_integerVectorFormat integerVectorDefaultFormat; // for INTEGERVECTOR_, NATURAL0VECTOR_, NATURAL1VECTOR_ |
| 140 | autoINTVEC integerVectorValue, integerVectorDefaultValue; // for INTEGERVECTOR_, NATURAL0VECTOR_, NATURAL1VECTOR_ |
| 141 | autoMAT numericMatrixValue, numericMatrixDefaultValue; // for REALMATRIX_ |
| 142 | kUi_stringArrayFormat stringArrayFormat; // for STRINGARRAY_ |
| 143 | autoSTRVEC stringArrayValue, stringArrayDefaultValue; // for STRINGARRAY_ |
| 144 | autostring32 previouslySelectedListString; // for LIST_ |
| 145 | MelderColour colourValue; |
| 146 | OrderedOf<structUiOption> options; |
| 147 | constSTRVEC strings; |
| 148 | GuiLabel label; |
| 149 | GuiText text; |
| 150 | GuiCheckButton checkButton; |
| 151 | GuiRadioButton radioButton; // for CHOICE_ |
| 152 | GuiList list; |
| 153 | GuiOptionMenu optionMenu; |
| 154 | enum_generic_getValue getValueFunction; |
| 155 | GuiButton pushButton; // like "Browse..." for INFILE_, OUTFILE_, FOLDER_ (2021-03-30) |
| 156 | int y; |
| 157 | |
| 158 | conststring32 variableName; // a reference to a name known at compile time, for use by the Praat library |
| 159 | double *realVariable; |
| 160 | integer *integerVariable; |
| 161 | int *intVariable; |
| 162 | bool *boolVariable; |
| 163 | conststring32 *stringVariable; |
| 164 | MelderColour *colourVariable; |
| 165 | constVEC *realVectorVariable; |
| 166 | constINTVEC *integerVectorVariable; |
| 167 | constMAT *numericMatrixVariable; |
| 168 | constSTRVEC *stringArrayVariable; |
| 169 | |
| 170 | int subtract; |
| 171 | integer numberOfLines; |
| 172 | }; |
| 173 | |
| 174 | using UiCallback = void (*) (UiForm _sendingForm, integer _narg, Stackel _args, conststring32 _sendingString, |
| 175 | Interpreter interpreter, conststring32 _invokingButtonTitle, bool _isModified, void *_closure, Editor optionalEditor); |
| 176 | |
| 177 | #define MAXIMUM_NUMBER_OF_FIELDS 50 |
| 178 | #define MAXIMUM_NUMBER_OF_CONTINUE_BUTTONS 10 |
| 179 | |
| 180 | Thing_define (UiForm, Thing) { |
| 181 | EditorCommand command; |
| 182 | GuiWindow d_dialogParent; |
| 183 | Editor optionalEditor; |
| 184 | autostring32 invokingButtonTitle, helpTitle, scriptFilePath; |
| 185 | UiCallback okCallback; |
| 186 | void *buttonClosure; |
| 187 | |
| 188 | /* |
| 189 | In case the validity of the form depends on the selected objects. |
| 190 | */ |
| 191 | bool (*allowExecutionHook) (void *closure); |
| 192 | void *allowExecutionClosure; |
| 193 | |
| 194 | /* |
| 195 | In case the form is built by specifying buttons (rather than a system-built-in file dialog). |
| 196 | */ |
| 197 | GuiDialog d_dialogForm; |
| 198 | void (*applyCallback) (UiForm dia, void *closure); |
| 199 | void (*cancelCallback) (UiForm dia, void *closure); |
| 200 | int numberOfContinueButtons, defaultContinueButton, cancelContinueButton, clickedContinueButton; |
| 201 | autostring32 continueTexts [1 + MAXIMUM_NUMBER_OF_CONTINUE_BUTTONS]; |
| 202 | int numberOfFields; |
| 203 | autoUiField field [1 + MAXIMUM_NUMBER_OF_FIELDS]; |
| 204 | UiField referenceToLatestUsedChoiceOrOptionMenu; |
| 205 | GuiButton okButton, cancelButton, revertButton, helpButton, applyButton, continueButtons [1 + MAXIMUM_NUMBER_OF_CONTINUE_BUTTONS]; |
| 206 | bool destroyWhenUnmanaged, isPauseForm; |
| 207 | |
| 208 | /* |
| 209 | In case the form contains a file. |
| 210 | */ |
| 211 | structMelderFile file; |
| 212 | int shiftKeyPressed; |
| 213 | bool allowMultipleFiles; // for input |
| 214 | |
| 215 | void v9_destroy () noexcept |
| 216 | override; |
| 217 | }; |
| 218 | |
| 219 | /* The following functions work on the screen and from batch. */ |
| 220 | autoUiForm UiForm_create (GuiWindow parent, Editor optionalEditor, conststring32 title, |
| 221 | UiCallback okCallback, void *buttonClosure, |
| 222 | conststring32 invokingButtonTitle, conststring32 helpTitle |
| 223 | ); |
| 224 | UiField UiForm_addReal (UiForm me, double *variable, conststring32 variableName, |
| 225 | conststring32 labelText, conststring32 defaultValue); |
| 226 | UiField UiForm_addRealOrUndefined (UiForm me, double *variable, conststring32 variableName, |
| 227 | conststring32 labelText, conststring32 defaultValue); |
| 228 | UiField UiForm_addNonnegative (UiForm me, double *variable, conststring32 variableName, |
| 229 | conststring32 labelText, conststring32 defaultValue); |
| 230 | UiField UiForm_addPositive (UiForm me, double *variable, conststring32 variableName, |
| 231 | conststring32 labelText, conststring32 defaultValue); |
| 232 | UiField UiForm_addInteger (UiForm me, integer *variable, conststring32 variableName, |
| 233 | conststring32 labelText, conststring32 defaultValue); |
| 234 | UiField UiForm_addNatural0 (UiForm me, integer *variable, conststring32 variableName, |
| 235 | conststring32 labelText, conststring32 defaultValue); |
| 236 | UiField UiForm_addNatural1 (UiForm me, integer *variable, conststring32 variableName, |
| 237 | conststring32 labelText, conststring32 defaultValue); |
| 238 | UiField UiForm_addWord (UiForm me, conststring32 *variable, conststring32 variableName, |
| 239 | conststring32 labelText, conststring32 defaultValue); |
| 240 | UiField UiForm_addSentence (UiForm me, conststring32 *variable, conststring32 variableName, |
| 241 | conststring32 labelText, conststring32 defaultValue); |
| 242 | UiField UiForm_addHeading (UiForm me, conststring32 *variable, conststring32 labelText); |
| 243 | UiField UiForm_addComment (UiForm me, conststring32 *variable, conststring32 labelText); |
| 244 | UiField UiForm_addCaption (UiForm me, conststring32 *variable, conststring32 labelText); |
| 245 | UiField UiForm_addBoolean (UiForm me, bool *variable, conststring32 variableName, |
| 246 | conststring32 labelText, bool defaultValue); |
| 247 | UiField UiForm_addText (UiForm me, conststring32 *variable, conststring32 variableName, |
| 248 | conststring32 labelText, conststring32 defaultValue, integer numberOfLines = 1); |
| 249 | UiField UiForm_addFormula (UiForm me, conststring32 *variable, conststring32 variableName, |
| 250 | conststring32 labelText, conststring32 defaultValue, integer numberOfLines = 5); |
| 251 | UiField UiForm_addInfile (UiForm me, conststring32 *variable, conststring32 variableName, |
| 252 | conststring32 labelText, conststring32 defaultValue, integer numberOfLines = 3); |
| 253 | UiField UiForm_addOutfile (UiForm me, conststring32 *variable, conststring32 variableName, |
| 254 | conststring32 labelText, conststring32 defaultValue, integer numberOfLines = 3); |
| 255 | UiField UiForm_addFolder (UiForm me, conststring32 *variable, conststring32 variableName, |
| 256 | conststring32 labelText, conststring32 defaultValue, integer numberOfLines = 3); |
| 257 | UiField UiForm_addRealVector (UiForm me, constVEC *variable, conststring32 variableName, |
| 258 | conststring32 labelText, kUi_realVectorFormat defaultFormat, conststring32 defaultValue, integer numberOfLines = 7); |
| 259 | UiField UiForm_addNonnegativeVector (UiForm me, constVEC *variable, conststring32 variableName, |
| 260 | conststring32 labelText, kUi_realVectorFormat defaultFormat, conststring32 defaultValue, integer numberOfLines = 7); |
| 261 | UiField UiForm_addPositiveVector (UiForm me, constVEC *variable, conststring32 variableName, |
| 262 | conststring32 labelText, kUi_realVectorFormat defaultFormat, conststring32 defaultValue, integer numberOfLines = 7); |
| 263 | UiField UiForm_addIntegerVector (UiForm me, constINTVEC *variable, conststring32 variableName, |
| 264 | conststring32 labelText, kUi_integerVectorFormat defaultFormat, conststring32 defaultValue, integer numberOfLines = 7); |
| 265 | UiField UiForm_addNatural0Vector (UiForm me, constINTVEC *variable, conststring32 variableName, |
| 266 | conststring32 labelText, kUi_integerVectorFormat defaultFormat, conststring32 defaultValue, integer numberOfLines = 7); |
| 267 | UiField UiForm_addNatural1Vector (UiForm me, constINTVEC *variable, conststring32 variableName, |
| 268 | conststring32 labelText, kUi_integerVectorFormat defaultFormat, conststring32 defaultValue, integer numberOfLines = 7); |
| 269 | UiField UiForm_addRealMatrix (UiForm me, constMAT *variable, conststring32 variableName, |
| 270 | conststring32 labelText, constMATVU defaultValue, integer numberOfLines = 10); |
| 271 | UiField UiForm_addStringArray (UiForm me, constSTRVEC *variable, conststring32 variableName, |
| 272 | conststring32 labelText, constSTRVEC defaultValue, integer numberOfLines = 7); |
| 273 | UiField UiForm_addChoice (UiForm me, int *intVariable, conststring32 *stringVariable, conststring32 variableName, |
| 274 | conststring32 labelText, int defaultValue, int base); |
| 275 | UiField UiForm_addChoiceEnum (UiForm me, int *intVariable, conststring32 *stringVariable, conststring32 variableName, |
| 276 | conststring32 labelText, int defaultValue, int base, enum_generic_getValue getValueFunction); |
| 277 | UiField UiForm_addOptionMenu (UiForm me, int *intVariable, conststring32 *stringVariable, conststring32 variableName, |
| 278 | conststring32 labelText, int defaultValue, int base); |
| 279 | UiField UiForm_addOptionMenuEnum (UiForm me, int *intVariable, conststring32 *stringVariable, conststring32 variableName, |
| 280 | conststring32 labelText, int defaultValue, int base, enum_generic_getValue getValueFunction); |
| 281 | UiOption UiForm_addOption (UiForm me, conststring32 optionText); |
| 282 | UiField UiForm_addList (UiForm me, integer *integerVariable, conststring32 *stringVariable, conststring32 variableName, |
| 283 | conststring32 labelText, constSTRVEC strings, integer defaultValue); |
| 284 | UiField UiForm_addColour (UiForm me, MelderColour *colourVariable, conststring32 variableName, |
| 285 | conststring32 labelText, conststring32 defaultValue); |
| 286 | UiField UiForm_addChannel (UiForm me, integer *variable, conststring32 variableName, |
| 287 | conststring32 labelText, conststring32 defaultValue); |
| 288 | void UiForm_finish (UiForm me); |
| 289 | |
| 290 | void UiForm_destroyWhenUnmanaged (UiForm me); |
| 291 | void UiForm_setPauseForm (UiForm me, |
| 292 | int numberOfContinueButtons, int defaultContinueButton, int cancelContinueButton, |
| 293 | conststring32 continue1, conststring32 continue2, conststring32 continue3, |
| 294 | conststring32 continue4, conststring32 continue5, conststring32 continue6, |
| 295 | conststring32 continue7, conststring32 continue8, conststring32 continue9, |
| 296 | conststring32 continue10, |
| 297 | void (*cancelCallback) (UiForm dia, void *closure)); |
| 298 | |
| 299 | /* The following nine functions set values in widgets. */ |
| 300 | /* Do not call from batch. */ |
| 301 | /* 'fieldName' is name from UiForm_addXXXXXX (), */ |
| 302 | /* without anything from and including the first " (" or ":". */ |
| 303 | |
| 304 | /* Real, RealOrUndefined, Nonnegative, and Positive fields: */ |
| 305 | void UiForm_setReal (UiForm me, double *p_variable, double value); |
| 306 | void UiForm_setRealAsString (UiForm me, double *p_variable, conststring32 stringValue /* cattable */); |
| 307 | /* Integer, Natural0, Natural1, Channel, and List fields: */ |
| 308 | void UiForm_setInteger (UiForm me, integer *p_variable, integer value); |
| 309 | void UiForm_setIntegerAsString (UiForm me, integer *p_variable, conststring32 stringValue /* cattable */); |
| 310 | /* Word, Sentence, Text, Heading and Comment fields: */ |
| 311 | void UiForm_setString (UiForm me, conststring32 *p_variable, conststring32 text /* cattable */); |
| 312 | /* Boolean fields: */ |
| 313 | void UiForm_setBoolean (UiForm me, bool *p_variable, bool value); |
| 314 | /* Choice and OptionMenu fields: */ |
| 315 | void UiForm_setOption (UiForm me, int *p_variable, int value); |
| 316 | void UiForm_setOptionAsString (UiForm me, int *p_variable, conststring32 stringValue /* cattable */); |
| 317 | /* List fields: */ |
| 318 | void UiForm_setList (UiForm me, integer *p_integerVariable, conststring32 *p_stringVariable, |
| 319 | constSTRVEC strings, integer defaultValue); |
| 320 | /* Colour fields: */ |
| 321 | void UiForm_setColourAsGreyValue (UiForm me, MelderColour *p_variable, double greyValue); |
| 322 | |
| 323 | void UiForm_do (UiForm me, bool modified); |
| 324 | /* |
| 325 | Function: |
| 326 | put the form on the screen. |
| 327 | Behaviour: |
| 328 | If the user clicks "OK", |
| 329 | the form will call the `okCallback` that was registered with UiForm_create (). |
| 330 | |
| 331 | If the user clicks "Apply", |
| 332 | the form will call the `okCallback` that was registered with UiForm_create (), |
| 333 | and the form disappears from the screen. |
| 334 | |
| 335 | If the user clicks "Cancel", the form disappears from the screen. |
| 336 | |
| 337 | If the user clicks "Help", the form calls `help` with the `helpTitle` |
| 338 | and stays on the screen. |
| 339 | |
| 340 | When the form disappears from the screen, the values in the fields |
| 341 | will remain until the next invocation of UiForm_do () for the same form. |
| 342 | Arguments: |
| 343 | the above behaviour describes the action when `modified` is false. |
| 344 | If `modified` is true, the user does not have to click OK. |
| 345 | The form will still appear on the screen, |
| 346 | but the `okCallback` will be called immediately. |
| 347 | */ |
| 348 | void UiForm_info (UiForm me, integer narg); |
| 349 | |
| 350 | /* |
| 351 | The `okCallback` can use the following seven functions to ask arguments. |
| 352 | The field names are the `label` or `name` arguments to UiForm_addXXXXXX (), |
| 353 | without anything from parentheses or from a colon. |
| 354 | These functions work from the GUI as well as from a script. |
| 355 | */ |
| 356 | integer UiForm_getInteger (UiForm me, conststring32 fieldName); // Integer, Natural0, Natural1, Boolean, Choice, OptionMenu, List |
| 357 | char32 * UiForm_getString (UiForm me, conststring32 fieldName); // Word, Sentence, Text, RealMatrix, Choice, OptionMenu, List |
| 358 | MelderFile UiForm_getFile (UiForm me, conststring32 fieldName); // Infile, Outfile |
| 359 | VEC UiForm_getRealVector (UiForm me, conststring32 fieldName); // RealVector, NonnegativeVector, PositiveVector |
| 360 | INTVEC UiForm_getIntegerVector (UiForm me, conststring32 fieldName); // IntegerVector, Natural0Vector, Natural1Vector |
| 361 | |
| 362 | double UiForm_getReal_check (UiForm me, conststring32 fieldName); |
| 363 | integer UiForm_getInteger_check (UiForm me, conststring32 fieldName); |
| 364 | char32 * UiForm_getString_check (UiForm me, conststring32 fieldName); |
| 365 | MelderColour UiForm_getColour_check (UiForm me, conststring32 fieldName); |
| 366 | |
| 367 | void UiForm_call (UiForm me, integer narg, Stackel args, Interpreter interpreter); |
| 368 | void UiForm_parseString (UiForm me, conststring32 arguments, Interpreter interpreter); |
| 369 | |
| 370 | autoUiForm UiInfile_create (GuiWindow parent, Editor optionalEditor, conststring32 title, |
| 371 | UiCallback okCallback, void *okClosure, |
| 372 | conststring32 invokingButtonTitle, conststring32 helpTitle, bool allowMultipleFiles); |
| 373 | |
| 374 | autoUiForm UiOutfile_create (GuiWindow parent, Editor optionalEditor, conststring32 title, |
| 375 | UiCallback okCallback, void *okClosure, |
| 376 | conststring32 invokingButtonTitle, conststring32 helpTitle); |
| 377 | |
| 378 | void UiInfile_do (UiForm me); |
| 379 | |
| 380 | void UiOutfile_do (UiForm me, conststring32 defaultName); |
| 381 | |
| 382 | MelderFile UiFile_getFile (UiForm me); |
| 383 | |
| 384 | void UiFile_hide (); |
| 385 | /* |
| 386 | Hides the visible UiFile that was opened most recently. |
| 387 | Normally, file selectors stay open until their okCallback has completed. |
| 388 | However, the okCallback may initiate an event loop allowing the user |
| 389 | to interact with the application, for instance in Melder_pause (). |
| 390 | In order that the user does not have to hide the modal file selector |
| 391 | manually (by clicking the Cancel button), the application can call |
| 392 | UiFile_hide () before Melder_pause (). |
| 393 | */ |
| 394 | |
| 395 | void UiHistory_write (conststring32 string); |
| 396 | void UiHistory_write_expandQuotes (conststring32 string); |
| 397 | void UiHistory_write_colonize (conststring32 string); |
| 398 | char32 *UiHistory_get (); |
| 399 | void UiHistory_clear (); |
| 400 | |
| 401 | void Ui_setAllowExecutionHook (bool (*allowExecutionHook) (void *closure), void *allowExecutionClosure); |
| 402 | |
| 403 | void UiForm_Interpreter_addVariables (UiForm me, Interpreter interpreter); |
| 404 | int UiForm_getClickedContinueButton (UiForm me); |
| 405 | |
| 406 | void Ui_prefs (); |
| 407 | |
| 408 | /* End of file Ui.h */ |
| 409 | #endif |