1 /** 2 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.editorfiledialog; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.meta; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.object; 22 import godot.classdb; 23 import godot.confirmationdialog; 24 import godot.inputevent; 25 import godot.vboxcontainer; 26 import godot.texture; 27 import godot.acceptdialog; 28 import godot.windowdialog; 29 import godot.popup; 30 import godot.control; 31 import godot.canvasitem; 32 import godot.node; 33 /** 34 35 */ 36 @GodotBaseClass struct EditorFileDialog 37 { 38 enum string _GODOT_internal_name = "EditorFileDialog"; 39 public: 40 @nogc nothrow: 41 union { godot_object _godot_object; ConfirmationDialog _GODOT_base; } 42 alias _GODOT_base this; 43 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 44 package(godot) __gshared bool _classBindingInitialized = false; 45 package(godot) static struct _classBinding 46 { 47 __gshared: 48 @GodotName("_unhandled_input") GodotMethod!(void, InputEvent) _unhandledInput; 49 @GodotName("_item_selected") GodotMethod!(void, long) _itemSelected; 50 @GodotName("_multi_selected") GodotMethod!(void, long, bool) _multiSelected; 51 @GodotName("_items_clear_selection") GodotMethod!(void) _itemsClearSelection; 52 @GodotName("_item_list_item_rmb_selected") GodotMethod!(void, long, Vector2) _itemListItemRmbSelected; 53 @GodotName("_item_list_rmb_clicked") GodotMethod!(void, Vector2) _itemListRmbClicked; 54 @GodotName("_item_menu_id_pressed") GodotMethod!(void, long) _itemMenuIdPressed; 55 @GodotName("_item_db_selected") GodotMethod!(void, long) _itemDbSelected; 56 @GodotName("_dir_entered") GodotMethod!(void, String) _dirEntered; 57 @GodotName("_file_entered") GodotMethod!(void, String) _fileEntered; 58 @GodotName("_action_pressed") GodotMethod!(void) _actionPressed; 59 @GodotName("_cancel_pressed") GodotMethod!(void) _cancelPressed; 60 @GodotName("_filter_selected") GodotMethod!(void, long) _filterSelected; 61 @GodotName("_save_confirm_pressed") GodotMethod!(void) _saveConfirmPressed; 62 @GodotName("clear_filters") GodotMethod!(void) clearFilters; 63 @GodotName("add_filter") GodotMethod!(void, String) addFilter; 64 @GodotName("get_current_dir") GodotMethod!(String) getCurrentDir; 65 @GodotName("get_current_file") GodotMethod!(String) getCurrentFile; 66 @GodotName("get_current_path") GodotMethod!(String) getCurrentPath; 67 @GodotName("set_current_dir") GodotMethod!(void, String) setCurrentDir; 68 @GodotName("set_current_file") GodotMethod!(void, String) setCurrentFile; 69 @GodotName("set_current_path") GodotMethod!(void, String) setCurrentPath; 70 @GodotName("set_mode") GodotMethod!(void, long) setMode; 71 @GodotName("get_mode") GodotMethod!(EditorFileDialog.Mode) getMode; 72 @GodotName("get_vbox") GodotMethod!(VBoxContainer) getVbox; 73 @GodotName("set_access") GodotMethod!(void, long) setAccess; 74 @GodotName("get_access") GodotMethod!(EditorFileDialog.Access) getAccess; 75 @GodotName("set_show_hidden_files") GodotMethod!(void, bool) setShowHiddenFiles; 76 @GodotName("is_showing_hidden_files") GodotMethod!(bool) isShowingHiddenFiles; 77 @GodotName("_select_drive") GodotMethod!(void, long) _selectDrive; 78 @GodotName("_make_dir") GodotMethod!(void) _makeDir; 79 @GodotName("_make_dir_confirm") GodotMethod!(void) _makeDirConfirm; 80 @GodotName("_update_file_list") GodotMethod!(void) _updateFileList; 81 @GodotName("_update_dir") GodotMethod!(void) _updateDir; 82 @GodotName("_thumbnail_done") GodotMethod!(void, String, Texture, Texture, Variant) _thumbnailDone; 83 @GodotName("set_display_mode") GodotMethod!(void, long) setDisplayMode; 84 @GodotName("get_display_mode") GodotMethod!(EditorFileDialog.DisplayMode) getDisplayMode; 85 @GodotName("_thumbnail_result") GodotMethod!(void, String, Texture, Texture, Variant) _thumbnailResult; 86 @GodotName("set_disable_overwrite_warning") GodotMethod!(void, bool) setDisableOverwriteWarning; 87 @GodotName("is_overwrite_warning_disabled") GodotMethod!(bool) isOverwriteWarningDisabled; 88 @GodotName("_recent_selected") GodotMethod!(void, long) _recentSelected; 89 @GodotName("_go_back") GodotMethod!(void) _goBack; 90 @GodotName("_go_forward") GodotMethod!(void) _goForward; 91 @GodotName("_go_up") GodotMethod!(void) _goUp; 92 @GodotName("_favorite_toggled") GodotMethod!(void, bool) _favoriteToggled; 93 @GodotName("_favorite_selected") GodotMethod!(void, long) _favoriteSelected; 94 @GodotName("_favorite_move_up") GodotMethod!(void) _favoriteMoveUp; 95 @GodotName("_favorite_move_down") GodotMethod!(void) _favoriteMoveDown; 96 @GodotName("invalidate") GodotMethod!(void) invalidate; 97 } 98 bool opEquals(in EditorFileDialog other) const { return _godot_object.ptr is other._godot_object.ptr; } 99 EditorFileDialog opAssign(T : typeof(null))(T n) { _godot_object.ptr = null; } 100 bool opEquals(typeof(null) n) const { return _godot_object.ptr is null; } 101 mixin baseCasts; 102 static EditorFileDialog _new() 103 { 104 static godot_class_constructor constructor; 105 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("EditorFileDialog"); 106 if(constructor is null) return typeof(this).init; 107 return cast(EditorFileDialog)(constructor()); 108 } 109 @disable new(size_t s); 110 /// 111 enum DisplayMode : int 112 { 113 /** 114 The `EditorFileDialog` displays resources as thumbnails. 115 */ 116 displayThumbnails = 0, 117 /** 118 The `EditorFileDialog` displays resources as a list of filenames. 119 */ 120 displayList = 1, 121 } 122 /// 123 enum Mode : int 124 { 125 /** 126 The `EditorFileDialog` can select only one file. Accepting the window will open the file. 127 */ 128 modeOpenFile = 0, 129 /** 130 The `EditorFileDialog` can select multiple files. Accepting the window will open all files. 131 */ 132 modeOpenFiles = 1, 133 /** 134 The `EditorFileDialog` can select only one directory. Accepting the window will open the directory. 135 */ 136 modeOpenDir = 2, 137 /** 138 The `EditorFileDialog` can select a file or directory. Accepting the window will open it. 139 */ 140 modeOpenAny = 3, 141 /** 142 The `EditorFileDialog` can select only one file. Accepting the window will save the file. 143 */ 144 modeSaveFile = 4, 145 } 146 /// 147 enum Access : int 148 { 149 /** 150 The `EditorFileDialog` can only view `res://` directory contents. 151 */ 152 accessResources = 0, 153 /** 154 The `EditorFileDialog` can only view `user://` directory contents. 155 */ 156 accessUserdata = 1, 157 /** 158 The `EditorFileDialog` can view the entire local file system. 159 */ 160 accessFilesystem = 2, 161 } 162 /// 163 enum Constants : int 164 { 165 displayThumbnails = 0, 166 accessResources = 0, 167 modeOpenFile = 0, 168 accessUserdata = 1, 169 modeOpenFiles = 1, 170 displayList = 1, 171 accessFilesystem = 2, 172 modeOpenDir = 2, 173 modeOpenAny = 3, 174 modeSaveFile = 4, 175 } 176 /** 177 178 */ 179 void _unhandledInput(InputEvent arg0) 180 { 181 Array _GODOT_args = Array.empty_array; 182 _GODOT_args.append(arg0); 183 String _GODOT_method_name = String("_unhandled_input"); 184 this.callv(_GODOT_method_name, _GODOT_args); 185 } 186 /** 187 188 */ 189 void _itemSelected(in long arg0) 190 { 191 Array _GODOT_args = Array.empty_array; 192 _GODOT_args.append(arg0); 193 String _GODOT_method_name = String("_item_selected"); 194 this.callv(_GODOT_method_name, _GODOT_args); 195 } 196 /** 197 198 */ 199 void _multiSelected(in long arg0, in bool arg1) 200 { 201 Array _GODOT_args = Array.empty_array; 202 _GODOT_args.append(arg0); 203 _GODOT_args.append(arg1); 204 String _GODOT_method_name = String("_multi_selected"); 205 this.callv(_GODOT_method_name, _GODOT_args); 206 } 207 /** 208 209 */ 210 void _itemsClearSelection() 211 { 212 Array _GODOT_args = Array.empty_array; 213 String _GODOT_method_name = String("_items_clear_selection"); 214 this.callv(_GODOT_method_name, _GODOT_args); 215 } 216 /** 217 218 */ 219 void _itemListItemRmbSelected(in long arg0, in Vector2 arg1) 220 { 221 Array _GODOT_args = Array.empty_array; 222 _GODOT_args.append(arg0); 223 _GODOT_args.append(arg1); 224 String _GODOT_method_name = String("_item_list_item_rmb_selected"); 225 this.callv(_GODOT_method_name, _GODOT_args); 226 } 227 /** 228 229 */ 230 void _itemListRmbClicked(in Vector2 arg0) 231 { 232 Array _GODOT_args = Array.empty_array; 233 _GODOT_args.append(arg0); 234 String _GODOT_method_name = String("_item_list_rmb_clicked"); 235 this.callv(_GODOT_method_name, _GODOT_args); 236 } 237 /** 238 239 */ 240 void _itemMenuIdPressed(in long arg0) 241 { 242 Array _GODOT_args = Array.empty_array; 243 _GODOT_args.append(arg0); 244 String _GODOT_method_name = String("_item_menu_id_pressed"); 245 this.callv(_GODOT_method_name, _GODOT_args); 246 } 247 /** 248 249 */ 250 void _itemDbSelected(in long arg0) 251 { 252 Array _GODOT_args = Array.empty_array; 253 _GODOT_args.append(arg0); 254 String _GODOT_method_name = String("_item_db_selected"); 255 this.callv(_GODOT_method_name, _GODOT_args); 256 } 257 /** 258 259 */ 260 void _dirEntered(StringArg0)(in StringArg0 arg0) 261 { 262 Array _GODOT_args = Array.empty_array; 263 _GODOT_args.append(arg0); 264 String _GODOT_method_name = String("_dir_entered"); 265 this.callv(_GODOT_method_name, _GODOT_args); 266 } 267 /** 268 269 */ 270 void _fileEntered(StringArg0)(in StringArg0 arg0) 271 { 272 Array _GODOT_args = Array.empty_array; 273 _GODOT_args.append(arg0); 274 String _GODOT_method_name = String("_file_entered"); 275 this.callv(_GODOT_method_name, _GODOT_args); 276 } 277 /** 278 279 */ 280 void _actionPressed() 281 { 282 Array _GODOT_args = Array.empty_array; 283 String _GODOT_method_name = String("_action_pressed"); 284 this.callv(_GODOT_method_name, _GODOT_args); 285 } 286 /** 287 288 */ 289 void _cancelPressed() 290 { 291 Array _GODOT_args = Array.empty_array; 292 String _GODOT_method_name = String("_cancel_pressed"); 293 this.callv(_GODOT_method_name, _GODOT_args); 294 } 295 /** 296 297 */ 298 void _filterSelected(in long arg0) 299 { 300 Array _GODOT_args = Array.empty_array; 301 _GODOT_args.append(arg0); 302 String _GODOT_method_name = String("_filter_selected"); 303 this.callv(_GODOT_method_name, _GODOT_args); 304 } 305 /** 306 307 */ 308 void _saveConfirmPressed() 309 { 310 Array _GODOT_args = Array.empty_array; 311 String _GODOT_method_name = String("_save_confirm_pressed"); 312 this.callv(_GODOT_method_name, _GODOT_args); 313 } 314 /** 315 Removes all filters except for "All Files (*)". 316 */ 317 void clearFilters() 318 { 319 checkClassBinding!(typeof(this))(); 320 ptrcall!(void)(_classBinding.clearFilters, _godot_object); 321 } 322 /** 323 Adds a comma-delimited file extension filter option to the `EditorFileDialog` with an optional semi-colon-delimited label. 324 Example: "*.tscn, *.scn; Scenes", results in filter text "Scenes (*.tscn, *.scn)". 325 */ 326 void addFilter(StringArg0)(in StringArg0 filter) 327 { 328 checkClassBinding!(typeof(this))(); 329 ptrcall!(void)(_classBinding.addFilter, _godot_object, filter); 330 } 331 /** 332 333 */ 334 String getCurrentDir() const 335 { 336 checkClassBinding!(typeof(this))(); 337 return ptrcall!(String)(_classBinding.getCurrentDir, _godot_object); 338 } 339 /** 340 341 */ 342 String getCurrentFile() const 343 { 344 checkClassBinding!(typeof(this))(); 345 return ptrcall!(String)(_classBinding.getCurrentFile, _godot_object); 346 } 347 /** 348 349 */ 350 String getCurrentPath() const 351 { 352 checkClassBinding!(typeof(this))(); 353 return ptrcall!(String)(_classBinding.getCurrentPath, _godot_object); 354 } 355 /** 356 357 */ 358 void setCurrentDir(StringArg0)(in StringArg0 dir) 359 { 360 checkClassBinding!(typeof(this))(); 361 ptrcall!(void)(_classBinding.setCurrentDir, _godot_object, dir); 362 } 363 /** 364 365 */ 366 void setCurrentFile(StringArg0)(in StringArg0 file) 367 { 368 checkClassBinding!(typeof(this))(); 369 ptrcall!(void)(_classBinding.setCurrentFile, _godot_object, file); 370 } 371 /** 372 373 */ 374 void setCurrentPath(StringArg0)(in StringArg0 path) 375 { 376 checkClassBinding!(typeof(this))(); 377 ptrcall!(void)(_classBinding.setCurrentPath, _godot_object, path); 378 } 379 /** 380 381 */ 382 void setMode(in long mode) 383 { 384 checkClassBinding!(typeof(this))(); 385 ptrcall!(void)(_classBinding.setMode, _godot_object, mode); 386 } 387 /** 388 389 */ 390 EditorFileDialog.Mode getMode() const 391 { 392 checkClassBinding!(typeof(this))(); 393 return ptrcall!(EditorFileDialog.Mode)(_classBinding.getMode, _godot_object); 394 } 395 /** 396 Returns the `VBoxContainer` used to display the file system. 397 */ 398 VBoxContainer getVbox() 399 { 400 checkClassBinding!(typeof(this))(); 401 return ptrcall!(VBoxContainer)(_classBinding.getVbox, _godot_object); 402 } 403 /** 404 405 */ 406 void setAccess(in long access) 407 { 408 checkClassBinding!(typeof(this))(); 409 ptrcall!(void)(_classBinding.setAccess, _godot_object, access); 410 } 411 /** 412 413 */ 414 EditorFileDialog.Access getAccess() const 415 { 416 checkClassBinding!(typeof(this))(); 417 return ptrcall!(EditorFileDialog.Access)(_classBinding.getAccess, _godot_object); 418 } 419 /** 420 421 */ 422 void setShowHiddenFiles(in bool show) 423 { 424 checkClassBinding!(typeof(this))(); 425 ptrcall!(void)(_classBinding.setShowHiddenFiles, _godot_object, show); 426 } 427 /** 428 429 */ 430 bool isShowingHiddenFiles() const 431 { 432 checkClassBinding!(typeof(this))(); 433 return ptrcall!(bool)(_classBinding.isShowingHiddenFiles, _godot_object); 434 } 435 /** 436 437 */ 438 void _selectDrive(in long arg0) 439 { 440 Array _GODOT_args = Array.empty_array; 441 _GODOT_args.append(arg0); 442 String _GODOT_method_name = String("_select_drive"); 443 this.callv(_GODOT_method_name, _GODOT_args); 444 } 445 /** 446 447 */ 448 void _makeDir() 449 { 450 Array _GODOT_args = Array.empty_array; 451 String _GODOT_method_name = String("_make_dir"); 452 this.callv(_GODOT_method_name, _GODOT_args); 453 } 454 /** 455 456 */ 457 void _makeDirConfirm() 458 { 459 Array _GODOT_args = Array.empty_array; 460 String _GODOT_method_name = String("_make_dir_confirm"); 461 this.callv(_GODOT_method_name, _GODOT_args); 462 } 463 /** 464 465 */ 466 void _updateFileList() 467 { 468 Array _GODOT_args = Array.empty_array; 469 String _GODOT_method_name = String("_update_file_list"); 470 this.callv(_GODOT_method_name, _GODOT_args); 471 } 472 /** 473 474 */ 475 void _updateDir() 476 { 477 Array _GODOT_args = Array.empty_array; 478 String _GODOT_method_name = String("_update_dir"); 479 this.callv(_GODOT_method_name, _GODOT_args); 480 } 481 /** 482 483 */ 484 void _thumbnailDone(StringArg0, VariantArg3)(in StringArg0 arg0, Texture arg1, Texture arg2, in VariantArg3 arg3) 485 { 486 Array _GODOT_args = Array.empty_array; 487 _GODOT_args.append(arg0); 488 _GODOT_args.append(arg1); 489 _GODOT_args.append(arg2); 490 _GODOT_args.append(arg3); 491 String _GODOT_method_name = String("_thumbnail_done"); 492 this.callv(_GODOT_method_name, _GODOT_args); 493 } 494 /** 495 496 */ 497 void setDisplayMode(in long mode) 498 { 499 checkClassBinding!(typeof(this))(); 500 ptrcall!(void)(_classBinding.setDisplayMode, _godot_object, mode); 501 } 502 /** 503 504 */ 505 EditorFileDialog.DisplayMode getDisplayMode() const 506 { 507 checkClassBinding!(typeof(this))(); 508 return ptrcall!(EditorFileDialog.DisplayMode)(_classBinding.getDisplayMode, _godot_object); 509 } 510 /** 511 512 */ 513 void _thumbnailResult(StringArg0, VariantArg3)(in StringArg0 arg0, Texture arg1, Texture arg2, in VariantArg3 arg3) 514 { 515 Array _GODOT_args = Array.empty_array; 516 _GODOT_args.append(arg0); 517 _GODOT_args.append(arg1); 518 _GODOT_args.append(arg2); 519 _GODOT_args.append(arg3); 520 String _GODOT_method_name = String("_thumbnail_result"); 521 this.callv(_GODOT_method_name, _GODOT_args); 522 } 523 /** 524 525 */ 526 void setDisableOverwriteWarning(in bool disable) 527 { 528 checkClassBinding!(typeof(this))(); 529 ptrcall!(void)(_classBinding.setDisableOverwriteWarning, _godot_object, disable); 530 } 531 /** 532 533 */ 534 bool isOverwriteWarningDisabled() const 535 { 536 checkClassBinding!(typeof(this))(); 537 return ptrcall!(bool)(_classBinding.isOverwriteWarningDisabled, _godot_object); 538 } 539 /** 540 541 */ 542 void _recentSelected(in long arg0) 543 { 544 Array _GODOT_args = Array.empty_array; 545 _GODOT_args.append(arg0); 546 String _GODOT_method_name = String("_recent_selected"); 547 this.callv(_GODOT_method_name, _GODOT_args); 548 } 549 /** 550 551 */ 552 void _goBack() 553 { 554 Array _GODOT_args = Array.empty_array; 555 String _GODOT_method_name = String("_go_back"); 556 this.callv(_GODOT_method_name, _GODOT_args); 557 } 558 /** 559 560 */ 561 void _goForward() 562 { 563 Array _GODOT_args = Array.empty_array; 564 String _GODOT_method_name = String("_go_forward"); 565 this.callv(_GODOT_method_name, _GODOT_args); 566 } 567 /** 568 569 */ 570 void _goUp() 571 { 572 Array _GODOT_args = Array.empty_array; 573 String _GODOT_method_name = String("_go_up"); 574 this.callv(_GODOT_method_name, _GODOT_args); 575 } 576 /** 577 578 */ 579 void _favoriteToggled(in bool arg0) 580 { 581 Array _GODOT_args = Array.empty_array; 582 _GODOT_args.append(arg0); 583 String _GODOT_method_name = String("_favorite_toggled"); 584 this.callv(_GODOT_method_name, _GODOT_args); 585 } 586 /** 587 588 */ 589 void _favoriteSelected(in long arg0) 590 { 591 Array _GODOT_args = Array.empty_array; 592 _GODOT_args.append(arg0); 593 String _GODOT_method_name = String("_favorite_selected"); 594 this.callv(_GODOT_method_name, _GODOT_args); 595 } 596 /** 597 598 */ 599 void _favoriteMoveUp() 600 { 601 Array _GODOT_args = Array.empty_array; 602 String _GODOT_method_name = String("_favorite_move_up"); 603 this.callv(_GODOT_method_name, _GODOT_args); 604 } 605 /** 606 607 */ 608 void _favoriteMoveDown() 609 { 610 Array _GODOT_args = Array.empty_array; 611 String _GODOT_method_name = String("_favorite_move_down"); 612 this.callv(_GODOT_method_name, _GODOT_args); 613 } 614 /** 615 Notify the `EditorFileDialog` that its view of the data is no longer accurate. Updates the view contents on next view update. 616 */ 617 void invalidate() 618 { 619 checkClassBinding!(typeof(this))(); 620 ptrcall!(void)(_classBinding.invalidate, _godot_object); 621 } 622 /** 623 The location from which the user may select a file, including `res://`, `user://`, and the local file system. 624 */ 625 @property EditorFileDialog.Access access() 626 { 627 return getAccess(); 628 } 629 /// ditto 630 @property void access(long v) 631 { 632 setAccess(v); 633 } 634 /** 635 The view format in which the `EditorFileDialog` displays resources to the user. 636 */ 637 @property EditorFileDialog.DisplayMode displayMode() 638 { 639 return getDisplayMode(); 640 } 641 /// ditto 642 @property void displayMode(long v) 643 { 644 setDisplayMode(v); 645 } 646 /** 647 The purpose of the `EditorFileDialog`. Changes allowed behaviors. 648 */ 649 @property EditorFileDialog.Mode mode() 650 { 651 return getMode(); 652 } 653 /// ditto 654 @property void mode(long v) 655 { 656 setMode(v); 657 } 658 /** 659 The currently occupied directory. 660 */ 661 @property String currentDir() 662 { 663 return getCurrentDir(); 664 } 665 /// ditto 666 @property void currentDir(String v) 667 { 668 setCurrentDir(v); 669 } 670 /** 671 The currently selected file. 672 */ 673 @property String currentFile() 674 { 675 return getCurrentFile(); 676 } 677 /// ditto 678 @property void currentFile(String v) 679 { 680 setCurrentFile(v); 681 } 682 /** 683 The file system path in the address bar. 684 */ 685 @property String currentPath() 686 { 687 return getCurrentPath(); 688 } 689 /// ditto 690 @property void currentPath(String v) 691 { 692 setCurrentPath(v); 693 } 694 /** 695 If `true` hidden files and directories will be visible in the `EditorFileDialog`. 696 */ 697 @property bool showHiddenFiles() 698 { 699 return isShowingHiddenFiles(); 700 } 701 /// ditto 702 @property void showHiddenFiles(bool v) 703 { 704 setShowHiddenFiles(v); 705 } 706 /** 707 If `true` the `EditorFileDialog` will not warn the user before overwriting files. 708 */ 709 @property bool disableOverwriteWarning() 710 { 711 return isOverwriteWarningDisabled(); 712 } 713 /// ditto 714 @property void disableOverwriteWarning(bool v) 715 { 716 setDisableOverwriteWarning(v); 717 } 718 }