wui

package module
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 19 Imported by: 9

README

Windows GUI Library

This is a pure Go library to create native Windows GUIs. See the online 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/v2"

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

The Designer

I am currently working on a graphical designer. It is located under github.com/gonutz/wui/v2/cmd/designer.

At the moment it lets you place widgets graphically and generate a Go main file from it (using the Save menu). You can also run a preview with Ctrl+R.

There is no way to read the generated code back in at the moment. Right now it is a tool to place things and generate code from it.

Documentation

Index

Constants

View Source
const (
	KeyLeftMouseButton   = w32.VK_LBUTTON
	KeyRightMouseButton  = w32.VK_RBUTTON
	KeyCancel            = w32.VK_CANCEL
	KeyMiddleMouseButton = w32.VK_MBUTTON
	KeyXMouseButton1     = w32.VK_XBUTTON1
	KeyXMouseButton2     = w32.VK_XBUTTON2
	KeyBack              = w32.VK_BACK
	KeyTab               = w32.VK_TAB
	KeyClear             = w32.VK_CLEAR
	KeyReturn            = w32.VK_RETURN
	KeyShift             = w32.VK_SHIFT
	KeyControl           = w32.VK_CONTROL
	KeyAlt               = w32.VK_MENU
	KeyPause             = w32.VK_PAUSE
	KeyCapital           = w32.VK_CAPITAL
	KeyKana              = w32.VK_KANA
	KeyHangul            = w32.VK_HANGUL
	KeyIMEOn             = w32.VK_IME_ON
	KeyJunja             = w32.VK_JUNJA
	KeyFinal             = w32.VK_FINAL
	KeyHanja             = w32.VK_HANJA
	KeyKanji             = w32.VK_KANJI
	KeyIMEOff            = w32.VK_IME_OFF
	KeyEscape            = w32.VK_ESCAPE
	KeyConvert           = w32.VK_CONVERT
	KeyNonConvert        = w32.VK_NONCONVERT
	KeyAccept            = w32.VK_ACCEPT
	KeyModeChange        = w32.VK_MODECHANGE
	KeySpace             = w32.VK_SPACE
	KeyPrior             = w32.VK_PRIOR
	KeyNext              = w32.VK_NEXT
	KeyEnd               = w32.VK_END
	KeyHome              = w32.VK_HOME
	KeyLeft              = w32.VK_LEFT
	KeyUp                = w32.VK_UP
	KeyRight             = w32.VK_RIGHT
	KeyDown              = w32.VK_DOWN
	KeySelect            = w32.VK_SELECT
	KeyPrint             = w32.VK_PRINT
	KeyExecute           = w32.VK_EXECUTE
	KeySnapshot          = w32.VK_SNAPSHOT
	KeyInsert            = w32.VK_INSERT
	KeyDelete            = w32.VK_DELETE
	KeyHelp              = w32.VK_HELP
	Key0                 = '0'
	Key1                 = '1'
	Key2                 = '2'
	Key3                 = '3'
	Key4                 = '4'
	Key5                 = '5'
	Key6                 = '6'
	Key7                 = '7'
	Key8                 = '8'
	Key9                 = '9'
	KeyA                 = 'A'
	KeyB                 = 'B'
	KeyC                 = 'C'
	KeyD                 = 'D'
	KeyE                 = 'E'
	KeyF                 = 'F'
	KeyG                 = 'G'
	KeyH                 = 'H'
	KeyI                 = 'I'
	KeyJ                 = 'J'
	KeyK                 = 'K'
	KeyL                 = 'L'
	KeyM                 = 'M'
	KeyN                 = 'N'
	KeyO                 = 'O'
	KeyP                 = 'P'
	KeyQ                 = 'Q'
	KeyR                 = 'R'
	KeyS                 = 'S'
	KeyT                 = 'T'
	KeyU                 = 'U'
	KeyV                 = 'V'
	KeyW                 = 'W'
	KeyX                 = 'X'
	KeyY                 = 'Y'
	KeyZ                 = 'Z'
	KeyLeftWindows       = w32.VK_LWIN
	KeyRightWindows      = w32.VK_RWIN
	KeyApps              = w32.VK_APPS
	KeySleep             = w32.VK_SLEEP
	KeyNum0              = w32.VK_NUMPAD0
	KeyNum1              = w32.VK_NUMPAD1
	KeyNum2              = w32.VK_NUMPAD2
	KeyNum3              = w32.VK_NUMPAD3
	KeyNum4              = w32.VK_NUMPAD4
	KeyNum5              = w32.VK_NUMPAD5
	KeyNum6              = w32.VK_NUMPAD6
	KeyNum7              = w32.VK_NUMPAD7
	KeyNum8              = w32.VK_NUMPAD8
	KeyNum9              = w32.VK_NUMPAD9
	KeyMultiply          = w32.VK_MULTIPLY
	KeyAdd               = w32.VK_ADD
	KeySeparator         = w32.VK_SEPARATOR
	KeySubtract          = w32.VK_SUBTRACT
	KeyDecimal           = w32.VK_DECIMAL
	KeyDivide            = w32.VK_DIVIDE
	KeyF1                = w32.VK_F1
	KeyF2                = w32.VK_F2
	KeyF3                = w32.VK_F3
	KeyF4                = w32.VK_F4
	KeyF5                = w32.VK_F5
	KeyF6                = w32.VK_F6
	KeyF7                = w32.VK_F7
	KeyF8                = w32.VK_F8
	KeyF9                = w32.VK_F9
	KeyF10               = w32.VK_F10
	KeyF11               = w32.VK_F11
	KeyF12               = w32.VK_F12
	KeyF13               = w32.VK_F13
	KeyF14               = w32.VK_F14
	KeyF15               = w32.VK_F15
	KeyF16               = w32.VK_F16
	KeyF17               = w32.VK_F17
	KeyF18               = w32.VK_F18
	KeyF19               = w32.VK_F19
	KeyF20               = w32.VK_F20
	KeyF21               = w32.VK_F21
	KeyF22               = w32.VK_F22
	KeyF23               = w32.VK_F23
	KeyF24               = w32.VK_F24
	KeyNumLock           = w32.VK_NUMLOCK
	KeyScroll            = w32.VK_SCROLL
	KeyOEMNecEqual       = w32.VK_OEM_NEC_EQUAL
	KeyOEMFjJisho        = w32.VK_OEM_FJ_JISHO
	KeyOEMFjMasshou      = w32.VK_OEM_FJ_MASSHOU
	KeyOEMFjTouroku      = w32.VK_OEM_FJ_TOUROKU
	KeyOEMFjLoya         = w32.VK_OEM_FJ_LOYA
	KeyOEMFjRoya         = w32.VK_OEM_FJ_ROYA
	KeyLeftShift         = w32.VK_LSHIFT
	KeyRightShift        = w32.VK_RSHIFT
	KeyLeftControl       = w32.VK_LCONTROL
	KeyRightControl      = w32.VK_RCONTROL
	KeyLeftAlt           = w32.VK_LMENU
	KeyRightAlt          = w32.VK_RMENU
	KeyBrowserBack       = w32.VK_BROWSER_BACK
	KeyBrowserForward    = w32.VK_BROWSER_FORWARD
	KeyBrowserRefresh    = w32.VK_BROWSER_REFRESH
	KeyBrowserStop       = w32.VK_BROWSER_STOP
	KeyBrowserSearch     = w32.VK_BROWSER_SEARCH
	KeyBrowserFavorites  = w32.VK_BROWSER_FAVORITES
	KeyBrowserHome       = w32.VK_BROWSER_HOME
	KeyVolumeMute        = w32.VK_VOLUME_MUTE
	KeyVolumeDown        = w32.VK_VOLUME_DOWN
	KeyVolumeUp          = w32.VK_VOLUME_UP
	KeyMediaNextTrack    = w32.VK_MEDIA_NEXT_TRACK
	KeyMediaPrevTrack    = w32.VK_MEDIA_PREV_TRACK
	KeyMediaStop         = w32.VK_MEDIA_STOP
	KeyMediaPlayPause    = w32.VK_MEDIA_PLAY_PAUSE
	KeyLaunchMail        = w32.VK_LAUNCH_MAIL
	KeyLaunchMediaSelect = w32.VK_LAUNCH_MEDIA_SELECT
	KeyLaunchApp1        = w32.VK_LAUNCH_APP1
	KeyLaunchApp2        = w32.VK_LAUNCH_APP2
	KeyOEM1              = w32.VK_OEM_1
	KeyOEMPlus           = w32.VK_OEM_PLUS
	KeyOEMComma          = w32.VK_OEM_COMMA
	KeyOEMMinus          = w32.VK_OEM_MINUS
	KeyOEMPeriod         = w32.VK_OEM_PERIOD
	KeyOEM2              = w32.VK_OEM_2
	KeyOEM3              = w32.VK_OEM_3
	KeyOEM4              = w32.VK_OEM_4
	KeyOEM5              = w32.VK_OEM_5
	KeyOEM6              = w32.VK_OEM_6
	KeyOEM7              = w32.VK_OEM_7
	KeyOEM8              = w32.VK_OEM_8
	KeyOEMAx             = w32.VK_OEM_AX
	KeyOEM102            = w32.VK_OEM_102
	KeyIcoHelp           = w32.VK_ICO_HELP
	KeyIco00             = w32.VK_ICO_00
	KeyProcesskey        = w32.VK_PROCESSKEY
	KeyIcoClear          = w32.VK_ICO_CLEAR
	KeyPacket            = w32.VK_PACKET
	KeyOEMReset          = w32.VK_OEM_RESET
	KeyOEMJump           = w32.VK_OEM_JUMP
	KeyOEMPA1            = w32.VK_OEM_PA1
	KeyOEMPA2            = w32.VK_OEM_PA2
	KeyOEMPA3            = w32.VK_OEM_PA3
	KeyOEMWSControl      = w32.VK_OEM_WSCTRL
	KeyOEMCuSel          = w32.VK_OEM_CUSEL
	KeyOEMAttention      = w32.VK_OEM_ATTN
	KeyOEMFinish         = w32.VK_OEM_FINISH
	KeyOEMCopy           = w32.VK_OEM_COPY
	KeyOEMAuto           = w32.VK_OEM_AUTO
	KeyOEMEnlw           = w32.VK_OEM_ENLW
	KeyOEMBacktab        = w32.VK_OEM_BACKTAB
	KeyAttention         = w32.VK_ATTN
	KeyCrSel             = w32.VK_CRSEL
	KeyExSel             = w32.VK_EXSEL
	KeyErEOF             = w32.VK_EREOF
	KeyPlay              = w32.VK_PLAY
	KeyZoom              = w32.VK_ZOOM
	KeyNoName            = w32.VK_NONAME
	KeyPa1               = w32.VK_PA1
	KeyOEMClear          = w32.VK_OEM_CLEAR
)

