FileDialog

package
v0.0.0-...-f3deeb4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package FileDialog provides methods for working with FileDialog object instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access = gdclass.FileDialogAccess //gd:FileDialog.Access
const (
	/*The dialog only allows accessing files under the [Resource] path ([code]res://[/code]).*/
	AccessResources Access = 0
	/*The dialog only allows accessing files under user data path ([code]user://[/code]).*/
	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 Any

type Any interface {
	gd.IsClass
	AsFileDialog() Instance
}

type FileMode

type FileMode = gdclass.FileDialogFileMode //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 Instance

type Instance [1]gdclass.FileDialog

[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 [member file_mode]. If you want to use a custom title, disable this by setting [member mode_overrides_title] to [code]false[/code].

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) Access

func (self Instance) Access() gdclass.FileDialogAccess

func (Instance) AddFilter

func (self Instance) AddFilter(filter string)

Adds a comma-delimited file name [param filter] option to the [FileDialog] with an optional [param description], which restricts what files can be picked. A [param filter] should be of the form [code]"filename.extension"[/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. For example, a [param filter] of [code]"*.png, *.jpg"[/code] and a [param description] of [code]"Images"[/code] results in filter text "Images (*.png, *.jpg)".

func (Instance) AddOption

func (self Instance) AddOption(name string, values []string, default_value_index int)

Adds an additional [OptionButton] to the file dialog. If [param values] is empty, a [CheckBox] is added instead. [param default_value_index] should be an index of the value in the [param values]. If [param values] is empty it should be either [code]1[/code] (checked), or [code]0[/code] (unchecked).

func (Instance) AsAcceptDialog

func (self Instance) AsAcceptDialog() AcceptDialog.Instance

func (Instance) AsConfirmationDialog

func (self Instance) AsConfirmationDialog() ConfirmationDialog.Instance

func (Instance) AsFileDialog

func (self Instance) AsFileDialog() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsViewport

func (self Instance) AsViewport() Viewport.Instance

func (Instance) AsWindow

func (self Instance) AsWindow() Window.Instance

func (Instance) ClearFilters

func (self Instance) ClearFilters()

Clear all the added filters in the dialog.

func (Instance) CurrentDir

func (self Instance) CurrentDir() string

func (Instance) CurrentFile

func (self Instance) CurrentFile() string

func (Instance) CurrentPath

func (self Instance) CurrentPath() string

func (Instance) DeselectAll

func (self Instance) DeselectAll()

Clear all currently selected items in the dialog.

func (Instance) FileMode

func (self Instance) FileMode() gdclass.FileDialogFileMode

func (Instance) Filters

func (self Instance) Filters() []string

func (Instance) GetLineEdit

func (self Instance) GetLineEdit() [1]gdclass.LineEdit

Returns the LineEdit for the selected file. [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.

func (Instance) GetOptionDefault

func (self Instance) GetOptionDefault(option int) int

Returns the default value index of the [OptionButton] or [CheckBox] with index [param option].

func (Instance) GetOptionName

func (self Instance) GetOptionName(option int) string

Returns the name of the [OptionButton] or [CheckBox] with index [param option].

func (Instance) GetOptionValues

func (self Instance) GetOptionValues(option int) []string

Returns an array of values of the [OptionButton] with index [param option].

func (Instance) GetSelectedOptions

func (self Instance) GetSelectedOptions() map[string]int

Returns a [Dictionary] with the selected values of the additional [OptionButton]s and/or [CheckBox]es. [Dictionary] keys are names and values are selected value indices.

func (Instance) GetVbox

func (self Instance) GetVbox() [1]gdclass.VBoxContainer

Returns the vertical box container of the dialog, custom controls can be added to it. [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. [b]Note:[/b] Changes to this node are ignored by native file dialogs, use [method add_option] to add custom elements to the dialog instead.

func (Instance) Invalidate

func (self Instance) Invalidate()

Invalidate and update the current dialog content list. [b]Note:[/b] This method does nothing on native file dialogs.

func (Instance) ModeOverridesTitle

func (self Instance) ModeOverridesTitle() bool

func (Instance) OnDirSelected

func (self Instance) OnDirSelected(cb func(dir string))

func (Instance) OnFileSelected

func (self Instance) OnFileSelected(cb func(path string))

func (Instance) OnFilesSelected

func (self Instance) OnFilesSelected(cb func(paths []string))

func (Instance) OptionCount

func (self Instance) OptionCount() int

func (Instance) RootSubfolder

func (self Instance) RootSubfolder() string

func (Instance) SetAccess

func (self Instance) SetAccess(value gdclass.FileDialogAccess)

func (Instance) SetCurrentDir

func (self Instance) SetCurrentDir(value string)

func (Instance) SetCurrentFile

func (self Instance) SetCurrentFile(value string)

func (Instance) SetCurrentPath

func (self Instance) SetCurrentPath(value string)

func (Instance) SetFileMode

func (self Instance) SetFileMode(value gdclass.FileDialogFileMode)

func (Instance) SetFilters

func (self Instance) SetFilters(value []string)

func (Instance) SetModeOverridesTitle

func (self Instance) SetModeOverridesTitle(value bool)

func (Instance) SetOptionCount

func (self Instance) SetOptionCount(value int)

func (Instance) SetOptionDefault

func (self Instance) SetOptionDefault(option int, default_value_index int)

Sets the default value index of the [OptionButton] or [CheckBox] with index [param option].

func (Instance) SetOptionName

func (self Instance) SetOptionName(option int, name string)

Sets the name of the [OptionButton] or [CheckBox] with index [param option].

func (Instance) SetOptionValues

func (self Instance) SetOptionValues(option int, values []string)

Sets the option values of the [OptionButton] with index [param option].

func (Instance) SetRootSubfolder

func (self Instance) SetRootSubfolder(value string)

func (Instance) SetShowHiddenFiles

func (self Instance) SetShowHiddenFiles(value bool)

func (Instance) SetUseNativeDialog

func (self Instance) SetUseNativeDialog(value bool)

func (Instance) ShowHiddenFiles

func (self Instance) ShowHiddenFiles() bool

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) UseNativeDialog

func (self Instance) UseNativeDialog() bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL