toolkit

package
v0.0.0-...-226917b Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShowConfirmDialog

func ShowConfirmDialog(state *ui.State, title, message, ok, cancel string, action func(*ui.State))

func ShowErrorDialog

func ShowErrorDialog(state *ui.State, title, message, button string)

func ShowInputDialog

func ShowInputDialog(state *ui.State, title, message, button, cancel string, action func(*ui.State, string))

func ShowMessageDialog

func ShowMessageDialog(state *ui.State, title, message, button string)

func ShowOpenDialog

func ShowOpenDialog(state *ui.State, fc *FileChooser, title, open, cancel string, action func(*ui.State, string))

func ShowOpenFolderDialog

func ShowOpenFolderDialog(state *ui.State, fc *FileChooser, title, open, enter, cancel string, action func(*ui.State, string))

func ShowSaveDialog

func ShowSaveDialog(state *ui.State, fc *FileChooser, title, save, cancel string, action func(*ui.State, string))

func ShowYesNoDialog

func ShowYesNoDialog(state *ui.State, title, message, yes, no, cancel string, yesAction, noAction func(*ui.State))

Types

type Bar

type Bar struct {
	Components []ui.Component
	Fill       int
}

func NewBar

func NewBar(fill int, c ...ui.Component) *Bar

func (*Bar) PreferredSize

func (b *Bar) PreferredSize(state *ui.State) (float64, float64)

func (*Bar) Update

func (b *Bar) Update(state *ui.State)

type Button

type Button struct {
	Action  func(*ui.State)
	Content ui.Component
}

func NewButton

func NewButton(text string, action func(*ui.State)) *Button

func NewButtonIcon

func NewButtonIcon(icon string, action func(*ui.State)) *Button

func (*Button) PreferredSize

func (b *Button) PreferredSize(state *ui.State) (float64, float64)

func (*Button) Update

func (b *Button) Update(state *ui.State)

type CheckBox

type CheckBox struct {
	Checked bool
	Changed func(*ui.State, bool)
	Text    string
}

func NewCheckBox

func NewCheckBox(text string) *CheckBox

func (*CheckBox) PreferredSize

func (c *CheckBox) PreferredSize(state *ui.State) (float64, float64)

func (*CheckBox) Update

func (c *CheckBox) Update(state *ui.State)

type Container

type Container struct {
	Center, Top, Bottom, Left, Right ui.Component
}

func (*Container) PreferredSize

func (c *Container) PreferredSize(state *ui.State) (float64, float64)

func (*Container) Update

func (c *Container) Update(state *ui.State)

type Divider

type Divider struct {
	First, Second ui.Component
	Vertical      bool
	// contains filtered or unexported fields
}

func NewHorizontalDivider

func NewHorizontalDivider(left, right ui.Component) *Divider

func NewVerticalDivider

func NewVerticalDivider(top, bottom ui.Component) *Divider

func (*Divider) PreferredSize

func (d *Divider) PreferredSize(state *ui.State) (float64, float64)

func (*Divider) Update

func (d *Divider) Update(state *ui.State)
type Dropdown struct {
	Changed func(*ui.State, int, ListItem)
	// contains filtered or unexported fields
}

func NewDropdown

func NewDropdown() *Dropdown
func (d *Dropdown) AddItem(text string)
func (d *Dropdown) AddItemIcon(icon, text string)
func (d *Dropdown) Items() []ListItem
func (d *Dropdown) PreferredSize(state *ui.State) (float64, float64)
func (d *Dropdown) Selected() int
func (d *Dropdown) SetItems(it []ListItem)
func (d *Dropdown) SetSelected(s int)
func (d *Dropdown) TriggerChanged(state *ui.State)
func (d *Dropdown) Update(state *ui.State)

type FileChooser

type FileChooser struct {
	Action   func(*ui.State, string)
	FileIcon func(fs.FileInfo) string
	// contains filtered or unexported fields
}

func NewFileChooser

func NewFileChooser() *FileChooser

func (*FileChooser) PreferredSize

func (f *FileChooser) PreferredSize(state *ui.State) (float64, float64)

func (*FileChooser) SetPath

func (f *FileChooser) SetPath(path string)

func (*FileChooser) Setup

func (f *FileChooser) Setup(action, cancel string)

func (*FileChooser) SetupFolder

func (f *FileChooser) SetupFolder(action, enter, cancel string)

func (*FileChooser) SetupOpen

func (f *FileChooser) SetupOpen(action, cancel string)

func (*FileChooser) Update