These are the keyboard key constants.

Variables

View Source
var (
	// Scroll bar gray area.
	ColorScrollBar = sysColor(w32.COLOR_SCROLLBAR)

	// Desktop.
	ColorBackground = sysColor(w32.COLOR_BACKGROUND)

	// Desktop.
	ColorDesktop = sysColor(w32.COLOR_DESKTOP)

	// Active window title bar. The associated foreground color is
	// COLOR_CAPTIONTEXT. Specifies the left side color in the color gradient of
	// an active window's title bar if the gradient effect is enabled.
	ColorActiveCaption = sysColor(w32.COLOR_ACTIVECAPTION)

	// Inactive window caption. The associated foreground color is
	// COLOR_INACTIVECAPTIONTEXT. Specifies the left side color in the color
	// gradient of an inactive window's title bar if the gradient effect is
	// enabled.
	ColorInactiveCaption = sysColor(w32.COLOR_INACTIVECAPTION)

	// Menu background. The associated foreground color is COLOR_MENUTEXT.
	ColorMenu = sysColor(w32.COLOR_MENU)

	// Window background. The associated foreground colors are COLOR_WINDOWTEXT
	// and COLOR_HOTLITE.
	ColorWindow = sysColor(w32.COLOR_WINDOW)

	// Window frame.
	ColorWindowFrame = sysColor(w32.COLOR_WINDOWFRAME)

	// Text in menus. The associated background color is COLOR_MENU.
	ColorMenuText = sysColor(w32.COLOR_MENUTEXT)

	// Text in windows. The associated background color is COLOR_WINDOW.
	ColorWindowText = sysColor(w32.COLOR_WINDOWTEXT)

	// Text in caption, size box, and scroll bar arrow box. The associated
	// background color is COLOR_ACTIVECAPTION.
	ColorCaptionText = sysColor(w32.COLOR_CAPTIONTEXT)

	// Active window border.
	ColorActiveBorder = sysColor(w32.COLOR_ACTIVEBORDER)

	// Inactive window border.
	ColorInactiveBorder = sysColor(w32.COLOR_INACTIVEBORDER)

	// Background color of multiple document interface (MDI) applications.
	ColorAppWorkspace = sysColor(w32.COLOR_APPWORKSPACE)

	// Item(s) selected in a control. The associated foreground color is
	// COLOR_HIGHLIGHTTEXT.
	ColorHighlight = sysColor(w32.COLOR_HIGHLIGHT)

	// Text of item(s) selected in a control. The associated background color is
	// COLOR_HIGHLIGHT.
	ColorHighlightText = sysColor(w32.COLOR_HIGHLIGHTTEXT)

	// Face color for three-dimensional display elements and for dialog box
	// backgrounds.
	Color3DFace = sysColor(w32.COLOR_3DFACE)

	// Face color for three-dimensional display elements and for dialog box
	// backgrounds. The associated foreground color is COLOR_BTNTEXT.
	ColorButtonFace = sysColor(w32.COLOR_BTNFACE)

	// Shadow color for three-dimensional display elements (for edges facing
	// away from the light source).
	Color3DShadow = sysColor(w32.COLOR_3DSHADOW)

	// Shadow color for three-dimensional display elements (for edges facing
	// away from the light source).
	ColorButtonShadow = sysColor(w32.COLOR_BTNSHADOW)

	// Grayed (disabled) text. This color is set to 0 if the current display
	// driver does not support a solid gray color.
	ColorGrayText = sysColor(w32.COLOR_GRAYTEXT)

	// Text on push buttons. The associated background color is COLOR_BTNFACE.
	ColorButtonText = sysColor(w32.COLOR_BTNTEXT)

	// Color of text in an inactive caption. The associated background color is
	// COLOR_INACTIVECAPTION.
	ColorInactiveCaptionText = sysColor(w32.COLOR_INACTIVECAPTIONTEXT)

	// Highlight color for three-dimensional display elements (for edges facing
	// the light source.)
	Color3DHighlight = sysColor(w32.COLOR_3DHIGHLIGHT)

	// Highlight color for three-dimensional display elements (for edges facing
	// the light source.)
	ColorButtonHighlight = sysColor(w32.COLOR_BTNHIGHLIGHT)

	// Dark shadow for three-dimensional display elements.
	Color3DDarkShadow = sysColor(w32.COLOR_3DDKSHADOW)

	// Light color for three-dimensional display elements (for edges facing the
	// light source.)
	Color3DLight = sysColor(w32.COLOR_3DLIGHT)

	// Text color for tooltip controls. The associated background color is
	// COLOR_INFOBK.
	ColorInfoText = sysColor(w32.COLOR_INFOTEXT)

	// Background color for tooltip controls. The associated foreground color is
	// COLOR_INFOTEXT.
	ColorInfoBackground = sysColor(w32.COLOR_INFOBK)

	// Color for a hyperlink or hot-tracked item. The associated background
	// color is COLOR_WINDOW.
	ColorHotlight = sysColor(w32.COLOR_HOTLIGHT)

	// Right side color in the color gradient of an active window's title bar.
	// COLOR_ACTIVECAPTION specifies the left side color. Use
	// SPI_GETGRADIENTCAPTIONS with the SystemParametersInfo function to
	// determine whether the gradient effect is enabled.
	ColorGradientActiveCaption = sysColor(w32.COLOR_GRADIENTACTIVECAPTION)

	// Right side color in the color gradient of an inactive window's title bar.
	// COLOR_INACTIVECAPTION specifies the left side color.
	ColorGradientInactiveCaption = sysColor(w32.COLOR_GRADIENTINACTIVECAPTION)

	// The color used to highlight menu items when the menu appears as a flat
	// menu (see SystemParametersInfo). The highlighted menu item is outlined
	// with COLOR_HIGHLIGHT. Windows 2000: This value is not supported.
	ColorMenuHighlight = sysColor(w32.COLOR_MENUHILIGHT)

	// The background color for the menu bar when menus appear as flat menus
	// (see SystemParametersInfo). However, COLOR_MENU continues to specify the
	// background color of the menu popup. Windows 2000: This value is not
	// supported.
	ColorMenuBar = sysColor(w32.COLOR_MENUBAR)
)

These are predefined colors defined by the current Windows theme.

View Source
var (
	// CursorArrow is the standard, default arrow cursor.
	CursorArrow = loadCursor(w32.IDC_ARROW)

	// CursorIBeam is the text cursor, it looks like the letter I.
	CursorIBeam = loadCursor(w32.IDC_IBEAM)

	// CursorWait is the hour glass or rotating circle cursor that indicates
	// that an action will take some more time.
	CursorWait = loadCursor(w32.IDC_WAIT)

	// CursorCross looks like a black + (plus) symbol.
	CursorCross = loadCursor(w32.IDC_CROSS)

	// CursorUpArrow is a vertical arrow pointing upwards.
	CursorUpArrow = loadCursor(w32.IDC_UPARROW)

	// CursorSizeNWSE is a diagonal line from top-left to bottom-right with
	// arrows at both ends.
	CursorSizeNWSE = loadCursor(w32.IDC_SIZENWSE)

	// CursorSizeNESW is a diagonal line from top-right to bottom-left with
	// arrows at both ends.
	CursorSizeNESW = loadCursor(w32.IDC_SIZENESW)

	// CursorSizeWE is a horizontal line from left to right with arrows at both
	// ends.
	CursorSizeWE = loadCursor(w32.IDC_SIZEWE)

	// CursorSizeNS is a vertical line from top to bottom with arrows at both
	// ends.
	CursorSizeNS = loadCursor(w32.IDC_SIZENS)

	// CursorSizeAll is a white + (plus) symbol with arrows at all four ends.
	CursorSizeAll = loadCursor(w32.IDC_SIZEALL)

	// CursorNo indicates that an action is not possible. It is a crossed-out
	// red circle, like a stop sign.
	CursorNo = loadCursor(w32.IDC_NO)

	// CursorHand is a hand pointing its index finger upwards.
	CursorHand = loadCursor(w32.IDC_HAND)

	// CursorAppStarting is a combination of CursorArrow and CursorWait, it has
	// the arrow cursor but with an hour glass or rotating circle next to it.
	CursorAppStarting = loadCursor(w32.IDC_APPSTARTING)

	// CursorHelp is the default arrow cursor with a little question mark icon
	// next to it.
	CursorHelp = loadCursor(w32.IDC_HELP)
)
View Source
var (
	// IconApplication is the default application icon.
	IconApplication = loadIcon(w32.IDI_APPLICATION)
	// IconQuestion is a question mark icon.
	IconQuestion = loadIcon(w32.IDI_QUESTION)
	// versions (like Windows 2000) this was a Windows icon.
	IconWinLogo = loadIcon(w32.IDI_WINLOGO)
	// IconShield is the icon that comes up when Windows asks admin permission.
	// It looks like a knight's shield.
	IconShield = loadIcon(w32.IDI_SHIELD)
	// IconWarning is an exclamation mark icon.
	IconWarning = loadIcon(w32.IDI_WARNING)
	// IconError is a red cross icon.
	IconError = loadIcon(w32.IDI_ERROR)
	// IconInformation is a blue 'i' for information.
	IconInformation = loadIcon(w32.IDI_INFORMATION)
)
View Source
var NoExactFontMatch = errors.New("wui.NewFont: the desired font was not found in the system, a replacement is used")

