class_filedialog.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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. Properties
  13. ----------
  14. +-----------------------------------------------+-----------------------------------------------------------------------------+
  15. | :ref:`Access<enum_FileDialog_Access>` | :ref:`access<class_FileDialog_property_access>` |
  16. +-----------------------------------------------+-----------------------------------------------------------------------------+
  17. | :ref:`String<class_String>` | :ref:`current_dir<class_FileDialog_property_current_dir>` |
  18. +-----------------------------------------------+-----------------------------------------------------------------------------+
  19. | :ref:`String<class_String>` | :ref:`current_file<class_FileDialog_property_current_file>` |
  20. +-----------------------------------------------+-----------------------------------------------------------------------------+
  21. | :ref:`String<class_String>` | :ref:`current_path<class_FileDialog_property_current_path>` |
  22. +-----------------------------------------------+-----------------------------------------------------------------------------+
  23. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`filters<class_FileDialog_property_filters>` |
  24. +-----------------------------------------------+-----------------------------------------------------------------------------+
  25. | :ref:`Mode<enum_FileDialog_Mode>` | :ref:`mode<class_FileDialog_property_mode>` |
  26. +-----------------------------------------------+-----------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`mode_overrides_title<class_FileDialog_property_mode_overrides_title>` |
  28. +-----------------------------------------------+-----------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`show_hidden_files<class_FileDialog_property_show_hidden_files>` |
  30. +-----------------------------------------------+-----------------------------------------------------------------------------+
  31. Methods
  32. -------
  33. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`add_filter<class_FileDialog_method_add_filter>` **(** :ref:`String<class_String>` filter **)** |
  35. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`clear_filters<class_FileDialog_method_clear_filters>` **(** **)** |
  37. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`deselect_items<class_FileDialog_method_deselect_items>` **(** **)** |
  39. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  40. | :ref:`LineEdit<class_LineEdit>` | :ref:`get_line_edit<class_FileDialog_method_get_line_edit>` **(** **)** |
  41. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  42. | :ref:`VBoxContainer<class_VBoxContainer>` | :ref:`get_vbox<class_FileDialog_method_get_vbox>` **(** **)** |
  43. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`invalidate<class_FileDialog_method_invalidate>` **(** **)** |
  45. +-------------------------------------------+------------------------------------------------------------------------------------------------------+
  46. Theme Properties
  47. ----------------
  48. +-------------------------------+----------------+
  49. | :ref:`Color<class_Color>` | files_disabled |
  50. +-------------------------------+----------------+
  51. | :ref:`Texture<class_Texture>` | folder |
  52. +-------------------------------+----------------+
  53. | :ref:`Texture<class_Texture>` | parent_folder |
  54. +-------------------------------+----------------+
  55. | :ref:`Texture<class_Texture>` | reload |
  56. +-------------------------------+----------------+
  57. Signals
  58. -------
  59. .. _class_FileDialog_signal_dir_selected:
  60. - **dir_selected** **(** :ref:`String<class_String>` dir **)**
  61. Event emitted when the user selects a directory.
  62. .. _class_FileDialog_signal_file_selected:
  63. - **file_selected** **(** :ref:`String<class_String>` path **)**
  64. Event emitted when the user selects a file (double clicks it or presses the OK button).
  65. .. _class_FileDialog_signal_files_selected:
  66. - **files_selected** **(** :ref:`PoolStringArray<class_PoolStringArray>` paths **)**
  67. Event emitted when the user selects multiple files.
  68. Enumerations
  69. ------------
  70. .. _enum_FileDialog_Mode:
  71. .. _class_FileDialog_constant_MODE_OPEN_FILE:
  72. .. _class_FileDialog_constant_MODE_OPEN_FILES:
  73. .. _class_FileDialog_constant_MODE_OPEN_DIR:
  74. .. _class_FileDialog_constant_MODE_OPEN_ANY:
  75. .. _class_FileDialog_constant_MODE_SAVE_FILE:
  76. enum **Mode**:
  77. - **MODE_OPEN_FILE** = **0** --- The dialog allows the selection of one, and only one file.
  78. - **MODE_OPEN_FILES** = **1** --- The dialog allows the selection of multiple files.
  79. - **MODE_OPEN_DIR** = **2** --- The dialog functions as a folder selector, disallowing the selection of any file.
  80. - **MODE_OPEN_ANY** = **3** --- The dialog allows the selection of a file or a directory.
  81. - **MODE_SAVE_FILE** = **4** --- The dialog will warn when a file exists.
  82. .. _enum_FileDialog_Access:
  83. .. _class_FileDialog_constant_ACCESS_RESOURCES:
  84. .. _class_FileDialog_constant_ACCESS_USERDATA:
  85. .. _class_FileDialog_constant_ACCESS_FILESYSTEM:
  86. enum **Access**:
  87. - **ACCESS_RESOURCES** = **0** --- The dialog allows the selection of file and directory.
  88. - **ACCESS_USERDATA** = **1** --- The dialog allows access files under :ref:`Resource<class_Resource>` path(res://) .
  89. - **ACCESS_FILESYSTEM** = **2** --- The dialog allows access files in whole file system.
  90. Description
  91. -----------
  92. FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks.
  93. Property Descriptions
  94. ---------------------
  95. .. _class_FileDialog_property_access:
  96. - :ref:`Access<enum_FileDialog_Access>` **access**
  97. +----------+-------------------+
  98. | *Setter* | set_access(value) |
  99. +----------+-------------------+
  100. | *Getter* | get_access() |
  101. +----------+-------------------+
  102. The file system access scope. See enum ``Access`` constants.
  103. .. _class_FileDialog_property_current_dir:
  104. - :ref:`String<class_String>` **current_dir**
  105. +----------+------------------------+
  106. | *Setter* | set_current_dir(value) |
  107. +----------+------------------------+
  108. | *Getter* | get_current_dir() |
  109. +----------+------------------------+
  110. The current working directory of the file dialog.
  111. .. _class_FileDialog_property_current_file:
  112. - :ref:`String<class_String>` **current_file**
  113. +----------+-------------------------+
  114. | *Setter* | set_current_file(value) |
  115. +----------+-------------------------+
  116. | *Getter* | get_current_file() |
  117. +----------+-------------------------+
  118. The currently selected file of the file dialog.
  119. .. _class_FileDialog_property_current_path:
  120. - :ref:`String<class_String>` **current_path**
  121. +----------+-------------------------+
  122. | *Setter* | set_current_path(value) |
  123. +----------+-------------------------+
  124. | *Getter* | get_current_path() |
  125. +----------+-------------------------+
  126. The currently selected file path of the file dialog.
  127. .. _class_FileDialog_property_filters:
  128. - :ref:`PoolStringArray<class_PoolStringArray>` **filters**
  129. +----------+--------------------+
  130. | *Setter* | set_filters(value) |
  131. +----------+--------------------+
  132. | *Getter* | get_filters() |
  133. +----------+--------------------+
  134. Set file type filters. This example shows only .png and .gd files ``set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GD Script"]))``.
  135. .. _class_FileDialog_property_mode:
  136. - :ref:`Mode<enum_FileDialog_Mode>` **mode**
  137. +----------+-----------------+
  138. | *Setter* | set_mode(value) |
  139. +----------+-----------------+
  140. | *Getter* | get_mode() |
  141. +----------+-----------------+
  142. Set dialog to open or save mode, changes selection behavior. See enum ``Mode`` constants.
  143. .. _class_FileDialog_property_mode_overrides_title:
  144. - :ref:`bool<class_bool>` **mode_overrides_title**
  145. +----------+---------------------------------+
  146. | *Setter* | set_mode_overrides_title(value) |
  147. +----------+---------------------------------+
  148. | *Getter* | is_mode_overriding_title() |
  149. +----------+---------------------------------+
  150. If ``true``, changing the ``Mode`` property will set the window title accordingly (e.g. setting mode to ``MODE_OPEN_FILE`` will change the window title to "Open a File").
  151. .. _class_FileDialog_property_show_hidden_files:
  152. - :ref:`bool<class_bool>` **show_hidden_files**
  153. +----------+------------------------------+
  154. | *Setter* | set_show_hidden_files(value) |
  155. +----------+------------------------------+
  156. | *Getter* | is_showing_hidden_files() |
  157. +----------+------------------------------+
  158. If ``true``, the dialog will show hidden files.
  159. Method Descriptions
  160. -------------------
  161. .. _class_FileDialog_method_add_filter:
  162. - void **add_filter** **(** :ref:`String<class_String>` filter **)**
  163. Add a custom filter. Example: ``add_filter("*.png ; PNG Images")``
  164. .. _class_FileDialog_method_clear_filters:
  165. - void **clear_filters** **(** **)**
  166. Clear all the added filters in the dialog.
  167. .. _class_FileDialog_method_deselect_items:
  168. - void **deselect_items** **(** **)**
  169. Clear currently selected items in the dialog.
  170. .. _class_FileDialog_method_get_line_edit:
  171. - :ref:`LineEdit<class_LineEdit>` **get_line_edit** **(** **)**
  172. Returns the LineEdit for the selected file.
  173. .. _class_FileDialog_method_get_vbox:
  174. - :ref:`VBoxContainer<class_VBoxContainer>` **get_vbox** **(** **)**
  175. Return the vertical box container of the dialog, custom controls can be added to it.
  176. .. _class_FileDialog_method_invalidate:
  177. - void **invalidate** **(** **)**
  178. Invalidate and update the current dialog content list.