wui

package module
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: MIT Imports: 18 Imported by: 1

README

Windows GUI Library

This is a pure Go library to create native Windows GUIs.

See the documentation for details.

Minimal Example

This is all the code you need to create a window (which does not do much).

package main

import "github.com/gonutz/wui"

func main() {
	wui.NewWindow().Show()
}

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MessageBox

func MessageBox(caption, text string)

func MessageBoxCustom

func MessageBoxCustom(caption, text string, flags uint) int

func MessageBoxError

func MessageBoxError(caption, text string)

func MessageBoxInfo

func MessageBoxInfo(caption, text string)

func MessageBoxOKCancel

func MessageBoxOKCancel(caption, text string) bool

func MessageBoxQuestion

func MessageBoxQuestion(caption, text string)

func MessageBoxWarning

func MessageBoxWarning(caption, text string)

func MessageBoxYesNo

func MessageBoxYesNo(caption, text string) bool

Types

type Button

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

func NewButton

func NewButton() *Button

func (*Button) CursorPosition

func (c *Button) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*Button) Focus

func (c *Button) Focus()

func (*Button) Font

func (c *Button) Font() *Font

func (*Button) HasFocus

func (c *Button) HasFocus() bool

func (*Button) OnClick

func (b *Button) OnClick() func()

func (*Button) SelectAll

func (c *Button) SelectAll()

func (*Button) SetCursorPosition

func (c *Button) SetCursorPosition(pos int)

func (*Button) SetFont

func (c *Button) SetFont(font *Font)

func (*Button) SetOnClick

func (b *Button) SetOnClick(f func())

func (*Button) SetSelection

func (c *Button) SetSelection(start, end int)

func (*Button) SetText

func (c *Button) SetText(text string)

func (*Button) Text

func (c *Button) Text() string

type Canvas

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

func (*Canvas) Arc

func (c *Canvas) Arc(x, y, width, height int, fromClockAngle, dAngle float64, color Color)

func (*Canvas) DrawEllipse

func (c *Canvas) DrawEllipse(x, y, width, height int, color Color)

func (*Canvas) DrawImage

func (c *Canvas) DrawImage(img *Image, src Rectangle, destX, destY int)

func (*Canvas) DrawPie

func (c *Canvas) DrawPie(x, y, width, height int, fromClockAngle, dAngle float64, color Color)

func (*Canvas) DrawRect

func (c *Canvas) DrawRect(x, y, width, height int, color Color)

func (*Canvas) FillEllipse

func (c *Canvas) FillEllipse(x, y, width, height int, color Color)

func (*Canvas) FillPie

func (c *Canvas) FillPie(x, y, width, height int, fromClockAngle, dAngle float64, color Color)

func (*Canvas) FillRect

func (c *Canvas) FillRect(x, y, width, height int, color Color)

func (*Canvas) Height

func (c *Canvas) Height() int

func (*Canvas) Line

func (c *Canvas) Line(x1, y1, x2, y2 int, color Color)

func (*Canvas) Polygon

func (c *Canvas) Polygon(p []w32.POINT, color Color)

func (*Canvas) Polyline

func (c *Canvas) Polyline(p []w32.POINT, color Color)

func (*Canvas) SetFont

func (c *Canvas) SetFont(font *Font)

func (*Canvas) Size

func (c *Canvas) Size() (width, height int)

func (*Canvas) TextExtent

func (c *Canvas) TextExtent(s string) (width, height int)

func (*Canvas) TextOut

func (c *Canvas) TextOut(x, y int, s string, color Color)

func (*Canvas) TextRect

func (c *Canvas) TextRect(x, y, w, h int, s string, color Color)

func (*Canvas) TextRectExtent

func (c *Canvas) TextRectExtent(s string, givenWidth int) (width, height int)

TextRectExtent returns the size of the text when drawn in a rectangle of the given width. The given width is necessary because text rects use word breaks and thus given a smaller width might produce a higher text height.

func (*Canvas) TextRectFormat

func (c *Canvas) TextRectFormat(x, y, w, h int, s string, format Format, color Color)

func (*Canvas) Width

func (c *Canvas) Width() int

type Checkbox

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

func NewCheckbox

func NewCheckbox() *Checkbox

func (*Checkbox) Checked

func (c *Checkbox) Checked() bool

func (*Checkbox) CursorPosition

func (c *Checkbox) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*Checkbox) Focus

func (c *Checkbox) Focus()

func (*Checkbox) Font

func (c *Checkbox) Font() *Font