Functions

func Enabled added in v2.6.1

func Enabled(c EnabledControl) bool

Enabled return true if the given control and all of its parents are enabled. This is different from the control's Enabled() function which only returns the enabled state of the control itself. If it is contained in a disabled parent, c.Enabled() will return true while Enabled(c) will return false.

func MessageBox added in v2.6.1

func MessageBox(caption, text string)

func MessageBoxCustom added in v2.6.1

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

func MessageBoxError added in v2.6.1

func MessageBoxError(caption, text string)

func MessageBoxInfo added in v2.6.1

func MessageBoxInfo(caption, text string)

func MessageBoxOKCancel added in v2.6.1

func MessageBoxOKCancel(caption, text string) bool

func MessageBoxQuestion added in v2.6.1

func MessageBoxQuestion(caption, text string)

func MessageBoxWarning added in v2.6.1

func MessageBoxWarning(caption, text string)

func MessageBoxYesNo added in v2.6.1

func MessageBoxYesNo(caption, text string) bool

func Visible added in v2.6.1

func Visible(c VisibleControl) bool

Visible return true if the given control and all of its parents are visible. This is different from the control's Visible() function which only returns the visibility of the control itself. If it is contained in an invisible parent, c.Visible() will return true while Visible(c) will return false.

Types

type Anchor added in v2.6.1

type Anchor int

Anchor defines how a child control is resized when its parent changes size. Children can be anchored to min (left or top), center and max (right or bottom) of their parents.

const (
	// AnchorMin makes a control stick to the left/top side of its parent. The
	// control's size is not changed.
	AnchorMin Anchor = iota

	// AnchorMax makes a control stick to the right/bottom side of its parent.
	// The control's size is not changed.
	AnchorMax

	// AnchorCenter keeps a control fixed at the horizontal/vertical center of
	// its parent, e.g. if it is placed 10 pixels left of the center, it will
	// stay 10 pixels left of its parent's center. Its size is not changed.
	AnchorCenter

	// AnchorMinAndMax makes a control's borders stick to its parent's borders.
	// The size changes propertionally to its parent's size, keeping the
	// original distances to its parents borders.
	AnchorMinAndMax

	// AnchorMinAndCenter makes the left/top side of a control stick to its
	// parent's left/top side while the right/bottom side sticks to the parent's
	// center.
	AnchorMinAndCenter

	// AnchorMaxAndCenter makes the right/bottom side of a control stick to its
	// parent's right/bottom side while the left/top side sticks to the parent's
	// center.
	AnchorMaxAndCenter
)

func (Anchor) String added in v2.6.1

func (a Anchor) String() string

type Button added in v2.6.1

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

func NewButton added in v2.6.1

func NewButton() *Button

func (*Button) Focus added in v2.6.1

func (c *Button) Focus()

func (*Button) Font added in v2.6.1

func (c *Button) Font() *Font

func (*Button) HasFocus added in v2.6.1

func (c *Button) HasFocus() bool

func (*Button) OnClick added in v2.6.1

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

func (*Button) OnTabFocus added in v2.6.1

func (b *Button) OnTabFocus() func()

func (*Button) SetFont added in v2.6.1

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

func (*Button) SetOnClick added in v2.6.1

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

func (*Button) SetOnTabFocus added in v2.6.1

func (b *Button) SetOnTabFocus(f func())

func (*Button) SetText added in v2.6.1

func (c *Button) SetText(text string)

func (*Button) Text added in v2.6.1

func (c *Button) Text() string

type Canvas added in v2.6.1

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

func (*Canvas) Arc added in v2.6.1

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

func (*Canvas) ClearDrawRegions added in v2.6.1

func (c *Canvas) ClearDrawRegions()

func (*Canvas) DrawEllipse added in v2.6.1

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

func (*Canvas) DrawImage added in v2.6.1

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

func (*Canvas) DrawPie added in v2.6.1

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

func (*Canvas) DrawRect added in v2.6.1

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

func (*Canvas) FillEllipse added in v2.6.1

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

func (*Canvas) FillPie added in v2.6.1

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

func (*Canvas) FillRect added in v2.6.1

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

func (*Canvas) Handle added in v2.6.1

func (c *Canvas) Handle() uintptr

Handle returns the handle to the canvas' device context (HDC).

func (*Canvas) Height added in v2.6.1

func (c *Canvas) Height() int

func (*Canvas) Line added in v2.6.1

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

func (*Canvas) Polygon added in v2.6.1

func (c *Canvas) Polygon(p []Point, color Color)

func (*Canvas) Polyline added in v2.6.1

func (c *Canvas) Polyline(p []Point, color Color)

func (*Canvas) PopDrawRegion added in v2.6.1

func (c *Canvas) PopDrawRegion()

func (*Canvas) PushDrawRegion added in v2.6.1

func (c *Canvas) PushDrawRegion(x, y, width, height int)

func (*Canvas) SetFont added in v2.6.1

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

func (*Canvas) Size added in v2.6.1

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

func (*Canvas) TextExtent added in v2.6.1

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

func (*Canvas) TextOut added in v2.6.1

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

func (*Canvas) TextRect added in v2.6.1

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

func (*Canvas) TextRectExtent added in v2.6.1

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 added in v2.6.1

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

func (*Canvas) Width added in v2.6.1

func (c *Canvas) Width() int

type CheckBox added in v2.6.1

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

func NewCheckBox added in v2.6.1

func NewCheckBox() *CheckBox

func (*CheckBox) Checked added in v2.6.1

func (c *CheckBox) Checked() bool

func (*CheckBox) Focus added in v2.6.1

func (c *CheckBox) Focus()

func (*CheckBox) Font added in v2.6.1

func (c *CheckBox) Font() *Font

func (*CheckBox) HasFocus added in v2.6.1

func (c *CheckBox) HasFocus() bool

func (*CheckBox) OnTabFocus added in v2.6.1

func (c *CheckBox) OnTabFocus() func()

func (*CheckBox) SetChecked added in v2.6.1

func (c *CheckBox) SetChecked(checked bool)

func (*CheckBox) SetFont added in v2.6.1

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

func (*CheckBox) SetOnChange added in v2.6.1

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

func (*CheckBox) SetOnTabFocus added in v2.6.1

func (c *CheckBox) SetOnTabFocus(f func())

func (*CheckBox) SetText added in v2.6.1

func (c *CheckBox) SetText(text string)

func (*CheckBox) Text added in v2.6.1

func (c *CheckBox) Text() string

type Color

type Color uint32

Color is a 24 bit color in BGR form. The alpha channel is always 0 and has no relevance.

func RGB

func RGB(r, g, b uint8) Color

RBG creates a new Color with the given intensities. r,g,b means red, green, blue. Value 0 is dark, 255 is full intensity.

func (Color) B

func (c Color) B() uint8

B returns the blue intensity in the Color, 0 means no blue, 255 means full blue.

func (Color) G

func (c Color) G() uint8

G returns the green intensity in the Color, 0 means no green, 255 means full green.

func (Color) R

func (c Color) R() uint8

R returns the red intensity in the Color, 0 means no red, 255 means full red.

type ComboBox added in v2.6.1

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

func NewComboBox added in v2.6.1

func NewComboBox() *ComboBox

func (*ComboBox) AddItem added in v2.6.1

func (e *ComboBox) AddItem(s string)

func (*ComboBox) Clear added in v2.6.1

func (e *ComboBox) Clear()

func (*ComboBox) Focus added in v2.6.1

func (c *ComboBox) Focus()

func (*ComboBox) Font added in v2.6.1

func (c *ComboBox) Font() *Font

func (*ComboBox) HasFocus added in v2.6.1

func (c *ComboBox) HasFocus() bool

func (*ComboBox) Items added in v2.6.1

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

func (*ComboBox) OnTabFocus added in v2.6.1

func (c *ComboBox) OnTabFocus() func()

func (*ComboBox) SelectedIndex added in v2.6.1

func (e *ComboBox) SelectedIndex() int

func (*ComboBox) SetFont added in v2.6.1

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

func (*ComboBox) SetItems added in v2.6.1

func (e *ComboBox) SetItems(items []string)

func (*ComboBox) SetOnChange added in v2.6.1

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

func (*ComboBox) SetOnTabFocus added in v2.6.1

func (c *ComboBox) SetOnTabFocus(f func())

func (*ComboBox) SetSelectedIndex added in v2.6.1

func (e *ComboBox) SetSelectedIndex(i int)

SetSelectedIndex sets the current index. Set -1 to remove any selection and make the combo box empty. If you pass a value < -1 it will be set to -1 instead. The index is not clamped to the number of items, you may set the index 10 where only 5 items are set. This lets you set the index and items at design time without one invalidating the other. At runtime though, SelectedIndex() will return -1 if you set an invalid index.

func (*ComboBox) SetText added in v2.6.1

func (c *ComboBox) SetText(text string)

func (*ComboBox) Text added in v2.6.1

func (c *ComboBox) Text() string

type Container added in v2.6.1

type Container interface {
	Add(Control)
	Remove(Control)
	Children() []Control
	Parent() Container
	Bounds() (x, y, width, height int)
	SetBounds(x, y, width, height int)
	InnerBounds() (x, y, width, height int)
	Font() *Font
	Visible() bool
	Enabled() bool
	// contains filtered or unexported methods
}

type Control added in v2.6.1

type Control interface {
	Bounds() (x, y, width, height int)
	SetBounds(x, y, width, height int)
	Anchors() (horizontal, vertical Anchor)
	SetHorizontalAnchor(a Anchor)
	SetVerticalAnchor(a Anchor)
	Parent() Container
	Handle() uintptr
	Visible() bool
	Enabled() bool
	// contains filtered or unexported methods
}

