FileDialog.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="FileDialog" inherits="ConfirmationDialog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
  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] to the list of filters, which restricts what files can be picked.
  17. A [code]filter[/code] should be of the form [code]"filename.extension ; Description"[/code], where filename and extension can be [code]*[/code] to match any string. Filters starting with [code].[/code] (i.e. empty filenames) are not allowed.
  18. Example filters: [code]"*.png ; PNG Images"[/code], [code]"project.godot ; Godot Project"[/code].
  19. </description>
  20. </method>
  21. <method name="clear_filters">
  22. <return type="void" />
  23. <description>
  24. Clear all the added filters in the dialog.
  25. </description>
  26. </method>
  27. <method name="deselect_items">
  28. <return type="void" />
  29. <description>
  30. Clear currently selected items in the dialog.
  31. </description>
  32. </method>
  33. <method name="get_line_edit">
  34. <return type="LineEdit" />
  35. <description>
  36. Returns the LineEdit for the selected file.
  37. [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.
  38. </description>
  39. </method>
  40. <method name="get_vbox">
  41. <return type="VBoxContainer" />
  42. <description>
  43. Returns the vertical box container of the dialog, custom controls can be added to it.
  44. [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.
  45. </description>
  46. </method>
  47. <method name="invalidate">
  48. <return type="void" />
  49. <description>
  50. Invalidate and update the current dialog content list.
  51. </description>
  52. </method>
  53. </methods>
  54. <members>
  55. <member name="access" type="int" setter="set_access" getter="get_access" enum="FileDialog.Access" default="0">
  56. The file system access scope. See enum [code]Access[/code] constants.
  57. [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].
  58. </member>
  59. <member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir">
  60. The current working directory of the file dialog.
  61. </member>
  62. <member name="current_file" type="String" setter="set_current_file" getter="get_current_file">
  63. The currently selected file of the file dialog.
  64. </member>
  65. <member name="current_path" type="String" setter="set_current_path" getter="get_current_path">
  66. The currently selected file path of the file dialog.
  67. </member>
  68. <member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" overrides="AcceptDialog" default="false" />
  69. <member name="filters" type="PoolStringArray" setter="set_filters" getter="get_filters" default="PoolStringArray( )">
  70. 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]. Multiple file types can also be specified in a single filter. [code]"*.png, *.jpg, *.jpeg ; Supported Images"[/code] will show both PNG and JPEG files when selected.
  71. </member>
  72. <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="FileDialog.Mode" default="4">
  73. The dialog's open or save mode, which affects the selection behavior. See enum [code]Mode[/code] constants.
  74. </member>
  75. <member name="mode_overrides_title" type="bool" setter="set_mode_overrides_title" getter="is_mode_overriding_title" default="true">
  76. 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").
  77. </member>
  78. <member name="root_subfolder" type="String" setter="set_root_subfolder" getter="get_root_subfolder" default="&quot;&quot;">
  79. If non-empty, the given sub-folder will be "root" of this [FileDialog], i.e. user won't be able to go to its parent directory.
  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" overrides="WindowDialog" default="&quot;Save a File&quot;" />
  85. </members>
  86. <signals>
  87. <signal name="dir_selected">
  88. <argument index="0" name="dir" type="String" />
  89. <description>
  90. Emitted when the user selects a directory.
  91. </description>
  92. </signal>
  93. <signal name="file_selected">
  94. <argument index="0" name="path" type="String" />
  95. <description>
  96. Emitted when the user selects a file by double-clicking it or pressing the [b]OK[/b] button.
  97. </description>
  98. </signal>
  99. <signal name="files_selected">
  100. <argument index="0" name="paths" type="PoolStringArray" />
  101. <description>
  102. Emitted when the user selects multiple files.
  103. </description>
  104. </signal>
  105. </signals>
  106. <constants>
  107. <constant name="MODE_OPEN_FILE" value="0" enum="Mode">
  108. The dialog allows selecting one, and only one file.
  109. </constant>
  110. <constant name="MODE_OPEN_FILES" value="1" enum="Mode">
  111. The dialog allows selecting multiple files.
  112. </constant>
  113. <constant name="MODE_OPEN_DIR" value="2" enum="Mode">
  114. The dialog only allows selecting a directory, disallowing the selection of any file.
  115. </constant>
  116. <constant name="MODE_OPEN_ANY" value="3" enum="Mode">
  117. The dialog allows selecting one file or directory.
  118. </constant>
  119. <constant name="MODE_SAVE_FILE" value="4" enum="Mode">
  120. The dialog will warn when a file exists.
  121. </constant>
  122. <constant name="ACCESS_RESOURCES" value="0" enum="Access">
  123. The dialog only allows accessing files under the [Resource] path ([code]res://[/code]).
  124. </constant>
  125. <constant name="ACCESS_USERDATA" value="1" enum="Access">
  126. The dialog only allows accessing files under user data path ([code]user://[/code]).
  127. </constant>
  128. <constant name="ACCESS_FILESYSTEM" value="2" enum="Access">
  129. The dialog allows accessing files on the whole file system.
  130. </constant>
  131. </constants>
  132. <theme_items>
  133. <theme_item name="file_icon_modulate" data_type="color" type="Color" default="Color( 1, 1, 1, 1 )">
  134. The color modulation applied to the file icon.
  135. </theme_item>
  136. <theme_item name="files_disabled" data_type="color" type="Color" default="Color( 1, 1, 1, 0.25 )">
  137. The color tint for disabled files (when the [FileDialog] is used in open folder mode).
  138. </theme_item>
  139. <theme_item name="folder_icon_modulate" data_type="color" type="Color" default="Color( 1, 1, 1, 1 )">
  140. The color modulation applied to the folder icon.
  141. </theme_item>
  142. <theme_item name="file" data_type="icon" type="Texture">
  143. Custom icon for files.
  144. </theme_item>
  145. <theme_item name="folder" data_type="icon" type="Texture">
  146. Custom icon for folders.
  147. </theme_item>
  148. <theme_item name="parent_folder" data_type="icon" type="Texture">
  149. Custom icon for the parent folder arrow.
  150. </theme_item>
  151. <theme_item name="reload" data_type="icon" type="Texture">
  152. Custom icon for the reload button.
  153. </theme_item>
  154. <theme_item name="toggle_hidden" data_type="icon" type="Texture">
  155. Custom icon for the toggle hidden button.
  156. </theme_item>
  157. </theme_items>
  158. </class>