func (*Checkbox) HasFocus

func (c *Checkbox) HasFocus() bool

func (*Checkbox) SelectAll

func (c *Checkbox) SelectAll()

func (*Checkbox) SetChecked

func (c *Checkbox) SetChecked(checked bool)

func (*Checkbox) SetCursorPosition

func (c *Checkbox) SetCursorPosition(pos int)

func (*Checkbox) SetFont

func (c *Checkbox) SetFont(font *Font)

func (*Checkbox) SetOnChange

func (c *Checkbox) SetOnChange(f func(checked bool))

func (*Checkbox) SetSelection

func (c *Checkbox) SetSelection(start, end int)

func (*Checkbox) SetText

func (c *Checkbox) SetText(text string)

func (*Checkbox) Text

func (c *Checkbox) Text() string

type Color

type Color w32.COLORREF

func RGB

func RGB(r, g, b uint8) Color

func (Color) B

func (c Color) B() uint8

func (Color) G

func (c Color) G() uint8

func (Color) R

func (c Color) R() uint8

type Combobox

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

func NewCombobox

func NewCombobox() *Combobox

func (*Combobox) Add

func (e *Combobox) Add(s string)

func (*Combobox) Clear

func (e *Combobox) Clear()

func (*Combobox) CursorPosition

func (c *Combobox) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*Combobox) Focus

func (c *Combobox) Focus()

func (*Combobox) Font

func (c *Combobox) Font() *Font

func (*Combobox) HasFocus

func (c *Combobox) HasFocus() bool

func (*Combobox) Items

func (e *Combobox) Items() []string

func (*Combobox) SelectAll

func (c *Combobox) SelectAll()

func (*Combobox) SelectedIndex

func (e *Combobox) SelectedIndex() int

func (*Combobox) SetCursorPosition

func (c *Combobox) SetCursorPosition(pos int)

func (*Combobox) SetFont

func (c *Combobox) SetFont(font *Font)

func (*Combobox) SetOnChange

func (e *Combobox) SetOnChange(f func(newIndex int))

func (*Combobox) SetSelectedIndex

func (e *Combobox) SetSelectedIndex(i int)

func (*Combobox) SetSelection

func (c *Combobox) SetSelection(start, end int)

func (*Combobox) SetText

func (c *Combobox) SetText(text string)

func (*Combobox) Text

func (c *Combobox) Text() string

type Container

type Container interface {
	Add(Control)
}

type Control

type Control interface {
	// contains filtered or unexported methods
}

type EditLine

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

func NewEditLine

func NewEditLine() *EditLine

func (*EditLine) CharacterLimit

func (e *EditLine) CharacterLimit() int

func (*EditLine) CursorPosition

func (c *EditLine) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*EditLine) Focus

func (c *EditLine) Focus()

func (*EditLine) Font

func (c *EditLine) Font() *Font

func (*EditLine) HasFocus

func (c *EditLine) HasFocus() bool

func (*EditLine) IsPassword

func (e *EditLine) IsPassword() bool

func (*EditLine) OnTextChange

func (e *EditLine) OnTextChange() func()

func (*EditLine) SelectAll

func (c *EditLine) SelectAll()

func (*EditLine) SetCharacterLimit

func (e *EditLine) SetCharacterLimit(count int)

func (*EditLine) SetCursorPosition

func (c *EditLine) SetCursorPosition(pos int)

func (*EditLine) SetFont

func (c *EditLine) SetFont(font *Font)

func (*EditLine) SetOnTextChange

func (e *EditLine) SetOnTextChange(f func())

func (*EditLine) SetPassword

func (e *EditLine) SetPassword(isPass bool)

func (*EditLine) SetSelection

func (c *EditLine) SetSelection(start, end int)

func (*EditLine) SetText

func (c *EditLine) SetText(text string)

func (*EditLine) Text

func (c *EditLine) Text() string

type FileOpenDialog

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

func NewFileOpenDialog

func NewFileOpenDialog() *FileOpenDialog

func (*FileOpenDialog) AddFilter

func (dlg *FileOpenDialog) AddFilter(text, ext1 string, exts ...string)

func (*FileOpenDialog) ExecuteMultiSelection

func (dlg *FileOpenDialog) ExecuteMultiSelection(parent *Window) (bool, []string)

func (*FileOpenDialog) ExecuteSingleSelection

func (dlg *FileOpenDialog) ExecuteSingleSelection(parent *Window) (bool, string)

func (*FileOpenDialog) SetFilterIndex