type Cursor

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

Cursor describes the mouse cursor image. You can use a pre-defined Cursor... variable (see below) or create a custom cursor with NewCursorFromImage.

func NewCursorFromImage

func NewCursorFromImage(img image.Image, x, y int) (*Cursor, error)

NewCursorFromImage creates a cursor with 4 possible colors: black, white, transparent and inverse screen color. Inverse screen color depends on what is under the cursor at any time. The cursor will be white minus the screen color to give maximum contrast for such pixels.

Fully opaque black and white pixels in the image are interpreted as black and white.

Fully transparent pixels in the image are interpreted as screen color.

All other pixels are interpreted as inverse screen color. This means even "almost" black/white/transparent, say with intensity 0xFFFE instead of 0xFFFF, will be interpreted as inverse screen color.

type EditLine added in v2.6.1

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

func NewEditLine added in v2.6.1

func NewEditLine() *EditLine

func (*EditLine) CharacterLimit added in v2.6.1

func (e *EditLine) CharacterLimit() int

func (*EditLine) CursorPosition added in v2.6.1

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

CursorPosition returns the current cursor position, respectively the current selection.

If no selection is active, the returned start and end values are the same. They then indicate the index of the UTF-8 character in this EditLine's Text() before which the caret is currently set.

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) IsPassword added in v2.6.1

func (e *EditLine) IsPassword() bool

func (*EditLine) OnTabFocus added in v2.6.1

func (e *EditLine) OnTabFocus() func()

func (*EditLine) OnTextChange added in v2.6.1

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

func (*EditLine) ReadOnly added in v2.6.1

func (e *EditLine) ReadOnly() bool

func (*EditLine) SelectAll added in v2.6.1

func (c *EditLine) SelectAll()

func (*EditLine) SetCharacterLimit added in v2.6.1

func (e *EditLine) SetCharacterLimit(count int)

func (*EditLine) SetCursorPosition added in v2.6.1

func (c *EditLine) SetCursorPosition(pos int)

func (*EditLine) SetIsPassword added in v2.6.1

func (e *EditLine) SetIsPassword(isPassword bool)

func (*EditLine) SetOnTabFocus added in v2.6.1

func (e *EditLine) SetOnTabFocus(f func())

func (*EditLine) SetOnTextChange added in v2.6.1

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

func (*EditLine) SetReadOnly added in v2.6.1

func (e *EditLine) SetReadOnly(readOnly bool)

func (*EditLine) SetSelection added in v2.6.1

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

type EnabledControl added in v2.6.1

type EnabledControl interface {
	Enabled() bool
	Parent() Container
}

type FileOpenDialog added in v2.6.1

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

func NewFileOpenDialog added in v2.6.1

func NewFileOpenDialog() *FileOpenDialog

func (*FileOpenDialog) AddFilter added in v2.6.1

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

func (*FileOpenDialog) ExecuteMultiSelection added in v2.6.1

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

func (*FileOpenDialog) ExecuteSingleSelection added in v2.6.1

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

func (*FileOpenDialog) SetFilterIndex added in v2.6.1

func (dlg *FileOpenDialog) SetFilterIndex(i int)

SetFilterIndex sets the active filter, 0-indexed.

func (*FileOpenDialog) SetInitialPath added in v2.6.1

func (dlg *FileOpenDialog) SetInitialPath(path string)

func (*FileOpenDialog) SetTitle added in v2.6.1

func (dlg *FileOpenDialog) SetTitle(title string)

type FileSaveDialog added in v2.6.1

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

func NewFileSaveDialog added in v2.6.1

func NewFileSaveDialog() *FileSaveDialog

func (*FileSaveDialog) AddFilter added in v2.6.1

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

func (*FileSaveDialog) Execute added in v2.6.1

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

func (*FileSaveDialog) SetAppendExt added in v2.6.1

func (dlg *FileSaveDialog) SetAppendExt(ext bool)

func (*FileSaveDialog) SetFilterIndex added in v2.6.1

func (dlg *FileSaveDialog) SetFilterIndex(i int)

SetFilterIndex sets the active filter, 0-indexed.

func (*FileSaveDialog) SetInitialPath added in v2.6.1

func (dlg *FileSaveDialog) SetInitialPath(path string)

func (*FileSaveDialog) SetTitle added in v2.6.1

func (dlg *FileSaveDialog) SetTitle(title string)

type FloatUpDown added in v2.6.1

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

func NewFloatUpDown added in v2.6.1

func NewFloatUpDown() *FloatUpDown

func (*FloatUpDown) CursorPosition added in v2.6.1

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

CursorPosition returns the current cursor position, respectively the current selection.

If no selection is active, the returned start and end values are the same. They then indicate the index of the UTF-8 character in this EditLine's Text() before which the caret is currently set.

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) Max added in v2.6.1

func (n *FloatUpDown) Max() float64

func (*FloatUpDown) Min added in v2.6.1

func (n *FloatUpDown) Min() float64

func (*FloatUpDown) MinMax added in v2.6.1

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

func (*FloatUpDown) OnTabFocus added in v2.6.1

func (n *FloatUpDown) OnTabFocus() func()

func (*FloatUpDown) OnValueChange added in v2.6.1

func (n *FloatUpDown) OnValueChange() func(value float64)

func (*FloatUpDown) Precision added in v2.6.1

func (n *FloatUpDown) Precision() int

func (*FloatUpDown) SelectAll added in v2.6.1

func (c *FloatUpDown) SelectAll()

func (*FloatUpDown) SetBounds added in v2.6.1

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

func (*FloatUpDown) SetCursorPosition added in v2.6.1

func (c *FloatUpDown) SetCursorPosition(pos int)

func (*FloatUpDown) SetHeight added in v2.6.1

func (n *FloatUpDown) SetHeight(height int)

func (*FloatUpDown) SetMax added in v2.6.1

func (n *FloatUpDown) SetMax(max float64)

func (*FloatUpDown) SetMin added in v2.6.1

func (n *FloatUpDown) SetMin(min float64)

func (*FloatUpDown) SetMinMax added in v2.6.1

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

func (*FloatUpDown) SetOnTabFocus added in v2.6.1

func (n *FloatUpDown) SetOnTabFocus(f func())

func (*FloatUpDown) SetOnValueChange added in v2.6.1

func (n *FloatUpDown) SetOnValueChange(f func(value float64))

func (*FloatUpDown) SetPos added in v2.6.1

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

func (*FloatUpDown) SetPrecision added in v2.6.1

func (n *FloatUpDown) SetPrecision(p int)

func (*FloatUpDown) SetSelection added in v2.6.1

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

func (*FloatUpDown) SetSize added in v2.6.1

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

func (*FloatUpDown) SetValue added in v2.6.1

func (n *FloatUpDown) SetValue(f float64)

SetValue does not accept NaN (not a number). It does accept infinity, the user can type "+inf" or "-inf".

func (*FloatUpDown) SetWidth added in v2.6.1

func (n *FloatUpDown) SetWidth(width int)

func (*FloatUpDown) SetX added in v2.6.1

func (n *FloatUpDown) SetX(x int)

func (*FloatUpDown) SetY added in v2.6.1

func (n *FloatUpDown) SetY(y int)

func (*FloatUpDown) Value added in v2.6.1

func (n *FloatUpDown) Value() float64

type FolderSelectDialog added in v2.6.1

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

func NewFolderSelectDialog added in v2.6.1

func NewFolderSelectDialog() *FolderSelectDialog

func (*FolderSelectDialog) Execute added in v2.6.1

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

func (*FolderSelectDialog) SetTitle added in v2.6.1

func (dlg *FolderSelectDialog) SetTitle(title string)

type Font added in v2.6.1

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

func NewFont added in v2.6.1

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

NewFont returns a font according to the given description and an error. The error might be NoExactFontMatch in which case the returned Font is valid, but the system did not find an exact match. In case the creation fails, the returned Font is nil and the error gives the reason.

type FontDesc added in v2.6.1

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

type Format added in v2.6.1

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

type Icon

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

Icon holds a window icon. You can use a pre-defined Icon... variable (see below) or create a custom icon with NewIconFromImage, NewIconFromExeResource, NewIconFromFile or NewIconFromReader.

func NewIconFromExeResource

func NewIconFromExeResource(resourceID int) (*Icon, error)

NewIconFromExeResource loads an icon that was compiled into the executable. In Go you can create .syso files that contain resources. Each resource will get a unique ID. See for example the rsrc tool which can create .syso files: https://github.com/gonutz/rsrc

func NewIconFromFile

func NewIconFromFile(path string) (*Icon, error)

NewIconFromFile loads an icon from disk. The format must be .ico, not an image.

func NewIconFromImage

func NewIconFromImage(img image.Image) (*Icon, error)

IconInformation creates an icon from an image. The image should have a standard icon size, typically square and a power of 2, see https://docs.microsoft.com/en-us/windows/win32/uxguide/vis-icons

func NewIconFromReader

func NewIconFromReader(r io.Reader) (*Icon, error)

NewIconFromReader loads an icon from the given reader. The format must be .ico, not an image.

type Image added in v2.6.1

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

func NewImage added in v2.6.1

func NewImage(img image.Image) *Image

func NewImageFromHBITMAP added in v2.6.1

func NewImageFromHBITMAP(bitmap uintptr, width, height int) *Image

NewImageFromHBITMAP takes a handle to a bitmap (HBITMAP) and makes it an Image that you can use in Canvas.DrawImage.

func (*Image) Bounds added in v2.6.1

func (img *Image) Bounds() Rectangle

func (*Image) Height added in v2.6.1

func (img *Image) Height() int

func (*Image) Size added in v2.6.1

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

func (*Image) Width added in v2.6.1

func (img *Image) Width() int

type IntUpDown added in v2.6.1

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

func NewIntUpDown added in v2.6.1

func NewIntUpDown() *IntUpDown

func (*IntUpDown) CursorPosition added in v2.6.1

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

