dialog

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: BSD-3-Clause Imports: 20 Imported by: 90

Documentation

Overview

Package dialog defines standard dialog windows for application GUIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFileIcon added in v1.3.0

func NewFileIcon(uri fyne.URI) *widget.FileIcon

NewFileIcon takes a filepath and creates an icon with an overlayed label using the detected mimetype and extension Deprecated: Use widget.NewFileIcon instead

func ShowColorPicker added in v1.4.0

func ShowColorPicker(title, message string, callback func(c color.Color), parent fyne.Window)

ShowColorPicker creates and shows a color dialog. The callback is triggered when the user selects a color.

Since: 1.4

func ShowConfirm

func ShowConfirm(title, message string, callback func(bool), parent fyne.Window)

ShowConfirm shows a dialog over the specified window for a user confirmation. The title is used for the dialog window and message is the content. The callback is executed when the user decides.

func ShowCustom

func ShowCustom(title, dismiss string, content fyne.CanvasObject, parent fyne.Window)

ShowCustom shows a dialog over the specified application using custom content. The button will have the dismiss text set. The MinSize() of the CanvasObject passed will be used to set the size of the window.

func ShowCustomConfirm

func ShowCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject,
	callback func(bool), parent fyne.Window)

ShowCustomConfirm shows a dialog over the specified application using custom content. The cancel button will have the dismiss text set and the "OK" will use the confirm text. The response callback is called on user action. The MinSize() of the CanvasObject passed will be used to set the size of the window.

func ShowEntryDialog added in v1.4.0

func ShowEntryDialog(title, message string, onConfirm func(string), parent fyne.Window)

ShowEntryDialog creates a new entry dialog and shows it immediately.

func ShowError

func ShowError(err error, parent fyne.Window)

ShowError shows a dialog over the specified window for an application error. The title and message are extracted from the provided error.

func ShowFileOpen added in v1.3.0

func ShowFileOpen(callback func(fyne.URIReadCloser, error), parent fyne.Window)

ShowFileOpen creates and shows a file dialog allowing the user to choose a file to open. The dialog will appear over the window specified.

func ShowFileSave added in v1.3.0

func ShowFileSave(callback func(fyne.URIWriteCloser, error), parent fyne.Window)

ShowFileSave creates and shows a file dialog allowing the user to choose a file to save to (new or overwrite). If the user chooses an existing file they will be asked if they are sure. The dialog will appear over the window specified.

func ShowFolderOpen added in v1.4.0

func ShowFolderOpen(callback func(fyne.ListableURI, error), parent fyne.Window)

ShowFolderOpen creates and shows a file dialog allowing the user to choose a folder to open. The dialog will appear over the window specified.

Since: 1.4

func ShowInformation

func ShowInformation(title, message string, parent fyne.Window)

ShowInformation shows a dialog over the specified window for user information. The title is used for the dialog window and message is the content.

Types

type ColorPickerDialog added in v1.4.0

type ColorPickerDialog struct {
	Advanced bool
	// contains filtered or unexported fields
}

ColorPickerDialog is a simple dialog window that displays a color picker.

Since: 1.4

func NewColorPicker added in v1.4.0

func NewColorPicker(title, message string, callback func(c color.Color), parent fyne.Window) *ColorPickerDialog

NewColorPicker creates a color dialog and returns the handle. Using the returned type you should call Show() and then set its color through SetColor(). The callback is triggered when the user selects a color.

Since: 1.4

func (ColorPickerDialog) Hide added in v1.4.0

func (d ColorPickerDialog) Hide()

func (ColorPickerDialog) Layout added in v1.4.0

func (d ColorPickerDialog) Layout(obj []fyne.CanvasObject, size fyne.Size)

func (ColorPickerDialog) MinSize added in v1.4.0

func (d ColorPickerDialog) MinSize(obj []fyne.CanvasObject) fyne.Size

func (*ColorPickerDialog) Refresh added in v1.4.0

func (p *ColorPickerDialog) Refresh()