func (dlg *FileOpenDialog) SetFilterIndex(i int)

SetFilterIndex sets the active filter, 0-indexed.

func (*FileOpenDialog) SetInitialPath

func (dlg *FileOpenDialog) SetInitialPath(path string)

func (*FileOpenDialog) SetTitle

func (dlg *FileOpenDialog) SetTitle(title string)

type FileSaveDialog

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

func NewFileSaveDialog

func NewFileSaveDialog() *FileSaveDialog

func (*FileSaveDialog) AddFilter

func (dlg *FileSaveDialog) AddFilter(text, ext1 string, exts ...string)

func (*FileSaveDialog) Execute

func (dlg *FileSaveDialog) Execute(parent *Window) (bool, string)

func (*FileSaveDialog) SetAppendExt

func (dlg *FileSaveDialog) SetAppendExt(ext bool)

func (*FileSaveDialog) SetFilterIndex

func (dlg *FileSaveDialog) SetFilterIndex(i int)

SetFilterIndex sets the active filter, 0-indexed.

func (*FileSaveDialog) SetInitialPath

func (dlg *FileSaveDialog) SetInitialPath(path string)

func (*FileSaveDialog) SetTitle

func (dlg *FileSaveDialog) SetTitle(title string)

type FloatUpDown

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

func NewFloatUpDown

func NewFloatUpDown() *FloatUpDown

func (*FloatUpDown) CursorPosition

func (c *FloatUpDown) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*FloatUpDown) Focus

func (c *FloatUpDown) Focus()

func (*FloatUpDown) Font

func (c *FloatUpDown) Font() *Font

func (*FloatUpDown) HasFocus

func (c *FloatUpDown) HasFocus() bool

func (*FloatUpDown) MaxValue

func (n *FloatUpDown) MaxValue() float64

func (*FloatUpDown) MinMaxValues

func (n *FloatUpDown) MinMaxValues() (min, max int)

func (*FloatUpDown) MinValue

func (n *FloatUpDown) MinValue() float64

func (*FloatUpDown) Precision

func (n *FloatUpDown) Precision() int

func (*FloatUpDown) SelectAll

func (c *FloatUpDown) SelectAll()

func (*FloatUpDown) SetBounds

func (n *FloatUpDown) SetBounds(x, y, width, height int)

func (*FloatUpDown) SetCursorPosition

func (c *FloatUpDown) SetCursorPosition(pos int)

func (*FloatUpDown) SetFont

func (c *FloatUpDown) SetFont(font *Font)

func (*FloatUpDown) SetHeight

func (n *FloatUpDown) SetHeight(height int)

func (*FloatUpDown) SetMaxValue

func (n *FloatUpDown) SetMaxValue(max float64)

func (*FloatUpDown) SetMinMaxValues

func (n *FloatUpDown) SetMinMaxValues(min, max float64)

func (*FloatUpDown) SetMinValue

func (n *FloatUpDown) SetMinValue(min float64)

func (*FloatUpDown) SetPos

func (n *FloatUpDown) SetPos(x, y int)

func (*FloatUpDown) SetPrecision

func (n *FloatUpDown) SetPrecision(p int)

func (*FloatUpDown) SetSelection

func (c *FloatUpDown) SetSelection(start, end int)

func (*FloatUpDown) SetSize

func (n *FloatUpDown) SetSize(width, height int)

func (*FloatUpDown) SetText

func (c *FloatUpDown) SetText(text string)

func (*FloatUpDown) SetValue

func (n *FloatUpDown) SetValue(f float64)

func (*FloatUpDown) SetWidth

func (n *FloatUpDown) SetWidth(width int)

func (*FloatUpDown) SetX

func (n *FloatUpDown) SetX(x int)

func (*FloatUpDown) SetY

func (n *FloatUpDown) SetY(y int)

func (*FloatUpDown) Text

func (c *FloatUpDown) Text() string

func (*FloatUpDown) Value

func (n *FloatUpDown) Value() float64

type FolderSelectDialog

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

func NewFolderSelectDialog

func NewFolderSelectDialog() *FolderSelectDialog

func (*FolderSelectDialog) Execute

func (dlg *FolderSelectDialog) Execute(parent *Window) (bool, string)

func (*FolderSelectDialog) SetTitle

func (dlg *FolderSelectDialog) SetTitle(title string)

type Font

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

func NewFont

func NewFont(desc FontDesc) (*Font, error)

type FontDesc

type FontDesc struct {
	Name       string
	Height     int
	Bold       bool
	Italic     bool
	Underlined bool
	StrikedOut bool
}

