dialog

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package dialog provides common dialog boxes, such as message boxes, and open and save file dialogs.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialog

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

Dialog contains some functionality used by all dialog types.

func (*Dialog) Err

func (d *Dialog) Err() error

Err returns the first error that was encountered while building the dialog.

func (*Dialog) WithOwner added in v0.9.0

func (d *Dialog) WithOwner(owner Owner) *Dialog

WithOwner sets the owner of the dialog box.

type Message

type Message struct {
	Dialog
	// contains filtered or unexported fields
}

Message is a builder to construct a message dialog to the user.

func NewMessage

func NewMessage(text string) *Message

NewMessage initializes a new message object with the specified text. Use of the method Message on an existing Window is preferred, as the message can be set as a child of the top-level window.

Example
// The following creates a modal dialog with a message.
err := NewMessage("Some text for the body of the dialog box.").WithTitle("Example").WithInfo().Show()
if err != nil {
	fmt.Println("Error: ", err)
}
Output:

func (*Message) Show

func (m *Message) Show() error

Show completes building of the message, and shows the message to the user.

func (*Message) WithError

func (m *Message) WithError() *Message

WithError adds an icon to the message indicating that an error has occurred.

func (*Message) WithInfo

func (m *Message) WithInfo() *Message

WithInfo adds an icon to the message indicating that the message is informational.

func (*Message) WithOwner added in v0.9.0

func (m *Message) WithOwner(owner Owner) *Message

WithOwner sets the owner of the dialog box.

func (*Message) WithTitle

func (m *Message) WithTitle(text string) *Message

WithTitle adds a title to the message's dialog.

func (*Message) WithWarn

func (m *Message) WithWarn() *Message

WithWarn adds an icon to the message indicating that the message is a warning.

type OpenFile

type OpenFile struct {
	Dialog
	// contains filtered or unexported fields
}

OpenFile is a builder to construct an open file dialog to the user.

func NewOpenFile

func NewOpenFile() *OpenFile

NewOpenFile initializes a new open file dialog. Use of the method OpenFileDialog on an existing Window is preferred, as the message can be set as a child of the top-level window.

func (*OpenFile) AddFilter

func (m *OpenFile) AddFilter(name, pattern string) *OpenFile

AddFilter adds a filter to the list of filename patterns that the user can select.

func (*OpenFile) Show

func (m *OpenFile) Show() (string, error)

Show completes building of the message, and shows the message to the user.

func (*OpenFile) WithFilename

func (m *OpenFile) WithFilename(filename string) *OpenFile

WithFilename sets the current or default filename for the dialog.

func (*OpenFile) WithOwner added in v0.9.0

func (m *OpenFile) WithOwner(owner Owner) *OpenFile

WithOwner sets the owner of the dialog box.

func (*OpenFile) WithTitle

func (m *OpenFile) WithTitle(text string) *OpenFile

WithTitle adds a title to the dialog.

type Owner added in v0.9.0

type Owner struct {
	Handle uintptr
}

Owner holds a pointer to the owning window. This type varies between platforms.

type SaveFile

type SaveFile struct {
	Dialog
	// contains filtered or unexported fields
}

SaveFile is a builder to construct an open file dialog to the user.

func NewSaveFile

func NewSaveFile() *SaveFile

NewSaveFile initializes a new open file dialog. Use of the method SaveFileDialog on an existing Window is preferred, as the message can be set as a child of the top-level window.

func (*SaveFile) AddFilter

func (m *SaveFile) AddFilter(name, pattern string) *SaveFile

AddFilter adds a filter to the list of filename patterns that the user can select.

func (*SaveFile) Show

func (m *SaveFile) Show() (string, error)

Show completes building of the message, and shows the message to the user.

func (*SaveFile) WithFilename

func (m *SaveFile) WithFilename(filename string) *SaveFile

WithFilename sets the current or default filename for the dialog.

func (*SaveFile) WithOwner added in v0.9.0

func (m *SaveFile) WithOwner(owner Owner) *SaveFile

WithOwner sets the owner of the dialog box.

func (*SaveFile) WithTitle

func (m *SaveFile) WithTitle(text string) *SaveFile

WithTitle adds a title to the dialog.

Jump to

Keyboard shortcuts

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