class_filedialog.rst 11 KB

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