Refresh causes this dialog to be updated

func (ColorPickerDialog) Resize added in v1.4.0

func (d ColorPickerDialog) Resize(size fyne.Size)

Resize dialog, call this function after dialog show

func (*ColorPickerDialog) SetColor added in v1.4.0

func (p *ColorPickerDialog) SetColor(c color.Color)

SetColor updates the color of the color picker.

func (ColorPickerDialog) SetDismissText added in v1.4.0

func (d ColorPickerDialog) SetDismissText(label string)

SetDismissText allows custom text to be set in the confirmation button

func (ColorPickerDialog) SetOnClosed added in v1.4.0

func (d ColorPickerDialog) SetOnClosed(closed func())

SetOnClosed allows to set a callback function that is called when the dialog is closed

func (*ColorPickerDialog) Show added in v1.4.0

func (p *ColorPickerDialog) Show()

Show causes this dialog to be displayed

type ConfirmDialog

type ConfirmDialog struct {
	// contains filtered or unexported fields
}

ConfirmDialog is like the standard Dialog but with an additional confirmation button

func NewConfirm

func NewConfirm(title, message string, callback func(bool), parent fyne.Window) *ConfirmDialog

NewConfirm creates a dialog over the specified window for user confirmation. The title is used for the dialog window and message is the content. The callback is executed when the user decides. After creation you should call Show().

func (ConfirmDialog) Hide added in v1.1.0

func (d ConfirmDialog) Hide()

func (ConfirmDialog) Layout

func (d ConfirmDialog) Layout(obj []fyne.CanvasObject, size fyne.Size)

func (ConfirmDialog) MinSize

func (d ConfirmDialog) MinSize(obj []fyne.CanvasObject) fyne.Size

func (ConfirmDialog) Refresh added in v1.4.0

func (d ConfirmDialog) Refresh()

func (ConfirmDialog) Resize added in v1.4.0

func (d ConfirmDialog) Resize(size fyne.Size)

Resize dialog, call this function after dialog show

func (*ConfirmDialog) SetConfirmText

func (d *ConfirmDialog) SetConfirmText(label string)

SetConfirmText allows custom text to be set in the confirmation button

func (ConfirmDialog) SetDismissText

func (d ConfirmDialog) SetDismissText(label string)

SetDismissText allows custom text to be set in the confirmation button

func (ConfirmDialog) SetOnClosed added in v1.3.0

func (d ConfirmDialog) SetOnClosed(closed func())

SetOnClosed allows to set a callback function that is called when the dialog is closed

func (ConfirmDialog) Show

func (d ConfirmDialog) Show()

type Dialog

type Dialog interface {
	Show()
	Hide()
	SetDismissText(label string)
	SetOnClosed(closed func())
	Refresh()
	Resize(size fyne.Size)
}

Dialog is the common API for any dialog window with a single dismiss button

func NewCustom added in v1.3.0

func NewCustom(title, dismiss string, content fyne.CanvasObject, parent fyne.Window) Dialog

NewCustom creates and returns a dialog over the specified application using custom content. The button will have the dismiss text set. The MinSize() of the CanvasObject passed will be used to set the size of the window.

func NewCustomConfirm added in v1.3.0

func NewCustomConfirm(title, confirm, dismiss string, content fyne.CanvasObject,
	callback func(bool), parent fyne.Window) Dialog

NewCustomConfirm creates and returns a dialog over the specified application using custom content. The cancel button will have the dismiss text set and the "OK" will use the confirm text. The response callback is called on user action. The MinSize() of the CanvasObject passed will be used to set the size of the window.

func NewError added in v1.3.0

func NewError(err error, parent fyne.Window) Dialog

NewError creates a dialog over the specified window for an application error. The title and message are extracted from the provided error. After creation you should call Show().

func NewInformation

func NewInformation(title, message string, parent fyne.Window) Dialog

NewInformation creates a dialog over the specified window for user information. The title is used for the dialog window and message is the content. After creation you should call Show().

type EntryDialog added in v1.4.0

