Documentation
¶
Overview ¶
FileDialog is a preset dialog used to choose files and directories in the filesystem. It supports filter masks. FileDialog automatically sets its window title according to the FileMode. If you want to use a custom title, disable this by setting ModeOverridesTitle to false.
Index ¶
- type Access
- type Advanced
- type Any
- type Customization
- type DisplayMode
- type Expanded
- type Extension
- func (self *Extension[T]) AsAcceptDialog() AcceptDialog.Instance
- func (self *Extension[T]) AsConfirmationDialog() ConfirmationDialog.Instance
- func (self *Extension[T]) AsFileDialog() Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsViewport() Viewport.Instance
- func (self *Extension[T]) AsWindow() Window.Instance
- type FileMode
- type ID
- type Instance
- func (self Instance) Access() Access
- func (self Instance) AddFilter(filter string)
- func (self Instance) AddOption(name string, values []string, default_value_index int)
- func (self Instance) AsAcceptDialog() AcceptDialog.Instance
- func (self Instance) AsConfirmationDialog() ConfirmationDialog.Instance
- func (self Instance) AsFileDialog() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsViewport() Viewport.Instance
- func (self Instance) AsWindow() Window.Instance
- func (self Instance) ClearFilenameFilter()
- func (self Instance) ClearFilters()
- func (self Instance) CurrentDir() string
- func (self Instance) CurrentFile() string
- func (self Instance) CurrentPath() string
- func (self Instance) DeselectAll()
- func (self Instance) DisplayMode() DisplayMode
- func (self Instance) FavoritesEnabled() bool
- func (self Instance) FileFilterToggleEnabled() bool
- func (self Instance) FileMode() FileMode
- func (self Instance) FileSortOptionsEnabled() bool
- func (self Instance) FilenameFilter() string
- func (self Instance) Filters() []string
- func (self Instance) FolderCreationEnabled() bool
- func (self Instance) GetLineEdit() LineEdit.Instance
- func (self Instance) GetOptionDefault(option int) int
- func (self Instance) GetOptionName(option int) string
- func (self Instance) GetOptionValues(option int) []string
- func (self Instance) GetSelectedOptions() map[string]int
- func (self Instance) GetVbox() VBoxContainer.Instance
- func (self Instance) HiddenFilesToggleEnabled() bool
- func (self Instance) ID() ID
- func (self Instance) Invalidate()
- func (self Instance) LayoutToggleEnabled() bool
- func (self Instance) ModeOverridesTitle() bool
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) OnDirSelected(cb func(dir string), flags ...Signal.Flags)
- func (self Instance) OnFileSelected(cb func(path string), flags ...Signal.Flags)
- func (self Instance) OnFilenameFilterChanged(cb func(filter string), flags ...Signal.Flags)
- func (self Instance) OnFilesSelected(cb func(paths []string), flags ...Signal.Flags)
- func (self Instance) OptionCount() int
- func (self Instance) RecentListEnabled() bool
- func (self Instance) RootSubfolder() string
- func (self Instance) SetAccess(value Access)
- func (self Instance) SetCurrentDir(value string)
- func (self Instance) SetCurrentFile(value string)
- func (self Instance) SetCurrentPath(value string)
- func (self Instance) SetDisplayMode(value DisplayMode)
- func (self Instance) SetFavoritesEnabled(value bool)
- func (self Instance) SetFileFilterToggleEnabled(value bool)
- func (self Instance) SetFileMode(value FileMode)
- func (self Instance) SetFileSortOptionsEnabled(value bool)
- func (self Instance) SetFilenameFilter(value string)
- func (self Instance) SetFilters(value []string)
- func (self Instance) SetFolderCreationEnabled(value bool)
- func (self Instance) SetHiddenFilesToggleEnabled(value bool)
- func (self Instance) SetLayoutToggleEnabled(value bool)
- func (self Instance) SetModeOverridesTitle(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOptionCount(value int)
- func (self Instance) SetOptionDefault(option int, default_value_index int)
- func (self Instance) SetOptionName(option int, name string)
- func (self Instance) SetOptionValues(option int, values []string)
- func (self Instance) SetRecentListEnabled(value bool)
- func (self Instance) SetRootSubfolder(value string)
- func (self Instance) SetShowHiddenFiles(value bool)
- func (self Instance) SetUseNativeDialog(value bool)
- func (self Instance) ShowHiddenFiles() bool
- func (self Instance) UseNativeDialog() bool
- func (self Instance) Virtual(name string) reflect.Value
- type MoreArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Access ¶
type Access int //gd:FileDialog.Access
const ( // The dialog only allows accessing files under the [Resource] path (res://). // // [Resource]: https://pkg.go.dev/graphics.gd/classdb/Resource AccessResources Access = 0 // The dialog only allows accessing files under user data path (user://). AccessUserdata Access = 1 // The dialog allows accessing files on the whole file system. AccessFilesystem Access = 2 )
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Customization ¶
type Customization int //gd:FileDialog.Customization
const ( // Toggles visibility of the favorite button, and the favorite list on the left side of the dialog. // // Equivalent to [HiddenFilesToggleEnabled]. // // [HiddenFilesToggleEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.HiddenFilesToggleEnabled CustomizationHiddenFiles Customization = 0 // If enabled, shows the button for creating new directories (when using [FileModeOpenDir], [FileModeOpenAny], or [FileModeSaveFile]). // // Equivalent to [FolderCreationEnabled]. // // [FolderCreationEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FolderCreationEnabled CustomizationCreateFolder Customization = 1 // If enabled, shows the toggle file filter button. // // Equivalent to [FileFilterToggleEnabled]. // // [FileFilterToggleEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FileFilterToggleEnabled CustomizationFileFilter Customization = 2 // If enabled, shows the file sorting options button. // // Equivalent to [FileSortOptionsEnabled]. // // [FileSortOptionsEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FileSortOptionsEnabled CustomizationFileSort Customization = 3 // If enabled, shows the toggle favorite button and favorite list on the left side of the dialog. // // Equivalent to [FavoritesEnabled]. // // [FavoritesEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.FavoritesEnabled CustomizationFavorites Customization = 4 // If enabled, shows the recent directories list on the left side of the dialog. // // Equivalent to [RecentListEnabled]. // // [RecentListEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.RecentListEnabled CustomizationRecent Customization = 5 // If enabled, shows the layout switch buttons (list/thumbnails). // // Equivalent to [LayoutToggleEnabled]. // // [LayoutToggleEnabled]: https://pkg.go.dev/graphics.gd/classdb/#Instance.LayoutToggleEnabled CustomizationLayout Customization = 6 )
type DisplayMode ¶
type DisplayMode int //gd:FileDialog.DisplayMode
const ( // The dialog displays files as a grid of thumbnails. Use theme's 'thumbnail_size' to adjust their size. DisplayThumbnails DisplayMode = 0 // The dialog displays files as a list of filenames. DisplayList DisplayMode = 1 )
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsAcceptDialog ¶
func (self *Extension[T]) AsAcceptDialog() AcceptDialog.Instance
func (*Extension[T]) AsConfirmationDialog ¶
func (self *Extension[T]) AsConfirmationDialog() ConfirmationDialog.Instance
func (*Extension[T]) AsFileDialog ¶
func (*Extension[T]) AsViewport ¶
type FileMode ¶
type FileMode int //gd:FileDialog.FileMode
const ( // The dialog allows selecting one, and only one file. FileModeOpenFile FileMode = 0 // The dialog allows selecting multiple files. FileModeOpenFiles FileMode = 1 // The dialog only allows selecting a directory, disallowing the selection of any file. FileModeOpenDir FileMode = 2 // The dialog allows selecting one file or directory. FileModeOpenAny FileMode = 3 // The dialog will warn when a file exists. FileModeSaveFile FileMode = 4 )
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.FileDialog
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddFilter ¶
Adds a comma-separated file name 'filter' option to the FileDialog with an optional 'description', which restricts what files can be picked.
A 'filter' should be of the form "filename.extension", where filename and extension can be * to match any string. Filters starting with . (i.e. empty filenames) are not allowed.
For example, a 'filter' of "*.png, *.jpg" and a 'description' of "Images" results in filter text "Images (*.png, *.jpg)".
func (Instance) AddOption ¶
Adds an additional OptionButton to the file dialog. If 'values' is empty, a CheckBox is added instead.
'default_value_index' should be an index of the value in the 'values'. If 'values' is empty it should be either 1 (checked), or 0 (unchecked).
func (Instance) AsAcceptDialog ¶
func (self Instance) AsAcceptDialog() AcceptDialog.Instance
func (Instance) AsConfirmationDialog ¶
func (self Instance) AsConfirmationDialog() ConfirmationDialog.Instance
func (Instance) AsFileDialog ¶
func (Instance) AsViewport ¶
func (Instance) ClearFilenameFilter ¶
func (self Instance) ClearFilenameFilter()
Clear the filter for file names.
func (Instance) ClearFilters ¶
func (self Instance) ClearFilters()
Clear all the added filters in the dialog.
func (Instance) CurrentDir ¶
func (Instance) CurrentFile ¶
func (Instance) CurrentPath ¶
func (Instance) DeselectAll ¶
func (self Instance) DeselectAll()
Clear all currently selected items in the dialog.
func (Instance) DisplayMode ¶
func (self Instance) DisplayMode() DisplayMode
func (Instance) FavoritesEnabled ¶
func (Instance) FileFilterToggleEnabled ¶
func (Instance) FileSortOptionsEnabled ¶
func (Instance) FilenameFilter ¶
func (Instance) FolderCreationEnabled ¶
func (Instance) GetLineEdit ¶
Returns the LineEdit for the selected file.
Warning: 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 CanvasItem.Visible property.
func (Instance) GetOptionDefault ¶
Returns the default value index of the OptionButton or CheckBox with index 'option'.
func (Instance) GetOptionName ¶
Returns the name of the OptionButton or CheckBox with index 'option'.
func (Instance) GetOptionValues ¶
Returns an array of values of the OptionButton with index 'option'.
func (Instance) GetSelectedOptions ¶
Returns a data structure with the selected values of the additional OptionButtons and/or CheckBoxes. data structure keys are names and values are selected value indices.
func (Instance) GetVbox ¶
func (self Instance) GetVbox() VBoxContainer.Instance
Returns the vertical box container of the dialog, custom controls can be added to it.
Warning: 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 CanvasItem.Visible property.
Note: Changes to this node are ignored by native file dialogs, use AddOption to add custom elements to the dialog instead.
func (Instance) HiddenFilesToggleEnabled ¶
func (Instance) Invalidate ¶
func (self Instance) Invalidate()
Invalidate and update the current dialog content list.
Note: This method does nothing on native file dialogs.
func (Instance) LayoutToggleEnabled ¶
func (Instance) ModeOverridesTitle ¶
func (Instance) MoreArgs ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) OnDirSelected ¶
func (Instance) OnFileSelected ¶
func (Instance) OnFilenameFilterChanged ¶
func (Instance) OnFilesSelected ¶
func (Instance) OptionCount ¶
func (Instance) RecentListEnabled ¶
func (Instance) RootSubfolder ¶
func (Instance) SetCurrentDir ¶
func (Instance) SetCurrentFile ¶
func (Instance) SetCurrentPath ¶
func (Instance) SetDisplayMode ¶
func (self Instance) SetDisplayMode(value DisplayMode)
func (Instance) SetFavoritesEnabled ¶
func (Instance) SetFileFilterToggleEnabled ¶
func (Instance) SetFileMode ¶
func (Instance) SetFileSortOptionsEnabled ¶
func (Instance) SetFilenameFilter ¶
func (Instance) SetFilters ¶
func (Instance) SetFolderCreationEnabled ¶
func (Instance) SetHiddenFilesToggleEnabled ¶
func (Instance) SetLayoutToggleEnabled ¶
func (Instance) SetModeOverridesTitle ¶
func (Instance) SetOptionCount ¶
func (Instance) SetOptionDefault ¶
Sets the default value index of the OptionButton or CheckBox with index 'option'.
func (Instance) SetOptionName ¶
Sets the name of the OptionButton or CheckBox with index 'option'.
func (Instance) SetOptionValues ¶
Sets the option values of the OptionButton with index 'option'.
func (Instance) SetRecentListEnabled ¶
func (Instance) SetRootSubfolder ¶
func (Instance) SetShowHiddenFiles ¶
func (Instance) SetUseNativeDialog ¶
func (Instance) ShowHiddenFiles ¶
func (Instance) UseNativeDialog ¶
type MoreArgs ¶
type MoreArgs [1]gdclass.FileDialog
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) AddFilter ¶
Adds a comma-separated file name 'filter' option to the FileDialog with an optional 'description', which restricts what files can be picked.
A 'filter' should be of the form "filename.extension", where filename and extension can be * to match any string. Filters starting with . (i.e. empty filenames) are not allowed.
For example, a 'filter' of "*.png, *.jpg" and a 'description' of "Images" results in filter text "Images (*.png, *.jpg)".