func (f *FileChooser) Update(state *ui.State)

type FixedSize

type FixedSize struct {
	Content       ui.Component
	Width, Height float64
}

func (*FixedSize) PreferredSize

func (f *FixedSize) PreferredSize(state *ui.State) (float64, float64)

func (*FixedSize) Update

func (f *FixedSize) Update(state *ui.State)

type Form

type Form struct {
	Fields []FormField
}

func NewForm

func NewForm() *Form

func (*Form) AddField

func (f *Form) AddField(label string, c ui.Component)

func (*Form) PreferredSize

func (f *Form) PreferredSize(state *ui.State) (float64, float64)

func (*Form) Update

func (f *Form) Update(state *ui.State)

type FormField

type FormField struct {
	Content ui.Component
	Label   string
}

type Frame

type Frame struct {
	Content ui.Component
	Color   draw.Color
	Title   string
	Icon    string
}

func NewFrame

func NewFrame(icon, title string, content ui.Component, color draw.Color) *Frame

func (*Frame) PreferredSize

func (f *Frame) PreferredSize(state *ui.State) (float64, float64)

func (*Frame) Update

func (f *Frame) Update(state *ui.State)

type Icon

type Icon string

func (Icon) PreferredSize

func (i Icon) PreferredSize(state *ui.State) (float64, float64)

func (Icon) Update

func (i Icon) Update(state *ui.State)

type Label

type Label string

func (Label) PreferredSize

func (l Label) PreferredSize(state *ui.State) (float64, float64)

func (Label) Update

func (l Label) Update(state *ui.State)

type List

type List struct {
	Items         []ListItem
	Selected      int
	Changed       func(*ui.State, int, ListItem)
	Action        func(*ui.State, int, ListItem)
	ActionOnClick bool
	// contains filtered or unexported fields
}

func NewList

func NewList() *List

func (*List) AddItem

func (l *List) AddItem(text string)

func (*List) AddItemIcon

func (l *List) AddItemIcon(icon, text string)

func (*List) InsertItem

func (l *List) InsertItem(i int, text string)

func (*List) InsertItemIcon

func (l *List) InsertItemIcon(i int, icon, text string)

func (*List) PreferredSize

func (l *List) PreferredSize(state *ui.State) (float64, float64)

func (*List) RemoveItem

func (l *List) RemoveItem(i int)

func (*List) SwapItems

func (l *List) SwapItems(i, j int)

func (*List) Update

func (l *List) Update(state *ui.State)

type ListItem

type ListItem struct {
	Icon string
	Text string
}
type Menu struct {
	Text  string
	Items []ui.Component
	// contains filtered or unexported fields
}

func NewPopupMenu

func NewPopupMenu() *Menu
func (m *Menu) AddItem(text string, action func(*ui.State)) *MenuItem
func (m *Menu) AddItemIcon(icon, text string, action func(*ui.State)) *MenuItem
func (m *Menu) AddMenu(text string) *Menu
func (m *Menu) OpenPopupMenu(x, y float64, state *ui.State)
func (m *Menu) PreferredSize(state *ui.State) (float64, float64)
func (m *Menu) Update(state *ui.State)
type MenuBar struct {
	// contains filtered or unexported fields
}

func NewMenuBar

func NewMenuBar() *MenuBar
func (m *MenuBar) AddMenu(name string) *Menu
func (m *MenuBar) PreferredSize(state *ui.State) (float64, float64)
func (m *MenuBar) Update(state *ui.State)
type MenuItem struct {
	Text   string
	Icon   string
	Action func(*ui.State)
	// contains filtered or unexported fields
}
func (m *MenuItem) PreferredSize(state *ui.State) (float64, float64)
func (m *MenuItem) Update(state *ui.State)

type Padding

type Padding struct {
	Content                  ui.Component
	Left, Right, Top, Bottom float64
}

func NewPadding

func NewPadding(c ui.Component, p float64) *Padding

func (*Padding) PreferredSize

func (p *Padding) PreferredSize(state *ui.State) (float64, float64)

func (*Padding) Update

func (p *Padding) Update(state *ui.State)

type Root

type Root struct {
	Content ui.Component
	Dialog  ui.Component
	// contains filtered or unexported fields
}

func NewRoot

func NewRoot(content ui.Component) *Root

func (*Root) CloseDialog

func (r *Root) CloseDialog()

func (*Root) ClosePopups

func (r *Root) ClosePopups()

func (*Root) HasPopups

func (r *Root) HasPopups() bool

func (*Root) OpenDialog

func (r *Root) OpenDialog(dialog ui.Component)

func (*Root) OpenPopup

func (r *Root) OpenPopup(bounds draw.Rect, p ui.Component) ui.Popup

func (*Root) PreferredSize

func (r *Root) PreferredSize(state *ui.State) (float64, float64)

func (*Root) Update

func (r *Root) Update(state *ui.State)

type ScrollView

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

func NewScrollView

func NewScrollView(content ui.Component) *ScrollView

func (*ScrollView) PreferredSize

func (s *ScrollView) PreferredSize(state *ui.State) (float64, float64)

func (*ScrollView) Update

func (s *ScrollView) Update(state *ui.State)

type Shadow

type Shadow struct {
	Content ui.Component
}

func (*Shadow) PreferredSize

func (s *Shadow) PreferredSize(state *ui.State) (float64, float64)

func (*Shadow) Update

func (s *Shadow) Update(state *ui.State)

type Stack

type Stack struct {
	Content []ui.Component
	Gap     float64
}

func NewStack

func NewStack(c ...ui.Component) *Stack

func (*Stack) PreferredSize

func (s *Stack) PreferredSize(state *ui.State) (float64, float64)

func (*Stack) Update

func (s *Stack) Update(state *ui.State)

type TextArea

type TextArea struct {
	Editable bool
	// contains filtered or unexported fields
}

func NewTextArea

func NewTextArea() *TextArea

func (*TextArea) Append

func (t *TextArea) Append(text string)

func (*TextArea) AppendFromReader

func (t *TextArea) AppendFromReader(r io.Reader) error

func (*TextArea) Changed

func (t *TextArea) Changed() bool

func (*TextArea) Copy

func (t *TextArea) Copy(state *ui.State)

func (*TextArea) Cut

func (t *TextArea) Cut(state *ui.State)

func (*TextArea) Lines

func (t *TextArea) Lines() []string

func (*TextArea) Paste

func (t *TextArea) Paste(state *ui.State)

func (*TextArea) PreferredSize

func (t *TextArea) PreferredSize(state *ui.State) (float64, float64)

func (*TextArea) Reader

func (t *TextArea) Reader() io.Reader

Reader returns an io.Reader that will read from the contents of the text area. Changes to the text area's content after this method is called will not affect the returned Reader.

func (*TextArea) ReplaceSelection

func (t *TextArea) ReplaceSelection(text string)

func (*TextArea) SelectAll

func (t *TextArea) SelectAll(state *ui.State)

func (*TextArea) SelectedText

func (t *TextArea) SelectedText() string

func (*TextArea) SetLines

func (t *TextArea) SetLines(l []string)

func (*TextArea) SetText

func (t *TextArea) SetText(text string)

func (*TextArea) SetTextFromReader

func (t *TextArea) SetTextFromReader(r io.Reader) error

func (*TextArea) Text

func (t *TextArea) Text() string

func (*TextArea) Update

func (t *TextArea) Update(state *ui.State)

func (*TextArea) WriteTextTo

func (t *TextArea) WriteTextTo(w io.Writer) error

type TextField

type TextField struct {
	Editable    bool
	Action      func(*ui.State, string)
	Width       float64
	Text        string
	Placeholder string
	// contains filtered or unexported fields
}

func NewTextField

func NewTextField(placeholder string) *TextField

func (*TextField) Copy

func (t *TextField) Copy(state *ui.State)

func (*TextField) Cut

func (t *TextField) Cut(state *ui.State)

func (*TextField) Paste

func (t *TextField) Paste(state *ui.State)

func (*TextField) PreferredSize

func (t *TextField) PreferredSize(state *ui.State) (float64, float64)

func (*TextField) SelectAll

func (t *TextField) SelectAll(state *ui.State)

func (*TextField) SelectedText

func (t *TextField) SelectedText() string

func (*TextField) TriggerAction

func (t *TextField) TriggerAction(state *ui.State)

func (*TextField) Update

func (t *TextField) Update(state *ui.State)

type Theme

type Theme struct {
	Colors map[string]draw.Color
	Fonts  map[string]draw.Font
}

func DefaultTheme

func DefaultTheme() *Theme

func (*Theme) Color

func (t *Theme) Color(name string) draw.Color

func (*Theme) Enter

func (t *Theme) Enter(name string)

func (*Theme) Font

func (t *Theme) Font(name string) draw.Font

func (*Theme) Leave

func (t *Theme) Leave()

Jump to

Keyboard shortcuts

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