CursorPosition returns the current cursor position, respectively the current selection.

If no selection is active, the returned start and end values are the same. They then indicate the index of the UTF-8 character in this EditLine's Text() before which the caret is currently set.

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) Max added in v2.6.1

func (n *IntUpDown) Max() int

func (*IntUpDown) Min added in v2.6.1

func (n *IntUpDown) Min() int

func (*IntUpDown) MinMax added in v2.6.1

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

func (*IntUpDown) OnTabFocus added in v2.6.1

func (n *IntUpDown) OnTabFocus() func()

func (*IntUpDown) OnValueChange added in v2.6.1

func (n *IntUpDown) OnValueChange() func(value int)

func (*IntUpDown) SelectAll added in v2.6.1

func (c *IntUpDown) SelectAll()

func (*IntUpDown) SetBounds added in v2.6.1

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

func (*IntUpDown) SetCursorPosition added in v2.6.1

func (c *IntUpDown) SetCursorPosition(pos int)

func (*IntUpDown) SetHeight added in v2.6.1

func (n *IntUpDown) SetHeight(height int)

func (*IntUpDown) SetMax added in v2.6.1

func (n *IntUpDown) SetMax(max int)

func (*IntUpDown) SetMin added in v2.6.1

func (n *IntUpDown) SetMin(min int)

func (*IntUpDown) SetMinMax added in v2.6.1

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

func (*IntUpDown) SetOnTabFocus added in v2.6.1

func (n *IntUpDown) SetOnTabFocus(f func())

func (*IntUpDown) SetOnValueChange added in v2.6.1

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

func (*IntUpDown) SetPos added in v2.6.1

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

func (*IntUpDown) SetSelection added in v2.6.1

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

func (*IntUpDown) SetSize added in v2.6.1

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

func (*IntUpDown) SetValue added in v2.6.1

func (n *IntUpDown) SetValue(v int)

func (*IntUpDown) SetVisible added in v2.6.1

func (n *IntUpDown) SetVisible(v bool)

func (*IntUpDown) SetWidth added in v2.6.1

func (n *IntUpDown) SetWidth(width int)

func (*IntUpDown) SetX added in v2.6.1

func (n *IntUpDown) SetX(x int)

func (*IntUpDown) SetY added in v2.6.1

func (n *IntUpDown) SetY(y int)

func (*IntUpDown) Value added in v2.6.1

func (n *IntUpDown) Value() int

type Key

type Key int

Key represents a button on a keyboard. See the constants below.

type Label added in v2.6.1

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

func NewLabel added in v2.6.1

func NewLabel() *Label

func (*Label) Alignment added in v2.6.1

func (l *Label) Alignment() TextAlignment

func (*Label) Focus added in v2.6.1

func (c *Label) Focus()

func (*Label) Font added in v2.6.1

func (c *Label) Font() *Font

func (*Label) HasFocus added in v2.6.1

func (c *Label) HasFocus() bool

func (*Label) SetAlignment added in v2.6.1

func (l *Label) SetAlignment(a TextAlignment)

func (*Label) SetFont added in v2.6.1

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

func (*Label) SetText added in v2.6.1

func (c *Label) SetText(text string)

func (*Label) Text added in v2.6.1

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

Menu is a named container for MenuItems. It is not executable, clicking a Menu will expand it and show its children. See NewMainMenu and NewMenu.

func NewMainMenu added in v2.6.1

func NewMainMenu() *Menu

NewMainMenu returns a new menu bar that can be added to a Window. You can add sub-menus to it with Menu.Add.

func NewMenu added in v2.6.1

func NewMenu(name string) *Menu

NewMenu returns a new Menu with the given text. Add MenuItems to it using Menu.Add.

Place an ampersand in the name to underline the following character, e.g. "&File" to underline the "F". This will be the character used when the user uses the alt and arrow keys to navigate the menu.

func (m *Menu) Add(item MenuItem) *Menu

Add appends the given MenuItem to the 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 added in v2.6.1

func NewMenuSeparator() MenuItem

NewMenuSeparator returns a horizontal line separating regions in a menu.

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

MenuString is an executable menu item, see NewMenuString.

func NewMenuString added in v2.6.1

func NewMenuString(text string) *MenuString

NewMenuString creates a new executable menu item with the given text.

Insert an ampersand to underline the following character, e.g. "New &File" to underline the "F". This will be the character used when the user uses the alt and arrow keys to navigate the menu.

If you want to display a shortcut text next to the menu, right aligned, insert a tab and then your text, e.g. "Open File\tCtrl+O" to have "Open File" on the left and "Ctrl+O" on the right.

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 MessageCallback added in v2.6.1

type MessageCallback func(window uintptr, msg uint32, w, l uintptr) (handled bool, result uintptr)

MessageCallback is used as a hook into the main window procedure. It will run at its very start and may intercept all messages. If the callback returns true for handled, then the message is processed no further and the message loop returns the given result code. If the callback returns false for handled, then the message goes to this library's handler for it or to the default window procedure defined in the Windows API if it is not handled.

type MouseButton added in v2.6.1

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

func (MouseButton) String added in v2.6.1

func (b MouseButton) String() string

type PaintBox added in v2.6.1

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

func NewPaintBox added in v2.6.1

func NewPaintBox() *PaintBox

func (*PaintBox) Anchors added in v2.6.1

func (c *PaintBox) Anchors() (horizontal, vertical Anchor)

func (*PaintBox) Bounds added in v2.6.1

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

func (*PaintBox) Enabled added in v2.6.1

func (c *PaintBox) Enabled() bool

func (*PaintBox) Handle added in v2.6.1

func (c *PaintBox) Handle() uintptr

func (*PaintBox) Height added in v2.6.1

func (c *PaintBox) Height() int

func (*PaintBox) HorizontalAnchor added in v2.6.1

func (c *PaintBox) HorizontalAnchor() Anchor

func (*PaintBox) OnMouseMove added in v2.6.1

func (p *PaintBox) OnMouseMove() func(x, y int)

func (*PaintBox) OnPaint added in v2.6.1

func (p *PaintBox) OnPaint() func(*Canvas)

func (*PaintBox) OnResize added in v2.6.1

func (c *PaintBox) OnResize() func()

func (*PaintBox) Paint added in v2.6.1

func (p *PaintBox) Paint()

func (*PaintBox) Parent added in v2.6.1

func (c *PaintBox) Parent() Container

func (*PaintBox) Position added in v2.6.1

func (c *PaintBox) Position() (x, y int)

func (*PaintBox) SetAnchors added in v2.6.1

func (c *PaintBox) SetAnchors(horizontal, vertical Anchor)

func (*PaintBox) SetBounds added in v2.6.1

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

func (*PaintBox) SetEnabled added in v2.6.1

func (c *PaintBox) SetEnabled(e bool)

func (*PaintBox) SetHeight added in v2.6.1

func (c *PaintBox) SetHeight(height int)

func (*PaintBox) SetHorizontalAnchor added in v2.6.1

func (c *PaintBox) SetHorizontalAnchor(a Anchor)

func (*PaintBox) SetOnMouseMove added in v2.6.1

func (p *PaintBox) SetOnMouseMove(f func(x, y int))

func (*PaintBox) SetOnPaint added in v2.6.1

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

func (*PaintBox) SetOnResize added in v2.6.1

func (c *PaintBox) SetOnResize(f func())

func (*PaintBox) SetPosition added in v2.6.1

func (c *PaintBox) SetPosition(x, y int)

func (*PaintBox) SetSize added in v2.6.1

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

func (*PaintBox) SetVerticalAnchor added in v2.6.1

func (c *PaintBox) SetVerticalAnchor(a Anchor)

func (*PaintBox) SetVisible added in v2.6.1

func (c *PaintBox) SetVisible(v bool)

func (*PaintBox) SetWidth added in v2.6.1

func (c *PaintBox) SetWidth(width int)

func (*PaintBox) SetX added in v2.6.1

func (c *PaintBox) SetX(x int)

func (*PaintBox) SetY added in v2.6.1

func (c *PaintBox) SetY(y int)

func (*PaintBox) Size added in v2.6.1

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

func (*PaintBox) VerticalAnchor added in v2.6.1

func (c *PaintBox) VerticalAnchor() Anchor

func (*PaintBox) Visible added in v2.6.1

func (c *PaintBox) Visible() bool

func (*PaintBox) Width added in v2.6.1

func (c *PaintBox) Width() int

func (*PaintBox) X added in v2.6.1

func (c *PaintBox) X() int

func (*PaintBox) Y added in v2.6.1

func (c *PaintBox) Y() int

type Panel added in v2.6.1

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

func NewPanel added in v2.6.1

func NewPanel() *Panel

func (*Panel) Add added in v2.6.1

func (p *Panel) Add(c Control)

func (*Panel) Anchors added in v2.6.1

func (c *Panel) Anchors() (horizontal, vertical Anchor)

func (*Panel) BorderStyle added in v2.6.1

func (p *Panel) BorderStyle() PanelBorderStyle

func (*Panel) Bounds added in v2.6.1

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

func (*Panel) Children added in v2.6.1

func (p *Panel) Children() []Control

func (*Panel) Enabled added in v2.6.1

func (c *Panel) Enabled() bool

func (*Panel) Font added in v2.6.1

func (p *Panel) Font() *Font

func (*Panel) Handle added in v2.6.1

func (c *Panel) Handle() uintptr

func (*Panel) Height added in v2.6.1

func (c *Panel) Height() int

func (*Panel) HorizontalAnchor added in v2.6.1

func (c *Panel) HorizontalAnchor() Anchor

func (*Panel) InnerBounds added in v2.6.1

func (p *Panel) InnerBounds() (x, y, width, height int)

func (*Panel) InnerHeight added in v2.6.1

func (p *Panel) InnerHeight() int

func (*Panel) InnerPosition added in v2.6.1

func (p *Panel) InnerPosition() (x, y int)

func (*Panel) InnerSize added in v2.6.1

func (p *Panel) InnerSize() (width, height int)

