class_filedialog.rst 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_FileDialog:
  4. FileDialog
  5. ==========
  6. **Inherits:** :ref:`ConfirmationDialog<class_confirmationdialog>` **<** :ref:`AcceptDialog<class_acceptdialog>` **<** :ref:`WindowDialog<class_windowdialog>` **<** :ref:`Popup<class_popup>` **<** :ref:`Control<class_control>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Dialog for selecting files or directories in the filesystem.
  11. Member Functions
  12. ----------------
  13. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`clear_filters<class_FileDialog_clear_filters>` **(** **)** |
  15. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`add_filter<class_FileDialog_add_filter>` **(** :ref:`String<class_string>` filter **)** |
  17. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  18. | :ref:`String<class_string>` | :ref:`get_current_dir<class_FileDialog_get_current_dir>` **(** **)** const |
  19. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  20. | :ref:`String<class_string>` | :ref:`get_current_file<class_FileDialog_get_current_file>` **(** **)** const |
  21. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  22. | :ref:`String<class_string>` | :ref:`get_current_path<class_FileDialog_get_current_path>` **(** **)** const |
  23. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`set_current_dir<class_FileDialog_set_current_dir>` **(** :ref:`String<class_string>` dir **)** |
  25. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`set_current_file<class_FileDialog_set_current_file>` **(** :ref:`String<class_string>` file **)** |
  27. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  28. | void | :ref:`set_current_path<class_FileDialog_set_current_path>` **(** :ref:`String<class_string>` path **)** |
  29. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`set_mode<class_FileDialog_set_mode>` **(** :ref:`int<class_int>` mode **)** |
  31. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`get_mode<class_FileDialog_get_mode>` **(** **)** const |
  33. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  34. | :ref:`VBoxContainer<class_vboxcontainer>` | :ref:`get_vbox<class_FileDialog_get_vbox>` **(** **)** |
  35. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`set_access<class_FileDialog_set_access>` **(** :ref:`int<class_int>` access **)** |
  37. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`get_access<class_FileDialog_get_access>` **(** **)** const |
  39. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`set_show_hidden_files<class_FileDialog_set_show_hidden_files>` **(** :ref:`bool<class_bool>` show **)** |
  41. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  42. | :ref:`bool<class_bool>` | :ref:`is_showing_hidden_files<class_FileDialog_is_showing_hidden_files>` **(** **)** const |
  43. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`invalidate<class_FileDialog_invalidate>` **(** **)** |
  45. +--------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  46. Signals
  47. -------
  48. - **files_selected** **(** :ref:`StringArray<class_stringarray>` paths **)**
  49. - **dir_selected** **(** :ref:`String<class_string>` dir **)**
  50. - **file_selected** **(** :ref:`String<class_string>` path **)**
  51. Numeric Constants
  52. -----------------
  53. - **MODE_OPEN_FILE** = **0** --- The dialog allows the selection of one, and only one file.
  54. - **MODE_OPEN_FILES** = **1** --- The dialog allows the selection of multiple files.
  55. - **MODE_OPEN_DIR** = **2** --- The dialog functions as a folder selector, disallowing the selection of any file.
  56. - **MODE_SAVE_FILE** = **3** --- The dialog will warn when a file exists.
  57. - **ACCESS_RESOURCES** = **0** --- The dialog allows the selection of file and directory.
  58. - **ACCESS_USERDATA** = **1** --- The dialog allows ascess files under :ref:`Resource<class_resource>` path(res://) .
  59. - **ACCESS_FILESYSTEM** = **2** --- The dialog allows ascess files in whole file system.
  60. Description
  61. -----------
  62. FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks.
  63. Member Function Description
  64. ---------------------------
  65. .. _class_FileDialog_clear_filters:
  66. - void **clear_filters** **(** **)**
  67. Clear all the added filters in the dialog.
  68. .. _class_FileDialog_add_filter:
  69. - void **add_filter** **(** :ref:`String<class_string>` filter **)**
  70. Add a custom filter. Filter format is: "mask ; description", example (C++): dialog->add_filter("\*.png ; PNG Images");
  71. .. _class_FileDialog_get_current_dir:
  72. - :ref:`String<class_string>` **get_current_dir** **(** **)** const
  73. Get the current working directory of the file dialog.
  74. .. _class_FileDialog_get_current_file:
  75. - :ref:`String<class_string>` **get_current_file** **(** **)** const
  76. Get the current selected file of the file dialog (empty if none).
  77. .. _class_FileDialog_get_current_path:
  78. - :ref:`String<class_string>` **get_current_path** **(** **)** const
  79. Get the current selected path (directory and file) of the file dialog (empty if none).
  80. .. _class_FileDialog_set_current_dir:
  81. - void **set_current_dir** **(** :ref:`String<class_string>` dir **)**
  82. Set the current working directory of the file dialog.
  83. .. _class_FileDialog_set_current_file:
  84. - void **set_current_file** **(** :ref:`String<class_string>` file **)**
  85. Set the current selected file name of the file dialog.
  86. .. _class_FileDialog_set_current_path:
  87. - void **set_current_path** **(** :ref:`String<class_string>` path **)**
  88. Set the current selected file path of the file dialog.
  89. .. _class_FileDialog_set_mode:
  90. - void **set_mode** **(** :ref:`int<class_int>` mode **)**
  91. Set the file dialog mode from the MODE\_\* enum.
  92. .. _class_FileDialog_get_mode:
  93. - :ref:`int<class_int>` **get_mode** **(** **)** const
  94. Get the file dialog mode from the MODE\_\* enum.
  95. .. _class_FileDialog_get_vbox:
  96. - :ref:`VBoxContainer<class_vboxcontainer>` **get_vbox** **(** **)**
  97. Return the vertical box container of the dialog, custom controls can be added to it.
  98. .. _class_FileDialog_set_access:
  99. - void **set_access** **(** :ref:`int<class_int>` access **)**
  100. Set the file access permission of the dialog(Must be one of :ref:`ACCESS_RESOURCES<class_access_resources>`, :ref:`ACCESS_USERDATA<class_access_userdata>` or :ref:`ACCESS_FILESYSTEM<class_access_filesystem>`).
  101. .. _class_FileDialog_get_access:
  102. - :ref:`int<class_int>` **get_access** **(** **)** const
  103. Return the file access permission of the dialog.
  104. .. _class_FileDialog_set_show_hidden_files:
  105. - void **set_show_hidden_files** **(** :ref:`bool<class_bool>` show **)**
  106. Set the dialog should show hidden files.
  107. .. _class_FileDialog_is_showing_hidden_files:
  108. - :ref:`bool<class_bool>` **is_showing_hidden_files** **(** **)** const
  109. Return true if the diaog allows show hidden files.
  110. .. _class_FileDialog_invalidate:
  111. - void **invalidate** **(** **)**
  112. Invalidate and update the current dialog content list.