class_filedialog.rst 11 KB

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