func (*Panel) InnerWidth added in v2.6.1

func (p *Panel) InnerWidth() int

func (*Panel) InnerX added in v2.6.1

func (p *Panel) InnerX() int

func (*Panel) InnerY added in v2.6.1

func (p *Panel) InnerY() int

func (*Panel) OnResize added in v2.6.1

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

func (*Panel) Parent added in v2.6.1

func (c *Panel) Parent() Container

func (*Panel) Position added in v2.6.1

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

func (*Panel) Remove added in v2.6.1

func (p *Panel) Remove(c Control)

func (*Panel) SetAnchors added in v2.6.1

func (c *Panel) SetAnchors(horizontal, vertical Anchor)

func (*Panel) SetBorderStyle added in v2.6.1

func (p *Panel) SetBorderStyle(s PanelBorderStyle)

func (*Panel) SetBounds added in v2.6.1

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

func (*Panel) SetEnabled added in v2.6.1

func (c *Panel) SetEnabled(e bool)

func (*Panel) SetFont added in v2.6.1

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

func (*Panel) SetHeight added in v2.6.1

func (p *Panel) SetHeight(height int)

func (*Panel) SetHorizontalAnchor added in v2.6.1

func (c *Panel) SetHorizontalAnchor(a Anchor)

func (*Panel) SetInnerBounds added in v2.6.1

func (p *Panel) SetInnerBounds(x, y, width, height int)

func (*Panel) SetInnerHeight added in v2.6.1

func (p *Panel) SetInnerHeight(height int)

func (*Panel) SetInnerPosition added in v2.6.1

func (p *Panel) SetInnerPosition(x, y int)

func (*Panel) SetInnerSize added in v2.6.1

func (p *Panel) SetInnerSize(width, height int)

func (*Panel) SetInnerWidth added in v2.6.1

func (p *Panel) SetInnerWidth(width int)

func (*Panel) SetInnerX added in v2.6.1

func (p *Panel) SetInnerX(x int)

func (*Panel) SetInnerY added in v2.6.1

func (p *Panel) SetInnerY(y int)

func (*Panel) SetOnResize added in v2.6.1

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

func (*Panel) SetPosition added in v2.6.1

func (p *Panel) SetPosition(x, y int)

func (*Panel) SetSize added in v2.6.1

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

func (*Panel) SetVerticalAnchor added in v2.6.1

func (c *Panel) SetVerticalAnchor(a Anchor)

func (*Panel) SetVisible added in v2.6.1

func (c *Panel) SetVisible(v bool)

func (*Panel) SetWidth added in v2.6.1

func (p *Panel) SetWidth(width int)

func (*Panel) SetX added in v2.6.1

func (p *Panel) SetX(x int)

func (*Panel) SetY added in v2.6.1

func (p *Panel) SetY(y int)

func (*Panel) Size added in v2.6.1

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

func (*Panel) VerticalAnchor added in v2.6.1

func (c *Panel) VerticalAnchor() Anchor

func (*Panel) Visible added in v2.6.1

func (c *Panel) Visible() bool

func (*Panel) Width added in v2.6.1

func (c *Panel) Width() int

func (*Panel) X added in v2.6.1

func (c *Panel) X() int

func (*Panel) Y added in v2.6.1

func (c *Panel) Y() int

type PanelBorderStyle added in v2.6.1

type PanelBorderStyle int
const (
	PanelBorderNone PanelBorderStyle = iota
	PanelBorderSingleLine
	PanelBorderSunken
	PanelBorderSunkenThick
	PanelBorderRaised
)

func (PanelBorderStyle) String added in v2.6.1

func (s PanelBorderStyle) String() string

type Point added in v2.6.1

type Point struct {
	X, Y int32
}

type ProgressBar added in v2.6.1

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

func NewProgressBar added in v2.6.1

func NewProgressBar() *ProgressBar

func (*ProgressBar) Anchors added in v2.6.1

func (c *ProgressBar) Anchors() (horizontal, vertical Anchor)

func (*ProgressBar) Bounds added in v2.6.1

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

func (*ProgressBar) Enabled added in v2.6.1

func (c *ProgressBar) Enabled() bool

func (*ProgressBar) Handle added in v2.6.1

func (c *ProgressBar) Handle() uintptr

func (*ProgressBar) Height added in v2.6.1

func (c *ProgressBar) Height() int

func (*ProgressBar) HorizontalAnchor added in v2.6.1

func (c *ProgressBar) HorizontalAnchor() Anchor

func (*ProgressBar) MovesForever added in v2.6.1

func (p *ProgressBar) MovesForever() bool

func (*ProgressBar) OnResize added in v2.6.1

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

func (*ProgressBar) Parent added in v2.6.1

func (c *ProgressBar) Parent() Container

func (*ProgressBar) Position added in v2.6.1

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

func (*ProgressBar) SetAnchors added in v2.6.1

func (c *ProgressBar) SetAnchors(horizontal, vertical Anchor)

func (*ProgressBar) SetBounds added in v2.6.1

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

func (*ProgressBar) SetEnabled added in v2.6.1

func (c *ProgressBar) SetEnabled(e bool)

func (*ProgressBar) SetHeight added in v2.6.1

func (c *ProgressBar) SetHeight(height int)

func (*ProgressBar) SetHorizontalAnchor added in v2.6.1

func (c *ProgressBar) SetHorizontalAnchor(a Anchor)

func (*ProgressBar) SetMovesForever added in v2.6.1

func (p *ProgressBar) SetMovesForever(move bool)

func (*ProgressBar) SetOnResize added in v2.6.1

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

func (*ProgressBar) SetPosition added in v2.6.1

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

func (*ProgressBar) SetSize added in v2.6.1

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

func (*ProgressBar) SetValue added in v2.6.1

func (p *ProgressBar) SetValue(v float64)

func (*ProgressBar) SetVertical added in v2.6.1

func (p *ProgressBar) SetVertical(v bool)

func (*ProgressBar) SetVerticalAnchor added in v2.6.1

func (c *ProgressBar) SetVerticalAnchor(a Anchor)

func (*ProgressBar) SetVisible added in v2.6.1

func (c *ProgressBar) SetVisible(v bool)

func (*ProgressBar) SetWidth added in v2.6.1

func (c *ProgressBar) SetWidth(width int)

func (*ProgressBar) SetX added in v2.6.1

func (c *ProgressBar) SetX(x int)

func (*ProgressBar) SetY added in v2.6.1

func (c *ProgressBar) SetY(y int)

func (*ProgressBar) Size added in v2.6.1

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

func (*ProgressBar) Value added in v2.6.1

func (p *ProgressBar) Value() float64

func (*ProgressBar) Vertical added in v2.6.1

func (p *ProgressBar) Vertical() bool

func (*ProgressBar) VerticalAnchor added in v2.6.1

func (c *ProgressBar) VerticalAnchor() Anchor

func (*ProgressBar) Visible added in v2.6.1

func (c *ProgressBar) Visible() bool

func (*ProgressBar) Width added in v2.6.1

func (c *ProgressBar) Width() int

func (*ProgressBar) X added in v2.6.1

func (c *ProgressBar) X() int

func (*ProgressBar) Y added in v2.6.1

func (c *ProgressBar) Y() int

type RadioButton added in v2.6.1

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

RadioButton is a control with a circle that is either filled to indicate checked state or unfilled to indicate unchecked state. It has a label next to the circle. Of multiple radio buttons in a container, only one can ever be checked at a time. Also all might be unchecked. Checking one radio button will automatically uncheck all others in the container.

func NewRadioButton added in v2.6.1

func NewRadioButton() *RadioButton

NewRadioButton returns a new, unchecked RadioButton.

func (*RadioButton) Checked added in v2.6.1

func (r *RadioButton) Checked() bool

Checked returns true if the radio button is checked and false if not.

func (*RadioButton) Focus added in v2.6.1

func (c *RadioButton) Focus()

func (*RadioButton) Font added in v2.6.1

func (c *RadioButton) Font() *Font

func (*RadioButton) HasFocus added in v2.6.1

func (c *RadioButton) HasFocus() bool

func (*RadioButton) OnCheck added in v2.6.1

func (r *RadioButton) OnCheck() func(checked bool)

OnCheck returns the callback set in SetOnCheck.

func (*RadioButton) OnTabFocus added in v2.6.1

func (r *RadioButton) OnTabFocus() func()

func (*RadioButton) SetChecked added in v2.6.1

func (r *RadioButton) SetChecked(checked bool)

SetChecked updates the state of the RadioButton. If checked is true and the button was not checked before, the OnCheck notification is called. Checking a radio button will uncheck all its siblings, i.e. all radio buttons that are in the same parent container.

func (*RadioButton) SetFont added in v2.6.1

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

func (*RadioButton) SetOnCheck added in v2.6.1

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

SetOnCheck sets a callback for when the RadioButton is checked. It is not called when the RadioButton is being unchecked.

func (*RadioButton) SetOnTabFocus added in v2.6.1

func (r *RadioButton) SetOnTabFocus(f func())

func (*RadioButton) SetText added in v2.6.1

func (c *RadioButton) SetText(text string)

func (*RadioButton) Text added in v2.6.1

func (c *RadioButton) Text() string

type Rectangle added in v2.6.1

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

func Rect added in v2.6.1

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

type Slider added in v2.6.1

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

func NewSlider added in v2.6.1

func NewSlider() *Slider

func (*Slider) Anchors added in v2.6.1

func (c *Slider) Anchors() (horizontal, vertical Anchor)

func (*Slider) ArrowIncrement added in v2.6.1

func (s *Slider) ArrowIncrement() int

func (*Slider) Bounds added in v2.6.1

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

func (*Slider) CursorPosition added in v2.6.1

func (s *Slider) CursorPosition() int

CursorPosition returns the current position of the Slider.

func (*Slider) Enabled added in v2.6.1

func (c *Slider) Enabled() bool

func (*Slider) Handle added in v2.6.1

func (c *Slider) Handle() uintptr

