FileDialog.xml 6.8 KB

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