type Format

type Format int
const (
	FormatTopLeft Format = iota
	FormatCenterLeft
	FormatBottomLeft
	FormatTopCenter
	FormatCenter
	FormatBottomCenter
	FormatTopRight
	FormatCenterRight
	FormatBottomRight
)

type Image

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

func NewImage

func NewImage(img image.Image) *Image

func NewImageFromHBITMAP

func NewImageFromHBITMAP(bitmap w32.HBITMAP, width, height int) *Image

func (*Image) Bounds

func (img *Image) Bounds() Rectangle

func (*Image) Height

func (img *Image) Height() int

func (*Image) Size

func (img *Image) Size() (w, h int)

func (*Image) Width

func (img *Image) Width() int

type IntUpDown

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

func NewIntUpDown

func NewIntUpDown() *IntUpDown

func (*IntUpDown) CursorPosition

func (c *IntUpDown) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*IntUpDown) Focus

func (c *IntUpDown) Focus()

func (*IntUpDown) Font

func (c *IntUpDown) Font() *Font

func (*IntUpDown) HasFocus

func (c *IntUpDown) HasFocus() bool

func (*IntUpDown) MaxValue

func (n *IntUpDown) MaxValue() int

func (*IntUpDown) MinMaxValues

func (n *IntUpDown) MinMaxValues() (min, max int)

func (*IntUpDown) MinValue

func (n *IntUpDown) MinValue() int

func (*IntUpDown) SelectAll

func (c *IntUpDown) SelectAll()

func (*IntUpDown) SetBounds

func (n *IntUpDown) SetBounds(x, y, width, height int)

func (*IntUpDown) SetCursorPosition

func (c *IntUpDown) SetCursorPosition(pos int)

func (*IntUpDown) SetFont

func (c *IntUpDown) SetFont(font *Font)

func (*IntUpDown) SetHeight

func (n *IntUpDown) SetHeight(height int)

func (*IntUpDown) SetMaxValue

func (n *IntUpDown) SetMaxValue(max int)

func (*IntUpDown) SetMinMaxValues

func (n *IntUpDown) SetMinMaxValues(min, max int)

func (*IntUpDown) SetMinValue

func (n *IntUpDown) SetMinValue(min int)

func (*IntUpDown) SetOnValueChange

func (n *IntUpDown) SetOnValueChange(f func(value int))

func (*IntUpDown) SetPos

func (n *IntUpDown) SetPos(x, y int)

func (*IntUpDown) SetSelection

func (c *IntUpDown) SetSelection(start, end int)

func (*IntUpDown) SetSize

func (n *IntUpDown) SetSize(width, height int)

func (*IntUpDown) SetText

func (c *IntUpDown) SetText(text string)

func (*IntUpDown) SetValue

func (n *IntUpDown) SetValue(v int)

func (*IntUpDown) SetWidth

func (n *IntUpDown) SetWidth(width int)

func (*IntUpDown) SetX

func (n *IntUpDown) SetX(x int)

func (*IntUpDown) SetY

func (n *IntUpDown) SetY(y int)

func (*IntUpDown) Text

func (c *IntUpDown) Text() string

func (*IntUpDown) Value

func (n *IntUpDown) Value() int

type KeyMod

type KeyMod int
const (
	ModControl KeyMod = 1 << iota
	ModShift
	ModAlt
)

type Label

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

func NewLabel

func NewLabel() *Label

func (*Label) CursorPosition

func (c *Label) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*Label) Focus

func (c *Label) Focus()

func (*Label) Font

func (c *Label) Font() *Font

func (*Label) HasFocus

func (c *Label) HasFocus() bool

func (*Label) SelectAll

func (c *Label) SelectAll()

func (*Label) SetCenterAlign

func (l *Label) SetCenterAlign() *Label

func (*Label) SetCursorPosition

func (c *Label) SetCursorPosition(pos int)

func (*Label) SetFont

func (c *Label) SetFont(font *Font)

func (*Label) SetLeftAlign

func (l *Label) SetLeftAlign() *Label

func (*Label) SetRightAlign

func (l *Label) SetRightAlign() *Label

func (*Label) SetSelection

func (c *Label) SetSelection(start, end int)

func (*Label) SetText

func (c *Label) SetText(text string)

func (*Label) Text

func (c *Label) Text() string
type Menu struct {
	// contains filtered or unexported fields
}

func NewMainMenu

func NewMainMenu() *Menu

func NewMenu