type EntryDialog struct {
	// contains filtered or unexported fields
}

EntryDialog is a variation of a dialog which prompts the user to enter some text.

func NewEntryDialog added in v1.4.0

func NewEntryDialog(title, message string, onConfirm func(string), parent fyne.Window) *EntryDialog

NewEntryDialog creates a dialog over the specified window for the user to enter a value.

onConfirm is a callback that runs when the user enters a string of text and clicks the "confirm" button. May be nil.

func (EntryDialog) Hide added in v1.4.0

func (d EntryDialog) Hide()

func (EntryDialog) Layout added in v1.4.0

func (d EntryDialog) Layout(obj []fyne.CanvasObject, size fyne.Size)

func (EntryDialog) MinSize added in v1.4.0

func (d EntryDialog) MinSize(obj []fyne.CanvasObject) fyne.Size

func (EntryDialog) Refresh added in v1.4.0

func (d EntryDialog) Refresh()

func (EntryDialog) Resize added in v1.4.0

func (d EntryDialog) Resize(size fyne.Size)

Resize dialog, call this function after dialog show

func (EntryDialog) SetDismissText added in v1.4.0

func (d EntryDialog) SetDismissText(label string)

SetDismissText allows custom text to be set in the confirmation button

func (*EntryDialog) SetOnClosed added in v1.4.0

func (i *EntryDialog) SetOnClosed(callback func())

SetOnClosed changes the callback which is run when the dialog is closed, which is nil by default.

The callback is called unconditionally whether the user confirms or cancels.

Note that the callback will be called after onConfirm, if both are non-nil. This way onConfirm can potential modify state that this callback needs to get the user input when the user confirms, while also being able to handle the case where the user cancelled.

func (*EntryDialog) SetPlaceholder added in v1.4.0

func (i *EntryDialog) SetPlaceholder(s string)

SetPlaceholder defines the placeholder text for the entry

func (*EntryDialog) SetText added in v1.4.0

func (i *EntryDialog) SetText(s string)

SetText changes the current text value of the entry dialog, this can be useful for setting a default value.

func (EntryDialog) Show added in v1.4.0

func (d EntryDialog) Show()

type FileDialog added in v1.3.0

type FileDialog struct {
	// contains filtered or unexported fields
}

FileDialog is a dialog containing a file picker for use in opening or saving files.

func NewFileOpen added in v1.3.0

func NewFileOpen(callback func(fyne.URIReadCloser, error), parent fyne.Window) *FileDialog

NewFileOpen creates a file dialog allowing the user to choose a file to open. The dialog will appear over the window specified when Show() is called.

func NewFileSave added in v1.3.0

func NewFileSave(callback func(fyne.URIWriteCloser, error), parent fyne.Window) *FileDialog

NewFileSave creates a file dialog allowing the user to choose a file to save to (new or overwrite). If the user chooses an existing file they will be asked if they are sure. The dialog will appear over the window specified when Show() is called.

func NewFolderOpen added in v1.4.0

func NewFolderOpen(callback func(fyne.ListableURI, error), parent fyne.Window) *FileDialog

NewFolderOpen creates a file dialog allowing the user to choose a folder to open. The dialog will appear over the window specified when Show() is called.

Since: 1.4

func (*FileDialog) Hide added in v1.3.0

func (f *FileDialog) Hide()

Hide hides the file dialog.

func (*FileDialog) Refresh added in v1.4.0

func (f *FileDialog) Refresh()

Refresh causes this dialog to be updated

func (*FileDialog) Resize added in v1.4.0

func (f *FileDialog) Resize(size fyne.Size)

Resize dialog, call this function after dialog show

func (*FileDialog) SetDismissText added in v1.3.0

func (f *FileDialog) SetDismissText(label string)

SetDismissText allows custom text to be set in the confirmation button

func (*FileDialog) SetFilter added in v1.3.0

func (f *FileDialog) SetFilter(filter storage.FileFilter)

SetFilter sets a filter for limiting files that can be chosen in the file dialog.

