dialog

package
v0.0.0-...-241255c Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: BSD-3-Clause Imports: 6 Imported by: 0

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 dialogs..

func (*Dialog) Err

func (d *Dialog) Err() error

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

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) WithParent

func (m *Message) WithParent(parent *gtk.Window) *Message

WithParent sets the parent 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) WithParent

func (m *OpenFile) WithParent(parent *gtk.Window) *OpenFile

WithParent sets the parent of the dialog box.

func (*OpenFile) WithTitle

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

WithTitle adds a title to the dialog.

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) WithParent

func (m *SaveFile) WithParent(parent *gtk.Window) *SaveFile

WithParent sets the parent 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