FileDialog.xml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="FileDialog" inherits="ConfirmationDialog" version="3.4">
  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. <argument index="0" name="filter" type="String" />
  15. <description>
  16. 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].
  17. </description>
  18. </method>
  19. <method name="clear_filters">
  20. <return type="void" />
  21. <description>
  22. Clear all the added filters in the dialog.
  23. </description>
  24. </method>
  25. <method name="deselect_items">
  26. <return type="void" />
  27. <description>
  28. Clear currently selected items in the dialog.
  29. </description>
  30. </method>
  31. <method name="get_line_edit">
  32. <return type="LineEdit" />
  33. <description>
  34. Returns the LineEdit for the selected file.
  35. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
  36. </description>
  37. </method>
  38. <method name="get_vbox">
  39. <return type="VBoxContainer" />
  40. <description>
  41. Returns the vertical box container of the dialog, custom controls can be added to it.
  42. [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member CanvasItem.visible] property.
  43. </description>
  44. </method>
  45. <method name="invalidate">
  46. <return type="void" />
  47. <description>
  48. Invalidate and update the current dialog content list.
  49. </description>
  50. </method>
  51. </methods>
  52. <members>
  53. <member name="access" type="int" setter="set_access" getter="get_access" enum="FileDialog.Access" default="0">
  54. The file system access scope. See enum [code]Access[/code] constants.
  55. [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].
  56. </member>
  57. <member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir" default="&quot;res://&quot;">
  58. The current working directory of the file dialog.
  59. </member>
  60. <member name="current_file" type="String" setter="set_current_file" getter="get_current_file" default="&quot;&quot;">
  61. The currently selected file of the file dialog.
  62. </member>
  63. <member name="current_path" type="String" setter="set_current_path" getter="get_current_path" default="&quot;res://&quot;">
  64. The currently selected file path of the file dialog.
  65. </member>
  66. <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" override="true" default="false" />
  67. <member name="filters" type="PoolStringArray" setter="set_filters" getter="get_filters" default="PoolStringArray( )">
  68. 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].
  69. </member>
  70. <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="FileDialog.Mode" default="4">
  71. The dialog's open or save mode, which affects the selection behavior. See enum [code]Mode[/code] constants.
  72. </member>
  73. <member name="mode_overrides_title" type="bool" setter="set_mode_overrides_title" getter="is_mode_overriding_title" default="true">
  74. 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").
  75. </member>
  76. <member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false">
  77. If [code]true[/code], the dialog will show hidden files.
  78. </member>
  79. <member name="window_title" type="String" setter="set_title" getter="get_title" override="true" default="&quot;Save a File&quot;" />
  80. </members>
  81. <signals>
  82. <signal name="dir_selected">
  83. <argument index="0" name="dir" type="String" />
  84. <description>
  85. Emitted when the user selects a directory.
  86. </description>
  87. </signal>
  88. <signal name="file_selected">
  89. <argument index="0" name="path" type="String" />
  90. <description>
  91. Emitted when the user selects a file by double-clicking it or pressing the [b]OK[/b] button.
  92. </description>
  93. </signal>
  94. <signal name="files_selected">
  95. <argument index="0" name="paths" type="PoolStringArray" />
  96. <description>
  97. Emitted when the user selects multiple files.
  98. </description>
  99. </signal>
  100. </signals>
  101. <constants>
  102. <constant name="MODE_OPEN_FILE" value="0" enum="Mode">
  103. The dialog allows selecting one, and only one file.
  104. </constant>
  105. <constant name="MODE_OPEN_FILES" value="1" enum="Mode">
  106. The dialog allows selecting multiple files.
  107. </constant>
  108. <constant name="MODE_OPEN_DIR" value="2" enum="Mode">
  109. The dialog only allows selecting a directory, disallowing the selection of any file.
  110. </constant>
  111. <constant name="MODE_OPEN_ANY" value="3" enum="Mode">
  112. The dialog allows selecting one file or directory.
  113. </constant>
  114. <constant name="MODE_SAVE_FILE" value="4" enum="Mode">
  115. The dialog will warn when a file exists.
  116. </constant>
  117. <constant name="ACCESS_RESOURCES" value="0" enum="Access">
  118. The dialog only allows accessing files under the [Resource] path ([code]res://[/code]).
  119. </constant>
  120. <constant name="ACCESS_USERDATA" value="1" enum="Access">
  121. The dialog only allows accessing files under user data path ([code]user://[/code]).
  122. </constant>
  123. <constant name="ACCESS_FILESYSTEM" value="2" enum="Access">
  124. The dialog allows accessing files on the whole file system.
  125. </constant>
  126. </constants>
  127. <theme_items>
  128. <theme_item name="file" data_type="icon" type="Texture">
  129. Custom icon for files.
  130. </theme_item>
  131. <theme_item name="file_icon_modulate" data_type="color" type="Color" default="Color( 1, 1, 1, 1 )">
  132. The color modulation applied to the file icon.
  133. </theme_item>
  134. <theme_item name="files_disabled" data_type="color" type="Color" default="Color( 0, 0, 0, 0.7 )">
  135. The color tint for disabled files (when the [FileDialog] is used in open folder mode).
  136. </theme_item>
  137. <theme_item name="folder" data_type="icon" type="Texture">
  138. Custom icon for folders.
  139. </theme_item>
  140. <theme_item name="folder_icon_modulate" data_type="color" type="Color" default="Color( 1, 1, 1, 1 )">
  141. The color modulation applied to the folder icon.
  142. </theme_item>
  143. <theme_item name="parent_folder" data_type="icon" type="Texture">
  144. Custom icon for the parent folder arrow.
  145. </theme_item>
  146. <theme_item name="reload" data_type="icon" type="Texture">
  147. Custom icon for the reload button.
  148. </theme_item>
  149. <theme_item name="toggle_hidden" data_type="icon" type="Texture">
  150. Custom icon for the toggle hidden button.
  151. </theme_item>
  152. </theme_items>
  153. </class>