func (*Slider) Height added in v2.6.1

func (c *Slider) Height() int

func (*Slider) HorizontalAnchor added in v2.6.1

func (c *Slider) HorizontalAnchor() Anchor

func (*Slider) Max added in v2.6.1

func (s *Slider) Max() int

func (*Slider) Min added in v2.6.1

func (s *Slider) Min() int

func (*Slider) MinMax added in v2.6.1

func (s *Slider) MinMax() (min, max int)

func (*Slider) MouseIncrement added in v2.6.1

func (s *Slider) MouseIncrement() int

func (*Slider) OnChange added in v2.6.1

func (s *Slider) OnChange() func(cursor int)

func (*Slider) OnResize added in v2.6.1

func (c *Slider) OnResize() func()

func (*Slider) OnTabFocus added in v2.6.1

func (s *Slider) OnTabFocus() func()

func (*Slider) Orientation added in v2.6.1

func (s *Slider) Orientation() SliderOrientation

func (*Slider) Parent added in v2.6.1

func (c *Slider) Parent() Container

func (*Slider) Position added in v2.6.1

func (c *Slider) Position() (x, y int)

func (*Slider) SetAnchors added in v2.6.1

func (c *Slider) SetAnchors(horizontal, vertical Anchor)

func (*Slider) SetArrowIncrement added in v2.6.1

func (s *Slider) SetArrowIncrement(inc int)

SetArrowIncrement is for the arrow keys, left/down/right/up.

func (*Slider) SetBounds added in v2.6.1

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

func (*Slider) SetCursorPosition added in v2.6.1

func (s *Slider) SetCursorPosition(cursor int)

SetCursorPosition sets the position of the cursor. It clamps it to the Slider's min/max values.

func (*Slider) SetEnabled added in v2.6.1

func (c *Slider) SetEnabled(e bool)

func (*Slider) SetHeight added in v2.6.1

func (c *Slider) SetHeight(height int)

func (*Slider) SetHorizontalAnchor added in v2.6.1

func (c *Slider) SetHorizontalAnchor(a Anchor)

func (*Slider) SetMax added in v2.6.1

func (s *Slider) SetMax(max int)

func (*Slider) SetMin added in v2.6.1

func (s *Slider) SetMin(min int)

func (*Slider) SetMinMax added in v2.6.1

func (s *Slider) SetMinMax(min, max int)

SetMinMax sets the minimum and maximum values of the Slider. min must be smaller or equal to max. If the current cursor is outside these ranges, it is clamped.

func (*Slider) SetMouseIncrement added in v2.6.1

func (s *Slider) SetMouseIncrement(inc int)

SetMouseIncrement is for mouse clicks and the page up/down keys.

func (*Slider) SetOnChange added in v2.6.1

func (s *Slider) SetOnChange(f func(cursor int))

func (*Slider) SetOnResize added in v2.6.1

func (c *Slider) SetOnResize(f func())

func (*Slider) SetOnTabFocus added in v2.6.1

func (s *Slider) SetOnTabFocus(f func())

func (*Slider) SetOrientation added in v2.6.1

func (s *Slider) SetOrientation(o SliderOrientation)

SetOrientation only takes effect before the window is shown on screen. At run-time this cannot be changed.

func (*Slider) SetPosition added in v2.6.1

func (c *Slider) SetPosition(x, y int)

func (*Slider) SetSize added in v2.6.1

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

func (*Slider) SetTickFrequency added in v2.6.1

func (s *Slider) SetTickFrequency(n int)

SetTickFrequency sets the distance between two ticks to n (only every n'th tick is drawn). The first and last ticks are always drawn (except if you hide ticks altogether).

func (*Slider) SetTickPosition added in v2.6.1

func (s *Slider) SetTickPosition(p TickPosition)

SetTickPosition only takes effect before the window is shown on screen. At run-time this cannot be changed.

func (*Slider) SetTicksVisible added in v2.6.1

func (s *Slider) SetTicksVisible(show bool)

SetTicksVisible only takes effect before the window is shown on screen. At run-time this cannot be changed.

func (*Slider) SetVerticalAnchor added in v2.6.1

func (c *Slider) SetVerticalAnchor(a Anchor)

func (*Slider) SetVisible added in v2.6.1

func (c *Slider) SetVisible(v bool)

func (*Slider) SetWidth added in v2.6.1

func (c *Slider) SetWidth(width int)

func (*Slider) SetX added in v2.6.1

func (c *Slider) SetX(x int)

func (*Slider) SetY added in v2.6.1

func (c *Slider) SetY(y int)

func (*Slider) Size added in v2.6.1

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

func (*Slider) TickFrequency added in v2.6.1

func (s *Slider) TickFrequency() int

func (*Slider) TickPosition added in v2.6.1

func (s *Slider) TickPosition() TickPosition

func (*Slider) TicksVisible added in v2.6.1

func (s *Slider) TicksVisible() bool

func (*Slider) VerticalAnchor added in v2.6.1

func (c *Slider) VerticalAnchor() Anchor

func (*Slider) Visible added in v2.6.1

func (c *Slider) Visible() bool

func (*Slider) Width added in v2.6.1

func (c *Slider) Width() int

func (*Slider) X added in v2.6.1

func (c *Slider) X() int

func (*Slider) Y added in v2.6.1

func (c *Slider) Y() int

type SliderOrientation added in v2.6.1

type SliderOrientation int
const (
	HorizontalSlider SliderOrientation = iota
	VerticalSlider
)

func (SliderOrientation) String added in v2.6.1

func (o SliderOrientation) String() string

type StringList added in v2.8.0

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

func NewStringList added in v2.8.0

func NewStringList() *StringList

func (*StringList) AddItem added in v2.8.0

func (l *StringList) AddItem(s string)

func (*StringList) Clear added in v2.8.0

func (l *StringList) Clear()

func (*StringList) Focus added in v2.8.0

func (c *StringList) Focus()

func (*StringList) Font added in v2.8.0

func (c *StringList) Font() *Font

func (*StringList) HasFocus added in v2.8.0

func (c *StringList) HasFocus() bool

func (*StringList) Items added in v2.8.0

func (l *StringList) Items() []string

func (*StringList) OnChange added in v2.8.0

func (l *StringList) OnChange() func(newIndex int)

func (*StringList) SelectedIndex added in v2.8.0

func (l *StringList) SelectedIndex() int

func (*StringList) SetFont added in v2.8.0

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

func (*StringList) SetItems added in v2.8.0

func (l *StringList) SetItems(items []string)

func (*StringList) SetOnChange added in v2.8.0

func (l *StringList) SetOnChange(f func(newIndex int))

func (*StringList) SetSelectedIndex added in v2.8.0

func (l *StringList) SetSelectedIndex(i int)

SetSelectedIndex sets the current index. Set -1 to remove any selection and make the list box empty. If you pass a value < -1 it will be set to -1 instead. The index is not clamped to the number of items, you may set the index 10 where only 5 items are set. This lets you set the index and items at design time without one invalidating the other. At runtime though, SelectedIndex() will return -1 if you set an invalid index.

func (*StringList) SetText added in v2.8.0

func (c *StringList) SetText(text string)

func (*StringList) Text added in v2.8.0

func (c *StringList) Text() string

type StringTable added in v2.6.1

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

func NewStringTable added in v2.6.1

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

func (*StringTable) Clear added in v2.6.1

func (c *StringTable) Clear()

func (*StringTable) ColCount added in v2.6.1

func (c *StringTable) ColCount() int

func (*StringTable) DeleteRow added in v2.6.1

func (c *StringTable) DeleteRow(row int)

func (*StringTable) Focus added in v2.6.1

func (c *StringTable) Focus()

func (*StringTable) Font added in v2.6.1

func (c *StringTable) Font() *Font

func (*StringTable) HasFocus added in v2.6.1

func (c *StringTable) HasFocus() bool

func (*StringTable) OnSelectionChange added in v2.6.1

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

func (*StringTable) OnTabFocus added in v2.6.1

func (s *StringTable) OnTabFocus() func()

func (*StringTable) RowCount added in v2.6.1

func (c *StringTable) RowCount() int

func (*StringTable) SelectedRow added in v2.6.1

func (c *StringTable) SelectedRow() int

func (*StringTable) SetCell added in v2.6.1

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

func (*StringTable) SetFont added in v2.6.1

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

func (*StringTable) SetOnSelectionChange added in v2.6.1

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

func (*StringTable) SetOnTabFocus added in v2.6.1

func (s *StringTable) SetOnTabFocus(f func())

func (*StringTable) SetText added in v2.6.1

func (c *StringTable) SetText(text string)

func (*StringTable) Text added in v2.6.1

func (c *StringTable) Text() string

type TextAlignment added in v2.6.1

type TextAlignment int
const (
	AlignLeft TextAlignment = iota
	AlignCenter
	AlignRight
)

func (TextAlignment) String added in v2.6.1

func (a TextAlignment) String() string

type TextEdit added in v2.6.1

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

func NewTextEdit added in v2.6.1

func NewTextEdit() *TextEdit

func (*TextEdit) CharacterLimit added in v2.6.1

func (e *TextEdit) CharacterLimit() int

func (*TextEdit) CursorPosition added in v2.6.1

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

CursorPosition returns the current cursor position, respectively the current selection.

If no selection is active, the returned start and end values are the same. They then indicate the index of the UTF-8 character in this EditLine's Text() before which the caret is currently set.

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) OnTabFocus added in v2.6.1

func (e *TextEdit) OnTabFocus() func()

func (*TextEdit) OnTextChange added in v2.6.1

func (e *TextEdit) OnTextChange() func()

func (*TextEdit) ReadOnly added in v2.7.0

func (e *TextEdit) ReadOnly() bool

func (*TextEdit) SelectAll added in v2.6.1

func (c *TextEdit) SelectAll()

func (*TextEdit) SetCharacterLimit added in v2.6.1

func (e *TextEdit) SetCharacterLimit(count int)