func (*FileDialog) SetLocation added in v1.4.0

func (f *FileDialog) SetLocation(u fyne.ListableURI)

SetLocation tells this FileDirectory which location to display. This is normally called before the dialog is shown.

Since: 1.4

func (*FileDialog) SetOnClosed added in v1.3.0

func (f *FileDialog) SetOnClosed(closed func())

SetOnClosed sets a callback function that is called when the dialog is closed.

func (*FileDialog) Show added in v1.3.0

func (f *FileDialog) Show()

Show shows the file dialog.

type ProgressDialog

type ProgressDialog struct {
	// contains filtered or unexported fields
}

ProgressDialog is a simple dialog window that displays text and a progress bar.

func NewProgress

func NewProgress(title, message string, parent fyne.Window) *ProgressDialog

NewProgress creates a progress dialog and returns the handle. Using the returned type you should call Show() and then set its value through SetValue().

func (ProgressDialog) Hide added in v1.1.0

func (d ProgressDialog) Hide()

func (ProgressDialog) Layout

func (d ProgressDialog) Layout(obj []fyne.CanvasObject, size fyne.Size)

func (ProgressDialog) MinSize

func (d ProgressDialog) MinSize(obj []fyne.CanvasObject) fyne.Size

func (ProgressDialog) Refresh added in v1.4.0

func (d ProgressDialog) Refresh()

func (ProgressDialog) Resize added in v1.4.0

func (d ProgressDialog) Resize(size fyne.Size)

Resize dialog, call this function after dialog show

func (ProgressDialog) SetDismissText

func (d ProgressDialog) SetDismissText(label string)

SetDismissText allows custom text to be set in the confirmation button

func (ProgressDialog) SetOnClosed added in v1.3.0

func (d ProgressDialog) SetOnClosed(closed func())

SetOnClosed allows to set a callback function that is called when the dialog is closed

func (*ProgressDialog) SetValue

func (p *ProgressDialog) SetValue(v float64)

SetValue updates the value of the progress bar - this should be between 0.0 and 1.0.

func (ProgressDialog) Show

func (d ProgressDialog) Show()

type ProgressInfiniteDialog added in v1.2.3

type ProgressInfiniteDialog struct {
	// contains filtered or unexported fields
}

ProgressInfiniteDialog is a simple dialog window that displays text and a infinite progress bar.

func NewProgressInfinite added in v1.2.3

func NewProgressInfinite(title, message string, parent fyne.Window) *ProgressInfiniteDialog

NewProgressInfinite creates a infinite progress dialog and returns the handle. Using the returned type you should call Show().

func (*ProgressInfiniteDialog) Hide added in v1.2.3

func (d *ProgressInfiniteDialog) Hide()

Hide this dialog and stop the infinite progress goroutine

func (ProgressInfiniteDialog) Layout added in v1.2.3

func (d ProgressInfiniteDialog) Layout(obj []fyne.CanvasObject, size fyne.Size)

func (ProgressInfiniteDialog) MinSize added in v1.2.3

func (d ProgressInfiniteDialog) MinSize(obj []fyne.CanvasObject) fyne.Size

func (ProgressInfiniteDialog) Refresh added in v1.4.0

func (d ProgressInfiniteDialog) Refresh()

func (ProgressInfiniteDialog) Resize added in v1.4.0

func (d ProgressInfiniteDialog) Resize(size fyne.Size)

Resize dialog, call this function after dialog show

func (ProgressInfiniteDialog) SetDismissText added in v1.2.3

func (d ProgressInfiniteDialog) SetDismissText(label string)

SetDismissText allows custom text to be set in the confirmation button

func (ProgressInfiniteDialog) SetOnClosed added in v1.3.0

func (d ProgressInfiniteDialog) SetOnClosed(closed func())

SetOnClosed allows to set a callback function that is called when the dialog is closed

func (ProgressInfiniteDialog) Show added in v1.2.3

func (d ProgressInfiniteDialog) Show()

Jump to

Keyboard shortcuts

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