func NewMenu(name string) *Menu
func (m *Menu) Add(item MenuItem) *Menu
type MenuItem interface {
	// contains filtered or unexported methods
}

MenuItem is something that can go into a menu. Possible such things can be created via: NewMenu, NewMenuString, NewMenuSeparator.

func NewMenuSeparator

func NewMenuSeparator() MenuItem
type MenuString struct {
	// contains filtered or unexported fields
}

func NewMenuString

func NewMenuString(text string) *MenuString
func (m *MenuString) Checked() bool
func (m *MenuString) OnClick() func()
func (m *MenuString) SetChecked(c bool)
func (m *MenuString) SetOnClick(f func()) *MenuString
func (m *MenuString) SetText(s string)
func (m *MenuString) Text() string

type MouseButton

type MouseButton int
const (
	MouseButtonLeft MouseButton = iota
	MouseButtonMiddle
	MouseButtonRight
)

func (MouseButton) String

func (b MouseButton) String() string

type Paintbox

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

func NewPaintbox

func NewPaintbox() *Paintbox

func (*Paintbox) Bounds

func (c *Paintbox) Bounds() (x, y, width, height int)

func (*Paintbox) Enabled

func (c *Paintbox) Enabled() bool

func (*Paintbox) Height

func (c *Paintbox) Height() int

func (*Paintbox) OnResize

func (c *Paintbox) OnResize() func()

func (*Paintbox) Paint

func (p *Paintbox) Paint()

func (*Paintbox) Pos

func (c *Paintbox) Pos() (x, y int)

func (*Paintbox) SetBounds

func (c *Paintbox) SetBounds(x, y, width, height int)

func (*Paintbox) SetEnabled

func (c *Paintbox) SetEnabled(e bool)

func (*Paintbox) SetHeight

func (c *Paintbox) SetHeight(height int)

func (*Paintbox) SetOnPaint

func (p *Paintbox) SetOnPaint(f func(*Canvas))

func (*Paintbox) SetOnResize

func (c *Paintbox) SetOnResize(f func())

func (*Paintbox) SetPos

func (c *Paintbox) SetPos(x, y int)

func (*Paintbox) SetSize

func (c *Paintbox) SetSize(width, height int)

func (*Paintbox) SetVisible

func (c *Paintbox) SetVisible(v bool)

func (*Paintbox) SetWidth

func (c *Paintbox) SetWidth(width int)

func (*Paintbox) SetX

func (c *Paintbox) SetX(x int)

func (*Paintbox) SetY

func (c *Paintbox) SetY(y int)

func (*Paintbox) Size

func (c *Paintbox) Size() (width, height int)

func (*Paintbox) Visible

func (c *Paintbox) Visible() bool

func (*Paintbox) Width

func (c *Paintbox) Width() int

func (*Paintbox) X

func (c *Paintbox) X() int

func (*Paintbox) Y

func (c *Paintbox) Y() int

type Panel

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

func NewPanel

func NewPanel() *Panel

func (*Panel) Add

func (p *Panel) Add(c Control)

TODO there is a bug in this when Adding control while parent is not set

func (*Panel) Bounds

func (c *Panel) Bounds() (x, y, width, height int)

func (*Panel) Enabled

func (c *Panel) Enabled() bool

func (*Panel) Font

func (p *Panel) Font() *Font

func (*Panel) Height

func (c *Panel) Height() int

func (*Panel) OnResize

func (c *Panel) OnResize() func()

func (*Panel) Pos

func (c *Panel) Pos() (x, y int)

func (*Panel) SetBounds

func (c *Panel) SetBounds(x, y, width, height int)

func (*Panel) SetEnabled

func (c *Panel) SetEnabled(e bool)

func (*Panel) SetFont

func (p *Panel) SetFont(f *Font)

func (*Panel) SetHeight

func (c *Panel) SetHeight(height int)

func (*Panel) SetNoBorder

func (p *Panel) SetNoBorder()

func (*Panel) SetOnResize

func (c *Panel) SetOnResize(f func())

func (*Panel) SetPos

func (c *Panel) SetPos(x, y int)

func (*Panel) SetRaisedBorder

func (p *Panel) SetRaisedBorder()

func (*Panel) SetSingleLineBorder

func (p *Panel) SetSingleLineBorder()

func (*Panel) SetSize

func (c *Panel) SetSize(width, height int)

func (*Panel) SetSunkenBorder

func (p *Panel) SetSunkenBorder()

func (*Panel) SetSunkenThickBorder