func (*TextEdit) SetCursorPosition added in v2.6.1

func (c *TextEdit) SetCursorPosition(pos int)

func (*TextEdit) SetOnTabFocus added in v2.6.1

func (e *TextEdit) SetOnTabFocus(f func())

func (*TextEdit) SetOnTextChange added in v2.6.1

func (e *TextEdit) SetOnTextChange(f func())

func (*TextEdit) SetReadOnly added in v2.7.0

func (e *TextEdit) SetReadOnly(readOnly bool)

func (*TextEdit) SetSelection added in v2.6.1

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

func (*TextEdit) SetWordWrap added in v2.6.1

func (e *TextEdit) SetWordWrap(wrap bool)

func (*TextEdit) SetWritesTabs added in v2.6.1

func (e *TextEdit) SetWritesTabs(tabs bool)

func (*TextEdit) WordWrap added in v2.6.1

func (e *TextEdit) WordWrap() bool

func (*TextEdit) WritesTabs added in v2.6.1

func (e *TextEdit) WritesTabs() bool

type TickPosition added in v2.6.1

type TickPosition int
const (
	TicksBottomOrRight TickPosition = iota
	TicksTopOrLeft
	TicksOnBothSides
)

func (TickPosition) String added in v2.6.1

func (p TickPosition) String() string

type VisibleControl added in v2.6.1

type VisibleControl interface {
	Visible() bool
	Parent() Container
}

type Window added in v2.6.1

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

func NewWindow added in v2.6.1

func NewWindow() *Window

func (*Window) Add added in v2.6.1

func (w *Window) Add(c Control)

func (*Window) Alpha added in v2.6.1

func (w *Window) Alpha() uint8

func (*Window) Bounds added in v2.6.1

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

func (*Window) Children added in v2.6.1

func (w *Window) Children() []Control

func (*Window) ClassName added in v2.6.1

func (w *Window) ClassName() string

func (*Window) Close added in v2.6.1

func (w *Window) Close()

func (*Window) Cursor added in v2.6.1

func (w *Window) Cursor() *Cursor

func (*Window) Destroy added in v2.6.1

func (w *Window) Destroy()

func (*Window) DisableAltF4 added in v2.6.1

func (w *Window) DisableAltF4()

func (*Window) EnableAltF4 added in v2.6.1

func (w *Window) EnableAltF4()

func (*Window) Enabled added in v2.6.1

func (w *Window) Enabled() bool

func (*Window) Font added in v2.6.1

func (w *Window) Font() *Font

func (*Window) GetBackground added in v2.6.1

func (w *Window) GetBackground() Color

func (*Window) Handle added in v2.6.1

func (w *Window) Handle() uintptr

func (*Window) HasBorder added in v2.6.1

func (w *Window) HasBorder() bool

func (*Window) HasCloseButton added in v2.6.1

func (w *Window) HasCloseButton() bool

func (*Window) HasMaxButton added in v2.6.1

func (w *Window) HasMaxButton() bool

func (*Window) HasMinButton added in v2.6.1

func (w *Window) HasMinButton() bool

func (*Window) Height added in v2.6.1

func (w *Window) Height() int

func (*Window) HideConsoleOnStart added in v2.6.1

func (w *Window) HideConsoleOnStart()

func (*Window) Icon added in v2.6.1

func (w *Window) Icon() *Icon

func (*Window) InnerBounds added in v2.6.1

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

func (*Window) InnerHeight added in v2.6.1

func (w *Window) InnerHeight() int

func (*Window) InnerPosition added in v2.6.1

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

func (*Window) InnerSize added in v2.6.1

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

func (*Window) InnerWidth added in v2.6.1

func (w *Window) InnerWidth() int

func (*Window) InnerX added in v2.6.1

func (w *Window) InnerX() int

func (*Window) InnerY added in v2.6.1

func (w *Window) InnerY() int

func (*Window) Menu added in v2.6.1

func (w *Window) Menu() *Menu

func (*Window) Monitor added in v2.6.1

func (w *Window) Monitor() uintptr

Monitor returns the handle to the monitor (HMONITOR) that the window is over. Before the window is shown, Monitor returns 0.

func (*Window) OnCanClose added in v2.6.1

func (w *Window) OnCanClose() func() bool

func (*Window) OnChar added in v2.6.1

func (w *Window) OnChar() func(r rune)

func (*Window) OnClose added in v2.6.1

func (w *Window) OnClose() func()

func (*Window) OnKeyDown added in v2.6.1

func (w *Window) OnKeyDown() func(key int)

func (*Window) OnKeyUp added in v2.6.1

func (w *Window) OnKeyUp() func(key int)

func (*Window) OnMessage added in v2.6.1

func (w *Window) OnMessage() MessageCallback

func (*Window) OnMouseDown added in v2.6.1

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

func (*Window) OnMouseMove added in v2.6.1

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

func (*Window) OnMouseUp added in v2.6.1

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

func (*Window) OnMouseWheel added in v2.6.1

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

func (*Window) OnResize added in v2.6.1

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

func (*Window) OnShow added in v2.6.1

func (w *Window) OnShow() func()

func (*Window) Parent added in v2.6.1

func (w *Window) Parent() Container

func (*Window) Position added in v2.6.1

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

func (*Window) Remove added in v2.6.1

func (w *Window) Remove(c Control)

func (*Window) Repaint added in v2.6.1

func (w *Window) Repaint()

func (*Window) Resizable added in v2.6.1

func (w *Window) Resizable() bool

func (*Window) Scroll added in v2.6.1

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

func (*Window) SetAlpha added in v2.6.1

func (w *Window) SetAlpha(a uint8)

func (*Window) SetBackground added in v2.6.1

func (w *Window) SetBackground(c Color)

func (*Window) SetBounds added in v2.6.1

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

func (*Window) SetClassName added in v2.6.1

func (w *Window) SetClassName(name string)

SetClassName sets the identifier used for registering this window's class using RegisterClass or RegisterClassEx when first creating this window. This can only be done before the window is shown. For a running window this name will not be updated.

func (*Window) SetCursor added in v2.6.1

func (w *Window) SetCursor(c *Cursor)

func (*Window) SetFont added in v2.6.1

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

func (*Window) SetHasBorder added in v2.6.1

func (w *Window) SetHasBorder(border bool)

func (*Window) SetHasCloseButton added in v2.6.1

func (w *Window) SetHasCloseButton(hasClose bool)

func (*Window) SetHasMaxButton added in v2.6.1

func (w *Window) SetHasMaxButton(hasMax bool)

func (*Window) SetHasMinButton added in v2.6.1

func (w *Window) SetHasMinButton(hasMin bool)

func (*Window) SetHeight added in v2.6.1

func (w *Window) SetHeight(height int)

func (*Window) SetIcon added in v2.6.1

func (w *Window) SetIcon(icon *Icon)

func (*Window) SetInnerBounds added in v2.6.1

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

func (*Window) SetInnerHeight added in v2.6.1

func (w *Window) SetInnerHeight(height int)

func (*Window) SetInnerPosition added in v2.6.1

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

func (*Window) SetInnerSize added in v2.6.1

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

func (*Window) SetInnerWidth added in v2.6.1

func (w *Window) SetInnerWidth(width int)

func (*Window) SetInnerX added in v2.6.1

func (w *Window) SetInnerX(x int)

func (*Window) SetInnerY added in v2.6.1

func (w *Window) SetInnerY(y int)

func (*Window) SetMenu added in v2.6.1

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

func (*Window) SetOnCanClose added in v2.6.1

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) SetOnChar added in v2.6.1

func (w *Window) SetOnChar(f func(r rune))

func (*Window) SetOnClose added in v2.6.1

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

func (*Window) SetOnKeyDown added in v2.6.1

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

func (*Window) SetOnKeyUp added in v2.6.1

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

func (*Window) SetOnMessage added in v2.6.1

func (w *Window) SetOnMessage(f MessageCallback)

func (*Window) SetOnMouseDown added in v2.6.1

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

func (*Window) SetOnMouseMove added in v2.6.1

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

func (*Window) SetOnMouseUp added in v2.6.1

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

func (*Window) SetOnMouseWheel added in v2.6.1

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

func (*Window) SetOnResize added in v2.6.1

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

func (*Window) SetOnShow added in v2.6.1

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

func (*Window) SetPosition added in v2.6.1

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

func (*Window) SetResizable added in v2.6.1

func (w *Window) SetResizable(canResize bool)

func (*Window) SetShortcut added in v2.6.1

func (w *Window) SetShortcut(f func(), keys ...Key)

func (*Window) SetSize added in v2.6.1

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

func (*Window) SetState added in v2.6.1

func (w *Window) SetState(s WindowState)

func (*Window) SetTitle added in v2.6.1

func (w *Window) SetTitle(title string)

func (*Window) SetWidth added in v2.6.1

func (w *Window) SetWidth(width int)

func (*Window) SetX added in v2.6.1

func (w *Window) SetX(x int)

func (*Window) SetY added in v2.6.1

func (w *Window) SetY(y int)

func (*Window) Show added in v2.6.1

func (w *Window) Show() error

func (*Window) ShowConsoleOnStart added in v2.6.1

func (w *Window) ShowConsoleOnStart()

func (*Window) ShowModal added in v2.6.1

func (w *Window) ShowModal() error

func (*Window) Size added in v2.6.1

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

func (*Window) State added in v2.6.1

func (w *Window) State() WindowState

func (*Window) Title added in v2.6.1

func (w *Window) Title() string

func (*Window) Visible added in v2.6.1

func (w *Window) Visible() bool

func (*Window) Width added in v2.6.1

func (w *Window) Width() int

func (*Window) X added in v2.6.1

func (w *Window) X() int

func (*Window) Y added in v2.6.1

func (w *Window) Y() int

type WindowState added in v2.6.1

type WindowState int
const (
	WindowNormal WindowState = iota
	WindowMaximized
	WindowMinimized
)

func (WindowState) String added in v2.6.1

func (s WindowState) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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