class_filedialog.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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:`StringArray<class_stringarray>` | :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:`StringArray<class_stringarray>` 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:`StringArray<class_stringarray>` paths **)**
  57. Event emitted when the user selects multiple files.
  58. Numeric Constants
  59. -----------------
  60. - **MODE_OPEN_FILE** = **0** --- The dialog allows the selection of one, and only one file.
  61. - **MODE_OPEN_FILES** = **1** --- The dialog allows the selection of multiple files.
  62. - **MODE_OPEN_DIR** = **2** --- The dialog functions as a folder selector, disallowing the selection of any file.
  63. - **MODE_OPEN_ANY** = **3** --- The dialog allows the selection of a file or a directory.
  64. - **MODE_SAVE_FILE** = **4** --- The dialog will warn when a file exists.
  65. - **ACCESS_RESOURCES** = **0** --- The dialog allows the selection of file and directory.
  66. - **ACCESS_USERDATA** = **1** --- The dialog allows ascess files under :ref:`Resource<class_resource>` path(res://) .
  67. - **ACCESS_FILESYSTEM** = **2** --- The dialog allows ascess files in whole file system.
  68. Description
  69. -----------
  70. FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks.
  71. Member Function Description
  72. ---------------------------
  73. .. _class_FileDialog_add_filter:
  74. - void **add_filter** **(** :ref:`String<class_string>` filter **)**
  75. Add a custom filter. Filter format is: "mask ; description", example (C++): dialog->add_filter("\*.png ; PNG Images");
  76. .. _class_FileDialog_clear_filters:
  77. - void **clear_filters** **(** **)**
  78. Clear all the added filters in the dialog.
  79. .. _class_FileDialog_get_access:
  80. - :ref:`int<class_int>` **get_access** **(** **)** const
  81. Return the file access permission of the dialog.
  82. .. _class_FileDialog_get_current_dir:
  83. - :ref:`String<class_string>` **get_current_dir** **(** **)** const
  84. Get the current working directory of the file dialog.
  85. .. _class_FileDialog_get_current_file:
  86. - :ref:`String<class_string>` **get_current_file** **(** **)** const
  87. Get the current selected file of the file dialog (empty if none).
  88. .. _class_FileDialog_get_current_path:
  89. - :ref:`String<class_string>` **get_current_path** **(** **)** const
  90. Get the current selected path (directory and file) of the file dialog (empty if none).
  91. .. _class_FileDialog_get_filters:
  92. - :ref:`StringArray<class_stringarray>` **get_filters** **(** **)** const
  93. .. _class_FileDialog_get_mode:
  94. - :ref:`int<class_int>` **get_mode** **(** **)** const
  95. Get the file dialog mode from the MODE\_\* enum.
  96. .. _class_FileDialog_get_vbox:
  97. - :ref:`VBoxContainer<class_vboxcontainer>` **get_vbox** **(** **)**
  98. Return the vertical box container of the dialog, custom controls can be added to it.
  99. .. _class_FileDialog_invalidate:
  100. - void **invalidate** **(** **)**
  101. Invalidate and update the current dialog content list.
  102. .. _class_FileDialog_is_showing_hidden_files:
  103. - :ref:`bool<class_bool>` **is_showing_hidden_files** **(** **)** const
  104. Return true if the diaog allows show hidden files.
  105. .. _class_FileDialog_set_access:
  106. - void **set_access** **(** :ref:`int<class_int>` access **)**
  107. Set the file access permission of the dialog(Must be one of ACCESS_RESOURCES, ACCESS_USERDATA or ACCESS_FILESYSTEM).
  108. .. _class_FileDialog_set_current_dir:
  109. - void **set_current_dir** **(** :ref:`String<class_string>` dir **)**
  110. Set the current working directory of the file dialog.
  111. .. _class_FileDialog_set_current_file:
  112. - void **set_current_file** **(** :ref:`String<class_string>` file **)**
  113. Set the current selected file name of the file dialog.
  114. .. _class_FileDialog_set_current_path:
  115. - void **set_current_path** **(** :ref:`String<class_string>` path **)**
  116. Set the current selected file path of the file dialog.
  117. .. _class_FileDialog_set_filters:
  118. - void **set_filters** **(** :ref:`StringArray<class_stringarray>` filters **)**
  119. .. _class_FileDialog_set_mode:
  120. - void **set_mode** **(** :ref:`int<class_int>` mode **)**
  121. Set the file dialog mode from the MODE\_\* enum.
  122. .. _class_FileDialog_set_show_hidden_files:
  123. - void **set_show_hidden_files** **(** :ref:`bool<class_bool>` show **)**
  124. Set the dialog should show hidden files.