func (p *Panel) SetSunkenThickBorder()

func (*Panel) SetVisible

func (c *Panel) SetVisible(v bool)

func (*Panel) SetWidth

func (c *Panel) SetWidth(width int)

func (*Panel) SetX

func (c *Panel) SetX(x int)

func (*Panel) SetY

func (c *Panel) SetY(y int)

func (*Panel) Size

func (c *Panel) Size() (width, height int)

func (*Panel) Visible

func (c *Panel) Visible() bool

func (*Panel) Width

func (c *Panel) Width() int

func (*Panel) X

func (c *Panel) X() int

func (*Panel) Y

func (c *Panel) Y() int

type ProgressBar

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

func NewProgressBar

func NewProgressBar() *ProgressBar

func (*ProgressBar) Bounds

func (c *ProgressBar) Bounds() (x, y, width, height int)

func (*ProgressBar) Enabled

func (c *ProgressBar) Enabled() bool

func (*ProgressBar) Height

func (c *ProgressBar) Height() int

func (*ProgressBar) OnResize

func (c *ProgressBar) OnResize() func()

func (*ProgressBar) Pos

func (c *ProgressBar) Pos() (x, y int)

func (*ProgressBar) SetBounds

func (c *ProgressBar) SetBounds(x, y, width, height int)

func (*ProgressBar) SetEnabled

func (c *ProgressBar) SetEnabled(e bool)

func (*ProgressBar) SetHeight

func (c *ProgressBar) SetHeight(height int)

func (*ProgressBar) SetOnResize

func (c *ProgressBar) SetOnResize(f func())

func (*ProgressBar) SetPos

func (c *ProgressBar) SetPos(x, y int)

func (*ProgressBar) SetSize

func (c *ProgressBar) SetSize(width, height int)

func (*ProgressBar) SetValue

func (p *ProgressBar) SetValue(v float64)

func (*ProgressBar) SetVisible

func (c *ProgressBar) SetVisible(v bool)

func (*ProgressBar) SetWidth

func (c *ProgressBar) SetWidth(width int)

func (*ProgressBar) SetX

func (c *ProgressBar) SetX(x int)

func (*ProgressBar) SetY

func (c *ProgressBar) SetY(y int)

func (*ProgressBar) Size

func (c *ProgressBar) Size() (width, height int)

func (*ProgressBar) Value

func (p *ProgressBar) Value() float64

func (*ProgressBar) Visible

func (c *ProgressBar) Visible() bool

func (*ProgressBar) Width

func (c *ProgressBar) Width() int

func (*ProgressBar) X

func (c *ProgressBar) X() int

func (*ProgressBar) Y

func (c *ProgressBar) Y() int

type RadioButton

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

func NewRadioButton

func NewRadioButton() *RadioButton

func (*RadioButton) Checked

func (r *RadioButton) Checked() bool

func (*RadioButton) CursorPosition

func (c *RadioButton) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*RadioButton) Focus

func (c *RadioButton) Focus()

func (*RadioButton) Font

func (c *RadioButton) Font() *Font

func (*RadioButton) HasFocus

func (c *RadioButton) HasFocus() bool

func (*RadioButton) SelectAll

func (c *RadioButton) SelectAll()

func (*RadioButton) SetChecked

func (r *RadioButton) SetChecked(checked bool)

func (*RadioButton) SetCursorPosition

func (c *RadioButton) SetCursorPosition(pos int)

func (*RadioButton) SetFont

func (c *RadioButton) SetFont(font *Font)

func (*RadioButton) SetOnChange

func (r *RadioButton) SetOnChange(f func(checked bool))

func (*RadioButton) SetSelection

func (c *RadioButton) SetSelection(start, end int)

func (*RadioButton) SetText

func (c *RadioButton) SetText(text string)

func (*RadioButton) Text

func (c *RadioButton) Text() string

type Rectangle

type Rectangle struct {
	X, Y, Width, Height int
}

func Rect

func Rect(x, y, width, height int) Rectangle

type ShortcutKeys

type ShortcutKeys struct {
	// Mod is a bit field combining any of ModControl, ModShift, ModAlt
	Mod KeyMod
	// Rune is the characters to be pressed for the accelerator. Either Rune or
	// Key must be set, if both are set, Rune takes preference.
	Rune rune
	// Key is the virtual key to be pressed, it must be a w32.VK_... constant.
	Key uint16
}

type StringTable

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

func NewStringTable

func NewStringTable(header1 string, headers ...string) *StringTable

func (*StringTable) Clear

