FileDialog.xml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="FileDialog" inherits="ConfirmationDialog" version="3.3">
  3. <brief_description>
  4. Dialog for selecting files or directories in the filesystem.
  5. </brief_description>
  6. <description>
  7. FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks. The FileDialog automatically sets its window title according to the [member mode]. If you want to use a custom title, disable this by setting [member mode_overrides_title] to [code]false[/code].
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="add_filter">
  13. <return type="void">
  14. </return>
  15. <argument index="0" name="filter" type="String">
  16. </argument>
  17. <description>
  18. Adds [code]filter[/code] as a custom filter; [code]filter[/code] should be of the form [code]"filename.extension ; Description"[/code]. For example, [code]"*.png ; PNG Images"[/code].
  19. </description>
  20. </method>
  21. <method name="clear_filters">
  22. <return type="void">
  23. </return>
  24. <description>
  25. Clear all the added filters in the dialog.
  26. </description>
  27. </method>
  28. <method name="deselect_items">
  29. <return type="void">
  30. </return>
  31. <description>
  32. Clear currently selected items in the dialog.
  33. </description>
  34. </method>
  35. <method name="get_line_edit">
  36. <return type="LineEdit">
  37. </return>
  38. <description>
  39. Returns the LineEdit for the selected file.
  40. </description>
  41. </method>
  42. <method name="get_vbox">
  43. <return type="VBoxContainer">
  44. </return>
  45. <description>
  46. Returns the vertical box container of the dialog, custom controls can be added to it.
  47. </description>
  48. </method>
  49. <method name="invalidate">
  50. <return type="void">
  51. </return>
  52. <description>
  53. Invalidate and update the current dialog content list.
  54. </description>
  55. </method>
  56. </methods>
  57. <members>
  58. <member name="access" type="int" setter="set_access" getter="get_access" enum="FileDialog.Access" default="0">
  59. The file system access scope. See enum [code]Access[/code] constants.
  60. [b]Warning:[/b] Currently, in sandboxed environments such as HTML5 builds or sandboxed macOS apps, FileDialog cannot access the host file system. See [url=https://github.com/godotengine/godot-proposals/issues/1123]godot-proposals#1123[/url].
  61. </member>
  62. <member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir" default="&quot;res://&quot;">
  63. The current working directory of the file dialog.
  64. </member>
  65. <member name="current_file" type="String" setter="set_current_file" getter="get_current_file" default="&quot;&quot;">
  66. The currently selected file of the file dialog.
  67. </member>
  68. <member name="current_path" type="String" setter="set_current_path" getter="get_current_path" default="&quot;res://&quot;">
  69. The currently selected file path of the file dialog.
  70. </member>
  71. <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" />
  72. <member name="filters" type="PoolStringArray" setter="set_filters" getter="get_filters" default="PoolStringArray( )">
  73. The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PoolStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code].
  74. </member>
  75. <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="FileDialog.Mode" default="4">
  76. The dialog's open or save mode, which affects the selection behavior. See enum [code]Mode[/code] constants.
  77. </member>
  78. <member name="mode_overrides_title" type="bool" setter="set_mode_overrides_title" getter="is_mode_overriding_title" default="true">
  79. If [code]true[/code], changing the [code]Mode[/code] property will set the window title accordingly (e.g. setting mode to [constant MODE_OPEN_FILE] will change the window title to "Open a File").
  80. </member>
  81. <member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false">
  82. If [code]true[/code], the dialog will show hidden files.
  83. </member>
  84. <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Save a File&quot;" />
  85. </members>
  86. <signals>
  87. <signal name="dir_selected">
  88. <argument index="0" name="dir" type="String">
  89. </argument>
  90. <description>
  91. Emitted when the user selects a directory.
  92. </description>
  93. </signal>
  94. <signal name="file_selected">
  95. <argument index="0" name="path" type="String">
  96. </argument>
  97. <description>
  98. Emitted when the user selects a file by double-clicking it or pressing the [b]OK[/b] button.
  99. </description>
  100. </signal>
  101. <signal name="files_selected">
  102. <argument index="0" name="paths" type="PoolStringArray">
  103. </argument>
  104. <description>
  105. Emitted when the user selects multiple files.
  106. </description>
  107. </signal>
  108. </signals>
  109. <constants>
  110. <constant name="MODE_OPEN_FILE" value="0" enum="Mode">
  111. The dialog allows selecting one, and only one file.
  112. </constant>
  113. <constant name="MODE_OPEN_FILES" value="1" enum="Mode">
  114. The dialog allows selecting multiple files.
  115. </constant>
  116. <constant name="MODE_OPEN_DIR" value="2" enum="Mode">
  117. The dialog only allows selecting a directory, disallowing the selection of any file.
  118. </constant>
  119. <constant name="MODE_OPEN_ANY" value="3" enum="Mode">
  120. The dialog allows selecting one file or directory.
  121. </constant>
  122. <constant name="MODE_SAVE_FILE" value="4" enum="Mode">
  123. The dialog will warn when a file exists.
  124. </constant>
  125. <constant name="ACCESS_RESOURCES" value="0" enum="Access">
  126. The dialog only allows accessing files under the [Resource] path ([code]res://[/code]).
  127. </constant>
  128. <constant name="ACCESS_USERDATA" value="1" enum="Access">
  129. The dialog only allows accessing files under user data path ([code]user://[/code]).
  130. </constant>
  131. <constant name="ACCESS_FILESYSTEM" value="2" enum="Access">
  132. The dialog allows accessing files on the whole file system.
  133. </constant>
  134. </constants>
  135. <theme_items>
  136. <theme_item name="file" type="Texture">
  137. Custom icon for files.
  138. </theme_item>
  139. <theme_item name="file_icon_modulate" type="Color" default="Color( 1, 1, 1, 1 )">
  140. The color modulation applied to the file icon.
  141. </theme_item>
  142. <theme_item name="files_disabled" type="Color" default="Color( 0, 0, 0, 0.7 )">
  143. The color tint for disabled files (when the [FileDialog] is used in open folder mode).
  144. </theme_item>
  145. <theme_item name="folder" type="Texture">
  146. Custom icon for folders.
  147. </theme_item>
  148. <theme_item name="folder_icon_modulate" type="Color" default="Color( 1, 1, 1, 1 )">
  149. The color modulation applied to the folder icon.
  150. </theme_item>
  151. <theme_item name="parent_folder" type="Texture">
  152. Custom icon for the parent folder arrow.
  153. </theme_item>
  154. <theme_item name="reload" type="Texture">
  155. Custom icon for the reload button.
  156. </theme_item>
  157. <theme_item name="toggle_hidden" type="Texture">
  158. Custom icon for the toggle hidden button.
  159. </theme_item>
  160. </theme_items>
  161. </class>