func (c *StringTable) Clear()

func (*StringTable) ColCount

func (c *StringTable) ColCount() int

func (*StringTable) CursorPosition

func (c *StringTable) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*StringTable) DeleteRow

func (c *StringTable) DeleteRow(row int)

func (*StringTable) Focus

func (c *StringTable) Focus()

func (*StringTable) Font

func (c *StringTable) Font() *Font

func (*StringTable) HasFocus

func (c *StringTable) HasFocus() bool

func (*StringTable) OnSelectionChange

func (c *StringTable) OnSelectionChange() func()

func (*StringTable) RowCount

func (c *StringTable) RowCount() int

func (*StringTable) SelectAll

func (c *StringTable) SelectAll()

func (*StringTable) SelectedRow

func (c *StringTable) SelectedRow() int

func (*StringTable) SetCell

func (c *StringTable) SetCell(col, row int, s string)

func (*StringTable) SetCursorPosition

func (c *StringTable) SetCursorPosition(pos int)

func (*StringTable) SetFont

func (c *StringTable) SetFont(font *Font)

func (*StringTable) SetOnSelectionChange

func (c *StringTable) SetOnSelectionChange(f func())

func (*StringTable) SetSelection

func (c *StringTable) SetSelection(start, end int)

func (*StringTable) SetText

func (c *StringTable) SetText(text string)

func (*StringTable) Text

func (c *StringTable) Text() string

type TextEdit

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

func NewTextEdit

func NewTextEdit() *TextEdit

func (*TextEdit) CharacterLimit

func (e *TextEdit) CharacterLimit() int

func (*TextEdit) CursorPosition

func (c *TextEdit) CursorPosition() (start, end int)

If a selection is active, start is the index of the first selected UTF-8 character in Text() and end is the position one character after the end of the selection. The selected text is thus

c.Text()[start:end]

func (*TextEdit) Focus

func (c *TextEdit) Focus()

func (*TextEdit) Font

func (c *TextEdit) Font() *Font

func (*TextEdit) HasFocus

func (c *TextEdit) HasFocus() bool

func (*TextEdit) SelectAll

func (c *TextEdit) SelectAll()

func (*TextEdit) SetCharacterLimit

func (e *TextEdit) SetCharacterLimit(count int)

func (*TextEdit) SetCursorPosition

func (c *TextEdit) SetCursorPosition(pos int)

func (*TextEdit) SetFont

func (c *TextEdit) SetFont(font *Font)

func (*TextEdit) SetSelection

func (c *TextEdit) SetSelection(start, end int)

func (*TextEdit) SetText

func (c *TextEdit) SetText(text string)

func (*TextEdit) SetWordWrap

func (e *TextEdit) SetWordWrap(wrap bool)

func (*TextEdit) Text

func (c *TextEdit) Text() string

func (*TextEdit) WordWrap

func (e *TextEdit) WordWrap() bool

type Window

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

func NewDialogWindow

func NewDialogWindow() *Window

func NewWindow

func NewWindow() *Window

func (*Window) Add

func (w *Window) Add(c Control)

func (*Window) Bounds

func (w *Window) Bounds() (x, y, width, height int)

func (*Window) ClassName

func (w *Window) ClassName() string

func (*Window) ClassStyle

func (w *Window) ClassStyle() uint32

func (*Window) ClientBounds

func (w *Window) ClientBounds() (x, y, width, height int)

func (*Window) ClientHeight

func (w *Window) ClientHeight() int

func (*Window) ClientPos

func (w *Window) ClientPos() (x, y int)

func (*Window) ClientSize

func (w *Window) ClientSize() (width, height int)

func (*Window) ClientWidth

func (w *Window) ClientWidth() int

func (*Window) ClientX

func (w *Window) ClientX() int

func (*Window) ClientY

func (w *Window) ClientY() int

func (*Window) Close

func (w *Window) Close()

func (*Window) Cursor

func (w *Window) Cursor() w32.HCURSOR

func (*Window) Destroy

func (w *Window) Destroy()

func (*Window) DisableAltF4

func (w *Window) DisableAltF4()

func (*Window) EnableAltF4

func (w *Window) EnableAltF4()

func (*Window) ExtendedStyle

func (w *Window) ExtendedStyle() uint

func (*Window) Font

func (w *Window) Font() *Font

func (*Window) GetBackground

func (w *Window) GetBackground() w32.HBRUSH

func (*Window) Height

func (w *Window) Height() int

func (*Window) HideConsoleOnStart

func (w *Window) HideConsoleOnStart()

func (*Window) Maximize

func (w *Window) Maximize()

func (*Window) Maximized

func (w *Window) Maximized() bool

func (*Window) Menu

func (w *Window) Menu() *Menu

func (*Window) Minimize

func (w *Window) Minimize()

func (*Window) Minimized

func (w *Window) Minimized() bool

func (*Window) Monitor

func (w *Window) Monitor() w32.HMONITOR

func (*Window) OnResize

func (w *Window) OnResize() func()

func (*Window) Parent

func (w *Window) Parent() *Window

func (*Window) Pos

func (w *Window) Pos() (x, y int)

func (*Window) Repaint

func (w *Window) Repaint()

func (*Window) Restore

func (w *Window) Restore()

func (*Window) Scroll

func (w *Window) Scroll(dx, dy int)

func (*Window) SetBackground

func (w *Window) SetBackground(b w32.HBRUSH)

func (*Window) SetBounds

func (w *Window) SetBounds(x, y, width, height int)

func (*Window) SetClassName

func (w *Window) SetClassName(name string)

func (*Window) SetClassStyle

func (w *Window) SetClassStyle(style uint32)

func (*Window) SetClientHeight

func (w *Window) SetClientHeight(height int)

func (*Window) SetClientSize

func (w *Window) SetClientSize(width, height int)

func (*Window) SetClientWidth

func (w *Window) SetClientWidth(width int)

func (*Window) SetCursor

func (w *Window) SetCursor(c w32.HCURSOR)

func (*Window) SetExtendedStyle

func (w *Window) SetExtendedStyle(x uint)

func (*Window) SetFont

func (w *Window) SetFont(f *Font)

func (*Window) SetHeight

func (w *Window) SetHeight(height int)

func (*Window) SetIconFromExeResource

func (w *Window) SetIconFromExeResource(resourceID uint16)

func (*Window) SetIconFromFile

func (w *Window) SetIconFromFile(path string)

func (*Window) SetIconFromMem

func (w *Window) SetIconFromMem(mem []byte)

func (*Window) SetMenu

func (w *Window) SetMenu(m *Menu)

func (*Window) SetOnCanClose

func (w *Window) SetOnCanClose(f func() bool)

SetOnCanClose is passed a function that is called when the window is about to be closed, e.g. when the user hits Alt+F4. If f returns true the window is closed, if f returns false, the window stays open.

func (*Window) SetOnClose

func (w *Window) SetOnClose(f func())

func (*Window) SetOnKeyDown

func (w *Window) SetOnKeyDown(f func(key int))

func (*Window) SetOnKeyUp

func (w *Window) SetOnKeyUp(f func(key int))

func (*Window) SetOnMouseDown

func (w *Window) SetOnMouseDown(f func(button MouseButton, x, y int))

func (*Window) SetOnMouseMove

func (w *Window) SetOnMouseMove(f func(x, y int))

func (*Window) SetOnMouseUp

func (w *Window) SetOnMouseUp(f func(button MouseButton, x, y int))

func (*Window) SetOnMouseWheel

func (w *Window) SetOnMouseWheel(f func(x, y int, delta float64))

func (*Window) SetOnResize

func (w *Window) SetOnResize(f func())

func (*Window) SetOnShow

func (w *Window) SetOnShow(f func())

func (*Window) SetPos

func (w *Window) SetPos(x, y int)

func (*Window) SetShortcut

func (w *Window) SetShortcut(keys ShortcutKeys, f func())

func (*Window) SetSize

func (w *Window) SetSize(width, height int)

func (*Window) SetStyle

func (w *Window) SetStyle(ws uint)

func (*Window) SetTitle

func (w *Window) SetTitle(title string)

func (*Window) SetWidth

func (w *Window) SetWidth(width int)

func (*Window) SetX

func (w *Window) SetX(x int)

func (*Window) SetY

func (w *Window) SetY(y int)

func (*Window) Show

func (w *Window) Show() error

func (*Window) ShowConsoleOnStart

func (w *Window) ShowConsoleOnStart()

func (*Window) ShowModal

func (w *Window) ShowModal() error

func (*Window) Size

func (w *Window) Size() (width, height int)

func (*Window) Style

func (w *Window) Style() uint

func (*Window) Title

func (w *Window) Title() string

func (*Window) Width

func (w *Window) Width() int

func (*Window) X

func (w *Window) X() int

func (*Window) Y

func (w *Window) Y() int

Jump to

Keyboard shortcuts

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