README ¶
winc
** This is a fork of tadvi/winc for the sole purpose of integration with Wails. This repository comes with no support **
Common library for Go GUI apps on Windows. It is for Windows OS only. This makes library smaller than some other UI libraries for Go.
Design goals: minimalism and simplicity.
Dependencies
No other dependencies except Go standard library.
Building
If you want to package icon files and other resources into binary rsrc tool is recommended:
rsrc -manifest app.manifest -ico=app.ico,application_edit.ico,application_error.ico -o rsrc.syso
Here app.manifest is XML file in format:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="*" name="App" type="win32"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
</assembly>
Most Windows applications do not display command prompt. Build your Go project with flag to indicate that it is Windows GUI binary:
go build -ldflags="-H windowsgui"
Samples
Best way to learn how to use the library is to look at the included examples projects.
Setup
-
Make sure you have a working Go installation and build environment, see more for details on page below. http://golang.org/doc/install
-
go get github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc
Icons
When rsrc is used to pack icons into binary it displays IDs of the packed icons.
rsrc -manifest app.manifest -ico=app.ico,lightning.ico,edit.ico,application_error.ico -o rsrc.syso
Manifest ID: 1
Icon app.ico ID: 10
Icon lightning.ico ID: 13
Icon edit.ico ID: 16
Icon application_error.ico ID: 19
Use IDs to reference packed icons.
const myIcon = 13
btn.SetResIcon(myIcon) // Set icon on the button.
Included source examples use basic building via release.bat
files. Note that icon IDs are order dependent. So if
you change they order in -ico flag then icon IDs will be different. If you want to keep order the same, just add new
icons to the end of -ico comma separated list.
Layout Manager
SimpleDock is default layout manager.
Current design of docking and split views allows building simple apps but if you need to have multiple split views in few different directions you might need to create your own layout manager.
Important point is to have one control inside SimpleDock set to dock as Fill. Controls that are not set to any docking get placed using SetPos() function. So you can have Panel set to dock at the Top and then have another dock to arrange controls inside that Panel or have controls placed using SetPos() at fixed positions.
This is basic layout. Instead of toolbars and status bar you can have Panel or any other control that can resize. Panel can have its own internal Dock that will arrange other controls inside of it.
This is layout with extra control(s) on the left. Left side is usually treeview or listview.
The rule is simple: you either dock controls using SimpleDock OR use SetPos() to set them at fixed positions. That's it.
At some point winc may get more sophisticated layout manager.
Dialog Screens
Dialog screens are not based on Windows resource files (.rc). They are just windows with controls placed at fixed coordinates. This works fine for dialog screens up to 10-14 controls.
Minimal Demo
package main
import (
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc"
)
func main() {
mainWindow := winc.NewForm(nil)
mainWindow.SetSize(400, 300) // (width, height)
mainWindow.SetText("Hello World Demo")
edt := winc.NewEdit(mainWindow)
edt.SetPos(10, 20)
// Most Controls have default size unless SetSize is called.
edt.SetText("edit text")
btn := winc.NewPushButton(mainWindow)
btn.SetText("Show or Hide")
btn.SetPos(40, 50) // (x, y)
btn.SetSize(100, 40) // (width, height)
btn.OnClick().Bind(func(e *winc.Event) {
if edt.Visible() {
edt.Hide()
} else {
edt.Show()
}
})
mainWindow.Center()
mainWindow.Show()
mainWindow.OnClose().Bind(wndOnClose)
winc.RunMainLoop() // Must call to start event loop.
}
func wndOnClose(arg *winc.Event) {
winc.Exit()
}
Result of running sample_minimal.
Create Your Own
It is good practice to create your own controls based on existing structures and event model. Library contains some of the controls built that way: IconButton (button.go), ErrorPanel (panel.go), MultiEdit (edit.go), etc. Please look at existing controls as examples before building your own.
When designing your own controls keep in mind that types have to be converted from Go into Win32 API and back. This is usually due to string UTF8 and UTF16 conversions. But there are other types of conversions too.
When developing your own controls you might also need to:
import "github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc/w32"
w32 has Win32 API low level constants and functions.
Look at sample_control for example of custom built window.
Companion Package
Go package for Windows Systray icon, menu and notifications
Credits
This library is built on
AllenDang/gform Windows GUI framework for Go
winc takes most design decisions from gform and adds many more controls and code samples to it.
Documentation ¶
Overview ¶
* Copyright (C) 2019 The Winc Authors. All Rights Reserved. * Copyright (C) 2010-2013 Allen Dang. All Rights Reserved.
Index ¶
- Constants
- Variables
- func AltDown() bool
- func AppDataPath() (string, error)
- func CommonAppDataPath() (string, error)
- func ControlDown() bool
- func CreateWindow(className string, parent Controller, exStyle, style uint) w32.HWND
- func DriveNames() ([]string, error)
- func EnsureAppDataPath(company, product string) (string, error)
- func Errorf(parent Controller, format string, data ...interface{})
- func Exit()
- func GetAppInstance() w32.HINSTANCE
- func LocalAppDataPath() (string, error)
- func MsgBox(parent Controller, title, caption string, flags uint) int
- func MsgBoxOk(parent Controller, title, caption string)
- func MsgBoxOkCancel(parent Controller, title, caption string) int
- func MsgBoxYesNo(parent Controller, title, caption string) int
- func PostMessages()
- func PreTranslateMessage(msg *w32.MSG) bool
- func Printf(parent Controller, format string, data ...interface{})
- func RegClassOnlyOnce(className string)
- func RegMsgHandler(controller Controller)
- func RegisterClass(className string, wndproc uintptr)
- func RegisterWindowMessage(name string) uint32
- func RunMainLoop() int
- func ScaleToDefaultDPI(pixels int, dpi uint) int
- func ScaleWithDPI(pixels int, dpi uint) int
- func SetAppIcon(appIconID int)
- func SetExStyle(hwnd w32.HWND, b bool, style int)
- func SetStyle(hwnd w32.HWND, b bool, style int)
- func ShiftDown() bool
- func ShowBrowseFolderDlg(parent Controller, title string) (folder string, accepted bool)
- func ShowOpenFileDlg(parent Controller, title, filter string, filterIndex uint, initialDir string) (filePath string, accepted bool)
- func ShowSaveFileDlg(parent Controller, title, filter string, filterIndex uint, initialDir string) (filePath string, accepted bool)
- func UnRegMsgHandler(hwnd w32.HWND)
- func Warningf(parent Controller, format string, data ...interface{}) int
- type Bitmap
- type Brush
- type Button
- type Canvas
- func (ca *Canvas) Dispose()
- func (ca *Canvas) DrawBitmap(bmp *Bitmap, x, y int)
- func (ca *Canvas) DrawEllipse(rect *Rect, pen *Pen)
- func (ca *Canvas) DrawFillEllipse(rect *Rect, pen *Pen, brush *Brush)
- func (ca *Canvas) DrawFillRect(rect *Rect, pen *Pen, brush *Brush)
- func (ca *Canvas) DrawIcon(ico *Icon, x, y int) bool
- func (ca *Canvas) DrawLine(x, y, x2, y2 int, pen *Pen)
- func (ca *Canvas) DrawRect(rect *Rect, pen *Pen)
- func (ca *Canvas) DrawStretchedBitmap(bmp *Bitmap, rect *Rect)
- func (ca *Canvas) DrawText(text string, rect *Rect, format uint, font *Font, textColor Color)
- func (ca *Canvas) FillRect(rect *Rect, brush *Brush)
- type CheckBox
- type Color
- type ComboBox
- func (cb *ComboBox) DeleteAllItems() bool
- func (cb *ComboBox) DeleteItem(index int) bool
- func (cb *ComboBox) InsertItem(index int, str string) bool
- func (cb *ComboBox) OnSelectedChange() *EventManager
- func (cb *ComboBox) SelectedItem() int
- func (cb *ComboBox) SetSelectedItem(value int) bool
- func (cb *ComboBox) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type ControlBase
- func (cba *ControlBase) Bounds() *Rect
- func (cba *ControlBase) ClientHeight() int
- func (cba *ControlBase) ClientRect() *Rect
- func (cba *ControlBase) ClientWidth() int
- func (cba *ControlBase) Close()
- func (cba *ControlBase) ContextMenu() *MenuItem
- func (cba *ControlBase) EnableDragAcceptFiles(b bool)
- func (cba *ControlBase) Enabled() bool
- func (cba *ControlBase) Font() *Font
- func (cba *ControlBase) GetWindowDPI() (w32.UINT, w32.UINT)
- func (cba *ControlBase) Handle() w32.HWND
- func (cba *ControlBase) Height() int
- func (cba *ControlBase) Hide()
- func (cba *ControlBase) InitControl(className string, parent Controller, exstyle, style uint)
- func (cba *ControlBase) InitWindow(className string, parent Controller, exstyle, style uint)
- func (cba *ControlBase) Invalidate(erase bool)
- func (cba *ControlBase) Invoke(f func())
- func (cba *ControlBase) InvokeRequired() bool
- func (cba *ControlBase) OnClose() *EventManager
- func (cba *ControlBase) OnCreate() *EventManager
- func (cba *ControlBase) OnDropFiles() *EventManager
- func (cba *ControlBase) OnKeyUp() *EventManager
- func (cba *ControlBase) OnKillFocus() *EventManager
- func (cba *ControlBase) OnLBDbl() *EventManager
- func (cba *ControlBase) OnLBDown() *EventManager
- func (cba *ControlBase) OnLBUp() *EventManager
- func (cba *ControlBase) OnMBDown() *EventManager
- func (cba *ControlBase) OnMBUp() *EventManager
- func (cba *ControlBase) OnMouseHover() *EventManager
- func (cba *ControlBase) OnMouseLeave() *EventManager
- func (cba *ControlBase) OnMouseMove() *EventManager
- func (cba *ControlBase) OnPaint() *EventManager
- func (cba *ControlBase) OnRBDbl() *EventManager
- func (cba *ControlBase) OnRBDown() *EventManager
- func (cba *ControlBase) OnRBUp() *EventManager
- func (cba *ControlBase) OnSetFocus() *EventManager
- func (cba *ControlBase) OnSize() *EventManager
- func (cba *ControlBase) Parent() Controller
- func (cba *ControlBase) Pos() (x, y int)
- func (cba *ControlBase) PreTranslateMessage(msg *w32.MSG) bool
- func (cba *ControlBase) SetAlwaysOnTop(b bool)
- func (cba *ControlBase) SetAndClearStyleBits(set, clear uint32) error
- func (cba *ControlBase) SetContextMenu(menu *MenuItem)
- func (cba *ControlBase) SetEnabled(b bool)
- func (cba *ControlBase) SetFocus()
- func (cba *ControlBase) SetFont(font *Font)
- func (cba *ControlBase) SetHandle(hwnd w32.HWND)
- func (cba *ControlBase) SetIsForm(isform bool)
- func (cba *ControlBase) SetMaxSize(width, height int)
- func (cba *ControlBase) SetMinSize(width, height int)
- func (cba *ControlBase) SetParent(parent Controller)
- func (cba *ControlBase) SetPos(x, y int)
- func (cba *ControlBase) SetSize(width, height int)
- func (cba *ControlBase) SetText(caption string)
- func (cba *ControlBase) SetTheme(appName string) error
- func (cba *ControlBase) SetTranslucentBackground()
- func (cba *ControlBase) Show()
- func (cba *ControlBase) Size() (width, height int)
- func (cba *ControlBase) Text() string
- func (cba *ControlBase) ToggleVisible() bool
- func (cba *ControlBase) Visible() bool
- func (cba *ControlBase) Width() int
- type Controller
- type CtlState
- type Dialog
- func (dlg *Dialog) Close()
- func (dlg *Dialog) OnCancel() *EventManager
- func (dlg *Dialog) OnLoad() *EventManager
- func (dlg *Dialog) OnOk() *EventManager
- func (dlg *Dialog) PreTranslateMessage(msg *w32.MSG) bool
- func (dlg *Dialog) SetButtons(btnOk *PushButton, btnCancel *PushButton)
- func (dlg *Dialog) SetModal(modal bool)
- func (dlg *Dialog) Show()
- func (dlg *Dialog) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type Direction
- type DockAllow
- type Dockable
- type DropFilesEventData
- type Edit
- type ErrorPanel
- type Event
- type EventHandler
- type EventManager
- type Font
- type Form
- func (fm *Form) Center()
- func (fm *Form) DisableIcon()
- func (fm *Form) EnableDragMove(_ bool)
- func (fm *Form) EnableMaxButton(b bool)
- func (fm *Form) EnableMinButton(b bool)
- func (fm *Form) EnableSizable(b bool)
- func (fm *Form) EnableTopMost(b bool)
- func (fm *Form) Fullscreen()
- func (fm *Form) IsFullScreen() bool
- func (fm *Form) Maximise()
- func (fm *Form) Minimise()
- func (fm *Form) NewMenu() *Menu
- func (fm *Form) Restore()
- func (fm *Form) SetIcon(iconType int, icon *Icon)
- func (fm *Form) SetLayout(mng LayoutManager)
- func (fm *Form) UnFullscreen()
- func (fm *Form) UpdateLayout()
- func (fm *Form) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type GroupBox
- type HResizer
- type Icon
- type IconButton
- type ImageBox
- type ImageList
- func (im *ImageList) AddIcon(icon *Icon) int
- func (im *ImageList) AddResIcon(iconID uint16)
- func (im *ImageList) Destroy() bool
- func (im *ImageList) Handle() w32.HIMAGELIST
- func (im *ImageList) ImageCount() int
- func (im *ImageList) Remove(i int) bool
- func (im *ImageList) RemoveAll() bool
- func (im *ImageList) SetImageCount(uNewCount uint) bool
- type ImageView
- type ImageViewBox
- func (iv *ImageViewBox) AddMode() bool
- func (iv *ImageViewBox) DeleteSelected()
- func (iv *ImageViewBox) DrawImage(bmp *Bitmap)
- func (iv *ImageViewBox) DrawImageFile(filepath string) (err error)
- func (iv *ImageViewBox) HasSelected() bool
- func (iv *ImageViewBox) IsLoaded() bool
- func (iv *ImageViewBox) IsModified() bool
- func (iv *ImageViewBox) NameSelected() string
- func (iv *ImageViewBox) OnAdd() *EventManager
- func (iv *ImageViewBox) OnModify() *EventManager
- func (iv *ImageViewBox) OnSelectedChange() *EventManager
- func (iv *ImageViewBox) SetAddMode(add bool)
- func (iv *ImageViewBox) SetModified(modified bool)
- func (iv *ImageViewBox) SetNameSelected(name string)
- func (iv *ImageViewBox) SetTypeSelected(typ int)
- func (iv *ImageViewBox) TypeSelected() int
- func (iv *ImageViewBox) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type Key
- type KeyUpEventData
- type Label
- type LabelEditEventData
- type LayoutControl
- type LayoutControls
- type LayoutManager
- type LayoutState
- type ListItem
- type ListItemChecker
- type ListItemSetter
- type ListView
- func (lv *ListView) AddColumn(caption string, width int)
- func (lv *ListView) AddItem(item ListItem)
- func (lv *ListView) CheckBoxes() bool
- func (lv *ListView) DeleteAllItems() bool
- func (lv *ListView) DeleteItem(item ListItem) error
- func (lv *ListView) EnableDoubleBuffer(enable bool)
- func (lv *ListView) EnableEditLabels(enable bool)
- func (lv *ListView) EnableFullRowSelect(enable bool)
- func (lv *ListView) EnableHotTrack(enable bool)
- func (lv *ListView) EnableSingleSelect(enable bool)
- func (lv *ListView) EnableSortAscending(enable bool)
- func (lv *ListView) EnableSortHeader(enable bool)
- func (lv *ListView) EnsureVisible(item ListItem) bool
- func (lv *ListView) InsertItem(item ListItem, index int)
- func (lv *ListView) ItemAt(x, y int) ListItem
- func (lv *ListView) ItemCount() int
- func (lv *ListView) Items() (list []ListItem)
- func (lv *ListView) OnCheckChanged() *EventManager
- func (lv *ListView) OnClick() *EventManager
- func (lv *ListView) OnDoubleClick() *EventManager
- func (lv *ListView) OnEndLabelEdit() *EventManager
- func (lv *ListView) OnEndScroll() *EventManager
- func (lv *ListView) OnItemChanged() *EventManager
- func (lv *ListView) OnItemChanging() *EventManager
- func (lv *ListView) OnKeyDown() *EventManager
- func (lv *ListView) OnViewChange() *EventManager
- func (lv *ListView) SelectedCount() uint
- func (lv *ListView) SelectedIndex() int
- func (lv *ListView) SelectedItem() ListItem
- func (lv *ListView) SelectedItems() []ListItem
- func (lv *ListView) SetCheckBoxes(value bool)
- func (lv *ListView) SetImageList(imageList *ImageList)
- func (lv *ListView) SetItemCount(count int) bool
- func (lv *ListView) SetSelectedIndex(i int)
- func (lv *ListView) SetSelectedItem(item ListItem) bool
- func (lv *ListView) StretchLastColumn() error
- func (lv *ListView) UpdateItem(item ListItem) bool
- func (lv *ListView) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type Menu
- type MenuItem
- func (mi *MenuItem) AddItem(text string, shortcut Shortcut) *MenuItem
- func (mi *MenuItem) AddItemCheckable(text string, shortcut Shortcut) *MenuItem
- func (mi *MenuItem) AddItemRadio(text string, shortcut Shortcut) *MenuItem
- func (mi *MenuItem) AddItemWithBitmap(text string, shortcut Shortcut, image *Bitmap) *MenuItem
- func (mi *MenuItem) AddSeparator()
- func (mi *MenuItem) AddSubMenu(text string) *MenuItem
- func (mi *MenuItem) Checkable() bool
- func (mi *MenuItem) Checked() bool
- func (mi *MenuItem) Enabled() bool
- func (mi *MenuItem) Image() *Bitmap
- func (mi *MenuItem) IsSeparator() bool
- func (mi *MenuItem) OnClick() *EventManager
- func (mi *MenuItem) SetCheckable(b bool)
- func (mi *MenuItem) SetChecked(b bool)
- func (mi *MenuItem) SetEnabled(b bool)
- func (mi *MenuItem) SetImage(b *Bitmap)
- func (mi *MenuItem) SetSeparator()
- func (mi *MenuItem) SetText(s string)
- func (mi *MenuItem) SetToolTip(s string)
- func (mi *MenuItem) Text() string
- func (mi *MenuItem) ToolTip() string
- type Modifiers
- type MouseControl
- type MouseEventData
- type MultiEdit
- type MultiPanel
- func (mpa *MultiPanel) AddPanel(panel *Panel)
- func (mpa *MultiPanel) Count() int
- func (mpa *MultiPanel) Current() int
- func (mpa *MultiPanel) DeletePanel(index int)
- func (mpa *MultiPanel) ReplacePanel(index int, panel *Panel)
- func (mpa *MultiPanel) SetCurrent(index int)
- func (mpa *MultiPanel) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type PaintEventData
- type Panel
- type Pen
- type ProgressBar
- type PushButton
- type RadioButton
- type RadioGroup
- type RawMsg
- type Rect
- func (re *Rect) Data() (left, top, right, bottom int32)
- func (re *Rect) GetW32Rect() *w32.RECT
- func (re *Rect) Height() int
- func (re *Rect) Inflate(x, y int)
- func (re *Rect) Intersect(src *Rect)
- func (re *Rect) IsEmpty() bool
- func (re *Rect) IsEqual(rect *Rect) bool
- func (re *Rect) IsPointIn(x, y int) bool
- func (re *Rect) Offset(x, y int)
- func (re *Rect) Set(left, top, right, bottom int)
- func (re *Rect) Substract(src *Rect)
- func (re *Rect) Union(src *Rect)
- func (re *Rect) Width() int
- type ScrollView
- type Shortcut
- type SimpleDock
- func (sd *SimpleDock) Dock(child Dockable, dir Direction)
- func (sd *SimpleDock) LoadState(r io.Reader) error
- func (sd *SimpleDock) LoadStateFile(file string) error
- func (sd *SimpleDock) SaveState(w io.Writer) error
- func (sd *SimpleDock) SaveStateFile(file string) error
- func (sd *SimpleDock) Update()
- type SizeEventData
- type Slider
- type StringListItem
- type StringTreeItem
- type TabView
- type ToolButton
- func (bt *ToolButton) Checkable() bool
- func (bt *ToolButton) Checked() bool
- func (bt *ToolButton) Enabled() bool
- func (bt *ToolButton) Image() int
- func (bt *ToolButton) IsSeparator() bool
- func (bt *ToolButton) OnClick() *EventManager
- func (bt *ToolButton) SetCheckable(b bool)
- func (bt *ToolButton) SetChecked(b bool)
- func (bt *ToolButton) SetEnabled(b bool)
- func (bt *ToolButton) SetImage(i int)
- func (bt *ToolButton) SetSeparator()
- func (bt *ToolButton) SetText(s string)
- func (bt *ToolButton) Text() string
- type ToolTip
- type Toolbar
- type TreeItem
- type TreeView
- func (tv *TreeView) Collapse(item TreeItem) bool
- func (tv *TreeView) DeleteAllItems() bool
- func (tv *TreeView) DeleteItem(item TreeItem) bool
- func (tv *TreeView) EnableDoubleBuffer(enable bool)
- func (tv *TreeView) EnsureVisible(item TreeItem) bool
- func (tv *TreeView) Expand(item TreeItem) bool
- func (tv *TreeView) InsertItem(item, parent, insertAfter TreeItem) error
- func (tv *TreeView) ItemAt(x, y int) TreeItem
- func (tv *TreeView) Items() (list []TreeItem)
- func (tv *TreeView) OnCollapse() *EventManager
- func (tv *TreeView) OnExpand() *EventManager
- func (tv *TreeView) OnSelectedChange() *EventManager
- func (tv *TreeView) OnViewChange() *EventManager
- func (tv *TreeView) SelectedItem() TreeItem
- func (tv *TreeView) SetImageList(imageList *ImageList)
- func (tv *TreeView) SetSelectedItem(item TreeItem) bool
- func (tv *TreeView) UpdateItem(item TreeItem) bool
- func (tv *TreeView) WndProc(msg uint32, wparam, lparam uintptr) uintptr
- type VResizer
Constants ¶
const ( FontBold byte = 0x01 FontItalic byte = 0x02 FontUnderline byte = 0x04 FontStrikeOut byte = 0x08 )
const ( DirNone direction = iota DirX DirY DirX2 DirY2 )
Variables ¶
var ( // resource compilation tool assigns app.ico ID of 3 // rsrc -manifest app.manifest -ico app.ico -o rsrc.syso AppIconID = 3 )
var DefaultBackgroundBrush = NewSystemColorBrush(w32.COLOR_BTNFACE)
var ImageBoxHiPen = NewPen(w32.PS_GEOMETRIC, 2, NewSolidColorBrush(RGB(220, 140, 140)))
var ImageBoxMarkBrush = NewSolidColorBrush(RGB(40, 40, 40))
var ImageBoxMarkPen = NewPen(w32.PS_GEOMETRIC, 2, ImageBoxMarkBrush)
var ImageBoxPen = NewPen(w32.PS_GEOMETRIC, 2, NewSolidColorBrush(RGB(140, 140, 220)))
var NoShortcut = Shortcut{}
Functions ¶
func AppDataPath ¶
func CommonAppDataPath ¶
func ControlDown ¶
func ControlDown() bool
func CreateWindow ¶
func CreateWindow(className string, parent Controller, exStyle, style uint) w32.HWND
func DriveNames ¶
func EnsureAppDataPath ¶
EnsureAppDataPath uses AppDataPath to ensure storage for local settings and databases.
func Errorf ¶
func Errorf(parent Controller, format string, data ...interface{})
Errorf is generic error message with OK button.
func GetAppInstance ¶
func LocalAppDataPath ¶
func MsgBoxOk ¶
func MsgBoxOk(parent Controller, title, caption string)
func MsgBoxOkCancel ¶
func MsgBoxOkCancel(parent Controller, title, caption string) int
MsgBoxOkCancel basic pop up message. Returns 1 for OK and 2 for CANCEL.
func MsgBoxYesNo ¶
func MsgBoxYesNo(parent Controller, title, caption string) int
func PostMessages ¶
func PostMessages()
PostMessages processes recent messages. Sometimes helpful for instant window refresh.
func PreTranslateMessage ¶
func Printf ¶
func Printf(parent Controller, format string, data ...interface{})
Printf is generic info message with OK button.
func RegClassOnlyOnce ¶
func RegClassOnlyOnce(className string)
func RegMsgHandler ¶
func RegMsgHandler(controller Controller)
func RegisterClass ¶
func RegisterWindowMessage ¶
func ScaleToDefaultDPI ¶ added in v2.4.0
ScaleToDefaultDPI scales the pixels from scaled DPI-Space to default DPI-Space (96).
func ScaleWithDPI ¶
ScaleWithDPI scales the pixels from the default DPI-Space (96) to the target DPI-Space.
func SetAppIcon ¶
func SetAppIcon(appIconID int)
SetAppIconID sets recource icon ID for the apps windows.
func ShowBrowseFolderDlg ¶
func ShowBrowseFolderDlg(parent Controller, title string) (folder string, accepted bool)
func ShowOpenFileDlg ¶
func ShowSaveFileDlg ¶
func UnRegMsgHandler ¶
func Warningf ¶
func Warningf(parent Controller, format string, data ...interface{}) int
Warningf is generic warning message with OK and Cancel buttons. Returns 1 for OK.
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
func NewBitmapFromResource ¶
func (*Bitmap) GetHBITMAP ¶
type Brush ¶
type Brush struct {
// contains filtered or unexported fields
}
func NewHatchedColorBrush ¶
func NewNullBrush ¶
func NewNullBrush() *Brush
func NewSolidColorBrush ¶
func NewSystemColorBrush ¶
func (*Brush) GetLOGBRUSH ¶
type Button ¶
type Button struct { ControlBase // contains filtered or unexported fields }
func (*Button) OnClick ¶
func (bt *Button) OnClick() *EventManager
func (*Button) SetChecked ¶
func (*Button) SetIcon ¶
SetIcon sets icon on the button. Recommended icons are 32x32 with 32bit color depth.
func (*Button) SetResIcon ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
func NewCanvasFromHDC ¶
func NewCanvasFromHwnd ¶
func (*Canvas) DrawBitmap ¶
func (*Canvas) DrawEllipse ¶
func (*Canvas) DrawFillEllipse ¶
DrawFillEllipse draw and fill ellipse with color.
func (*Canvas) DrawFillRect ¶
DrawFillRect draw and fill rectangle with color.
func (*Canvas) DrawStretchedBitmap ¶
type CheckBox ¶
type CheckBox struct {
Button
}
func NewCheckBox ¶
func NewCheckBox(parent Controller) *CheckBox
type ComboBox ¶
type ComboBox struct { ControlBase // contains filtered or unexported fields }
func NewComboBox ¶
func NewComboBox(parent Controller) *ComboBox
func (*ComboBox) DeleteAllItems ¶
func (*ComboBox) DeleteItem ¶
func (*ComboBox) OnSelectedChange ¶
func (cb *ComboBox) OnSelectedChange() *EventManager
func (*ComboBox) SelectedItem ¶
func (*ComboBox) SetSelectedItem ¶
type ControlBase ¶
type ControlBase struct {
// contains filtered or unexported fields
}
func (*ControlBase) Bounds ¶
func (cba *ControlBase) Bounds() *Rect
func (*ControlBase) ClientHeight ¶
func (cba *ControlBase) ClientHeight() int
func (*ControlBase) ClientRect ¶
func (cba *ControlBase) ClientRect() *Rect
func (*ControlBase) ClientWidth ¶
func (cba *ControlBase) ClientWidth() int
func (*ControlBase) Close ¶
func (cba *ControlBase) Close()
func (*ControlBase) ContextMenu ¶
func (cba *ControlBase) ContextMenu() *MenuItem
func (*ControlBase) EnableDragAcceptFiles ¶
func (cba *ControlBase) EnableDragAcceptFiles(b bool)
func (*ControlBase) Enabled ¶
func (cba *ControlBase) Enabled() bool
func (*ControlBase) Font ¶
func (cba *ControlBase) Font() *Font
func (*ControlBase) GetWindowDPI ¶
func (cba *ControlBase) GetWindowDPI() (w32.UINT, w32.UINT)
func (*ControlBase) Handle ¶
func (cba *ControlBase) Handle() w32.HWND
func (*ControlBase) Height ¶
func (cba *ControlBase) Height() int
func (*ControlBase) Hide ¶
func (cba *ControlBase) Hide()
func (*ControlBase) InitControl ¶
func (cba *ControlBase) InitControl(className string, parent Controller, exstyle, style uint)
initControl is called by controls: edit, button, treeview, listview, and so on.
func (*ControlBase) InitWindow ¶
func (cba *ControlBase) InitWindow(className string, parent Controller, exstyle, style uint)
InitWindow is called by custom window based controls such as split, panel, etc.
func (*ControlBase) Invalidate ¶
func (cba *ControlBase) Invalidate(erase bool)
func (*ControlBase) Invoke ¶
func (cba *ControlBase) Invoke(f func())
func (*ControlBase) InvokeRequired ¶
func (cba *ControlBase) InvokeRequired() bool
func (*ControlBase) OnClose ¶
func (cba *ControlBase) OnClose() *EventManager
func (*ControlBase) OnDropFiles ¶
func (cba *ControlBase) OnDropFiles() *EventManager
func (*ControlBase) OnKeyUp ¶
func (cba *ControlBase) OnKeyUp() *EventManager
func (*ControlBase) OnKillFocus ¶
func (cba *ControlBase) OnKillFocus() *EventManager
func (*ControlBase) OnLBDbl ¶
func (cba *ControlBase) OnLBDbl() *EventManager
func (*ControlBase) OnLBDown ¶
func (cba *ControlBase) OnLBDown() *EventManager
func (*ControlBase) OnLBUp ¶
func (cba *ControlBase) OnLBUp() *EventManager
func (*ControlBase) OnMBDown ¶
func (cba *ControlBase) OnMBDown() *EventManager
func (*ControlBase) OnMBUp ¶
func (cba *ControlBase) OnMBUp() *EventManager
func (*ControlBase) OnMouseHover ¶
func (cba *ControlBase) OnMouseHover() *EventManager
func (*ControlBase) OnMouseLeave ¶
func (cba *ControlBase) OnMouseLeave() *EventManager
func (*ControlBase) OnMouseMove ¶
func (cba *ControlBase) OnMouseMove() *EventManager
func (*ControlBase) OnPaint ¶
func (cba *ControlBase) OnPaint() *EventManager
func (*ControlBase) OnRBDbl ¶
func (cba *ControlBase) OnRBDbl() *EventManager
func (*ControlBase) OnRBDown ¶
func (cba *ControlBase) OnRBDown() *EventManager
func (*ControlBase) OnRBUp ¶
func (cba *ControlBase) OnRBUp() *EventManager
func (*ControlBase) OnSetFocus ¶
func (cba *ControlBase) OnSetFocus() *EventManager
func (*ControlBase) OnSize ¶
func (cba *ControlBase) OnSize() *EventManager
func (*ControlBase) Parent ¶
func (cba *ControlBase) Parent() Controller
func (*ControlBase) Pos ¶
func (cba *ControlBase) Pos() (x, y int)
func (*ControlBase) PreTranslateMessage ¶
func (cba *ControlBase) PreTranslateMessage(msg *w32.MSG) bool
func (*ControlBase) SetAlwaysOnTop ¶
func (cba *ControlBase) SetAlwaysOnTop(b bool)
func (*ControlBase) SetAndClearStyleBits ¶
func (cba *ControlBase) SetAndClearStyleBits(set, clear uint32) error
func (*ControlBase) SetContextMenu ¶
func (cba *ControlBase) SetContextMenu(menu *MenuItem)
func (*ControlBase) SetEnabled ¶
func (cba *ControlBase) SetEnabled(b bool)
func (*ControlBase) SetFocus ¶
func (cba *ControlBase) SetFocus()
func (*ControlBase) SetFont ¶
func (cba *ControlBase) SetFont(font *Font)
func (*ControlBase) SetHandle ¶
func (cba *ControlBase) SetHandle(hwnd w32.HWND)
func (*ControlBase) SetIsForm ¶
func (cba *ControlBase) SetIsForm(isform bool)
func (*ControlBase) SetMaxSize ¶
func (cba *ControlBase) SetMaxSize(width, height int)
func (*ControlBase) SetMinSize ¶
func (cba *ControlBase) SetMinSize(width, height int)
func (*ControlBase) SetParent ¶
func (cba *ControlBase) SetParent(parent Controller)
func (*ControlBase) SetPos ¶
func (cba *ControlBase) SetPos(x, y int)
func (*ControlBase) SetSize ¶
func (cba *ControlBase) SetSize(width, height int)
func (*ControlBase) SetText ¶
func (cba *ControlBase) SetText(caption string)
func (*ControlBase) SetTheme ¶
func (cba *ControlBase) SetTheme(appName string) error
SetTheme for TreeView and ListView controls.
func (*ControlBase) SetTranslucentBackground ¶
func (cba *ControlBase) SetTranslucentBackground()
func (*ControlBase) Show ¶
func (cba *ControlBase) Show()
func (*ControlBase) Size ¶
func (cba *ControlBase) Size() (width, height int)
func (*ControlBase) Text ¶
func (cba *ControlBase) Text() string
func (*ControlBase) ToggleVisible ¶
func (cba *ControlBase) ToggleVisible() bool
func (*ControlBase) Visible ¶
func (cba *ControlBase) Visible() bool
func (*ControlBase) Width ¶
func (cba *ControlBase) Width() int
type Controller ¶
type Controller interface { Text() string Enabled() bool SetFocus() Handle() w32.HWND Invalidate(erase bool) Parent() Controller Pos() (x, y int) Size() (w, h int) Height() int Width() int Visible() bool Bounds() *Rect ClientRect() *Rect SetText(s string) SetEnabled(b bool) SetPos(x, y int) SetSize(w, h int) EnableDragAcceptFiles(b bool) Show() Hide() ContextMenu() *MenuItem SetContextMenu(menu *MenuItem) Font() *Font SetFont(font *Font) InvokeRequired() bool Invoke(func()) PreTranslateMessage(msg *w32.MSG) bool WndProc(msg uint32, wparam, lparam uintptr) uintptr //General events OnCreate() *EventManager OnClose() *EventManager // Focus events OnKillFocus() *EventManager OnSetFocus() *EventManager //Drag and drop events OnDropFiles() *EventManager //Mouse events OnLBDown() *EventManager OnLBUp() *EventManager OnLBDbl() *EventManager OnMBDown() *EventManager OnMBUp() *EventManager OnRBDown() *EventManager OnRBUp() *EventManager OnRBDbl() *EventManager OnMouseMove() *EventManager // OnMouseLeave and OnMouseHover does not fire unless control called internalTrackMouseEvent. // Use MouseControl for a how to example. OnMouseHover() *EventManager OnMouseLeave() *EventManager //Keyboard events OnKeyUp() *EventManager //Paint events OnPaint() *EventManager OnSize() *EventManager // contains filtered or unexported methods }
func GetMsgHandler ¶
func GetMsgHandler(hwnd w32.HWND) Controller
type CtlState ¶
type CtlState struct {
X, Y, Width, Height int
}
DockState gets saved and loaded from json
type Dialog ¶
type Dialog struct { Form // contains filtered or unexported fields }
Dialog displayed as z-order top window until closed. It also disables parent window so it can not be clicked.
func NewDialog ¶
func NewDialog(parent Controller) *Dialog
func (*Dialog) OnCancel ¶
func (dlg *Dialog) OnCancel() *EventManager
func (*Dialog) OnOk ¶
func (dlg *Dialog) OnOk() *EventManager
func (*Dialog) PreTranslateMessage ¶
PreTranslateMessage handles dialog specific messages. IMPORTANT.
func (*Dialog) SetButtons ¶
func (dlg *Dialog) SetButtons(btnOk *PushButton, btnCancel *PushButton)
SetButtons wires up dialog events to buttons. btnCancel can be nil.
type DockAllow ¶
type DockAllow interface { Handle() w32.HWND ClientWidth() int ClientHeight() int SetLayout(mng LayoutManager) }
DockAllow is window, panel or other component that satisfies interface.
type Dockable ¶
type Dockable interface { Handle() w32.HWND Pos() (x, y int) Width() int Height() int Visible() bool SetPos(x, y int) SetSize(width, height int) OnMouseMove() *EventManager OnLBUp() *EventManager }
Dockable component must satisfy interface to be docked.
type DropFilesEventData ¶
type Edit ¶
type Edit struct { ControlBase // contains filtered or unexported fields }
func NewEdit ¶
func NewEdit(parent Controller) *Edit
type ErrorPanel ¶
type ErrorPanel struct { ControlBase // contains filtered or unexported fields }
ErrorPanel shows errors or important messages. It is meant to stand out of other on screen controls.
func (*ErrorPanel) Errorf ¶
func (epa *ErrorPanel) Errorf(format string, v ...interface{})
func (*ErrorPanel) Printf ¶
func (epa *ErrorPanel) Printf(format string, v ...interface{})
func (*ErrorPanel) SetMargin ¶
func (epa *ErrorPanel) SetMargin(margin int)
func (*ErrorPanel) ShowAsError ¶
func (epa *ErrorPanel) ShowAsError(show bool)
type Event ¶
type Event struct { Sender Controller Data interface{} }
func NewEvent ¶
func NewEvent(sender Controller, data interface{}) *Event
type EventHandler ¶
type EventHandler func(arg *Event)
type EventManager ¶
type EventManager struct {
// contains filtered or unexported fields
}
func (*EventManager) Bind ¶
func (evm *EventManager) Bind(handler EventHandler)
func (*EventManager) Fire ¶
func (evm *EventManager) Fire(arg *Event)
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
var ( GeneralWndprocCallBack = syscall.NewCallback(generalWndProc) DefaultFont *Font )
Public global variables.
type Form ¶
type Form struct { ControlBase // contains filtered or unexported fields }
A Form is main window of the application.
func NewCustomForm ¶
func NewCustomForm(parent Controller, exStyle int, dwStyle uint) *Form
func NewForm ¶
func NewForm(parent Controller) *Form
func (*Form) DisableIcon ¶
func (fm *Form) DisableIcon()
func (*Form) EnableDragMove ¶
func (*Form) EnableMaxButton ¶
func (*Form) EnableMinButton ¶
func (*Form) EnableSizable ¶
func (*Form) EnableTopMost ¶
func (*Form) Fullscreen ¶
func (fm *Form) Fullscreen()
func (*Form) IsFullScreen ¶
func (*Form) SetLayout ¶
func (fm *Form) SetLayout(mng LayoutManager)
func (*Form) UnFullscreen ¶
func (fm *Form) UnFullscreen()
type GroupBox ¶
type GroupBox struct {
Button
}
func NewGroupBox ¶
func NewGroupBox(parent Controller) *GroupBox
type HResizer ¶
type HResizer struct { ControlBase // contains filtered or unexported fields }
func NewHResizer ¶
func NewHResizer(parent Controller) *HResizer
func (*HResizer) SetControl ¶
type Icon ¶
type Icon struct {
// contains filtered or unexported fields
}
func NewIconFromFile ¶
func NewIconFromResource ¶
type IconButton ¶
type IconButton struct {
Button
}
IconButton does not display text, requires SetResIcon call.
func NewIconButton ¶
func NewIconButton(parent Controller) *IconButton
type ImageBox ¶
type ImageList ¶
type ImageList struct {
// contains filtered or unexported fields
}
func NewImageList ¶
func (*ImageList) AddResIcon ¶
func (*ImageList) Handle ¶
func (im *ImageList) Handle() w32.HIMAGELIST
func (*ImageList) ImageCount ¶
func (*ImageList) SetImageCount ¶
type ImageView ¶
type ImageView struct { ControlBase // contains filtered or unexported fields }
func NewImageView ¶
func NewImageView(parent Controller) *ImageView
func (*ImageView) DrawImageFile ¶
type ImageViewBox ¶
type ImageViewBox struct { ControlBase Boxes []*ImageBox // might be persisted to file // contains filtered or unexported fields }
ImageViewBox is image view with boxes.
func NewImageViewBox ¶
func NewImageViewBox(parent Controller) *ImageViewBox
func (*ImageViewBox) AddMode ¶
func (iv *ImageViewBox) AddMode() bool
func (*ImageViewBox) DeleteSelected ¶
func (iv *ImageViewBox) DeleteSelected()
func (*ImageViewBox) DrawImage ¶
func (iv *ImageViewBox) DrawImage(bmp *Bitmap)
func (*ImageViewBox) DrawImageFile ¶
func (iv *ImageViewBox) DrawImageFile(filepath string) (err error)
func (*ImageViewBox) HasSelected ¶
func (iv *ImageViewBox) HasSelected() bool
func (*ImageViewBox) IsLoaded ¶
func (iv *ImageViewBox) IsLoaded() bool
func (*ImageViewBox) IsModified ¶
func (iv *ImageViewBox) IsModified() bool
func (*ImageViewBox) NameSelected ¶
func (iv *ImageViewBox) NameSelected() string
func (*ImageViewBox) OnAdd ¶
func (iv *ImageViewBox) OnAdd() *EventManager
func (*ImageViewBox) OnModify ¶
func (iv *ImageViewBox) OnModify() *EventManager
func (*ImageViewBox) OnSelectedChange ¶
func (iv *ImageViewBox) OnSelectedChange() *EventManager
func (*ImageViewBox) SetAddMode ¶
func (iv *ImageViewBox) SetAddMode(add bool)
func (*ImageViewBox) SetModified ¶
func (iv *ImageViewBox) SetModified(modified bool)
func (*ImageViewBox) SetNameSelected ¶
func (iv *ImageViewBox) SetNameSelected(name string)
func (*ImageViewBox) SetTypeSelected ¶
func (iv *ImageViewBox) SetTypeSelected(typ int)
func (*ImageViewBox) TypeSelected ¶
func (iv *ImageViewBox) TypeSelected() int
type Key ¶
type Key uint16
const ( KeyLButton Key = w32.VK_LBUTTON KeyRButton Key = w32.VK_RBUTTON KeyCancel Key = w32.VK_CANCEL KeyMButton Key = w32.VK_MBUTTON KeyXButton1 Key = w32.VK_XBUTTON1 KeyXButton2 Key = w32.VK_XBUTTON2 KeyBack Key = w32.VK_BACK KeyTab Key = w32.VK_TAB KeyClear Key = w32.VK_CLEAR KeyReturn Key = w32.VK_RETURN KeyShift Key = w32.VK_SHIFT KeyControl Key = w32.VK_CONTROL KeyAlt Key = w32.VK_MENU KeyMenu Key = w32.VK_MENU KeyPause Key = w32.VK_PAUSE KeyCapital Key = w32.VK_CAPITAL KeyKana Key = w32.VK_KANA KeyHangul Key = w32.VK_HANGUL KeyJunja Key = w32.VK_JUNJA KeyFinal Key = w32.VK_FINAL KeyHanja Key = w32.VK_HANJA KeyKanji Key = w32.VK_KANJI KeyEscape Key = w32.VK_ESCAPE KeyConvert Key = w32.VK_CONVERT KeyNonconvert Key = w32.VK_NONCONVERT KeyAccept Key = w32.VK_ACCEPT KeyModeChange Key = w32.VK_MODECHANGE KeySpace Key = w32.VK_SPACE KeyPrior Key = w32.VK_PRIOR KeyNext Key = w32.VK_NEXT KeyEnd Key = w32.VK_END KeyHome Key = w32.VK_HOME KeyLeft Key = w32.VK_LEFT KeyUp Key = w32.VK_UP KeyRight Key = w32.VK_RIGHT KeyDown Key = w32.VK_DOWN KeySelect Key = w32.VK_SELECT KeyPrint Key = w32.VK_PRINT KeyExecute Key = w32.VK_EXECUTE KeySnapshot Key = w32.VK_SNAPSHOT KeyInsert Key = w32.VK_INSERT KeyDelete Key = w32.VK_DELETE KeyHelp Key = w32.VK_HELP Key0 Key = 0x30 Key1 Key = 0x31 Key2 Key = 0x32 Key3 Key = 0x33 Key4 Key = 0x34 Key5 Key = 0x35 Key6 Key = 0x36 Key7 Key = 0x37 Key8 Key = 0x38 Key9 Key = 0x39 KeyA Key = 0x41 KeyB Key = 0x42 KeyC Key = 0x43 KeyD Key = 0x44 KeyE Key = 0x45 KeyF Key = 0x46 KeyG Key = 0x47 KeyH Key = 0x48 KeyI Key = 0x49 KeyJ Key = 0x4A KeyK Key = 0x4B KeyL Key = 0x4C KeyM Key = 0x4D KeyN Key = 0x4E KeyO Key = 0x4F KeyP Key = 0x50 KeyQ Key = 0x51 KeyR Key = 0x52 KeyS Key = 0x53 KeyT Key = 0x54 KeyU Key = 0x55 KeyV Key = 0x56 KeyW Key = 0x57 KeyX Key = 0x58 KeyY Key = 0x59 KeyZ Key = 0x5A KeyLWIN Key = w32.VK_LWIN KeyRWIN Key = w32.VK_RWIN KeyApps Key = w32.VK_APPS KeySleep Key = w32.VK_SLEEP KeyNumpad0 Key = w32.VK_NUMPAD0 KeyNumpad1 Key = w32.VK_NUMPAD1 KeyNumpad2 Key = w32.VK_NUMPAD2 KeyNumpad3 Key = w32.VK_NUMPAD3 KeyNumpad4 Key = w32.VK_NUMPAD4 KeyNumpad5 Key = w32.VK_NUMPAD5 KeyNumpad6 Key = w32.VK_NUMPAD6 KeyNumpad7 Key = w32.VK_NUMPAD7 KeyNumpad8 Key = w32.VK_NUMPAD8 KeyNumpad9 Key = w32.VK_NUMPAD9 KeyMultiply Key = w32.VK_MULTIPLY KeyAdd Key = w32.VK_ADD KeySeparator Key = w32.VK_SEPARATOR KeySubtract Key = w32.VK_SUBTRACT KeyDecimal Key = w32.VK_DECIMAL KeyDivide Key = w32.VK_DIVIDE KeyF1 Key = w32.VK_F1 KeyF2 Key = w32.VK_F2 KeyF3 Key = w32.VK_F3 KeyF4 Key = w32.VK_F4 KeyF5 Key = w32.VK_F5 KeyF6 Key = w32.VK_F6 KeyF7 Key = w32.VK_F7 KeyF8 Key = w32.VK_F8 KeyF9 Key = w32.VK_F9 KeyF10 Key = w32.VK_F10 KeyF11 Key = w32.VK_F11 KeyF12 Key = w32.VK_F12 KeyF13 Key = w32.VK_F13 KeyF14 Key = w32.VK_F14 KeyF15 Key = w32.VK_F15 KeyF16 Key = w32.VK_F16 KeyF17 Key = w32.VK_F17 KeyF18 Key = w32.VK_F18 KeyF19 Key = w32.VK_F19 KeyF20 Key = w32.VK_F20 KeyF21 Key = w32.VK_F21 KeyF22 Key = w32.VK_F22 KeyF23 Key = w32.VK_F23 KeyF24 Key = w32.VK_F24 KeyNumlock Key = w32.VK_NUMLOCK KeyScroll Key = w32.VK_SCROLL KeyLShift Key = w32.VK_LSHIFT KeyRShift Key = w32.VK_RSHIFT KeyLControl Key = w32.VK_LCONTROL KeyRControl Key = w32.VK_RCONTROL KeyLAlt Key = w32.VK_LMENU KeyLMenu Key = w32.VK_LMENU KeyRAlt Key = w32.VK_RMENU KeyRMenu Key = w32.VK_RMENU KeyBrowserBack Key = w32.VK_BROWSER_BACK KeyBrowserForward Key = w32.VK_BROWSER_FORWARD KeyBrowserRefresh Key = w32.VK_BROWSER_REFRESH KeyBrowserStop Key = w32.VK_BROWSER_STOP KeyBrowserSearch Key = w32.VK_BROWSER_SEARCH KeyBrowserFavorites Key = w32.VK_BROWSER_FAVORITES KeyBrowserHome Key = w32.VK_BROWSER_HOME KeyVolumeMute Key = w32.VK_VOLUME_MUTE KeyVolumeDown Key = w32.VK_VOLUME_DOWN KeyVolumeUp Key = w32.VK_VOLUME_UP KeyMediaNextTrack Key = w32.VK_MEDIA_NEXT_TRACK KeyMediaPrevTrack Key = w32.VK_MEDIA_PREV_TRACK KeyMediaStop Key = w32.VK_MEDIA_STOP KeyMediaPlayPause Key = w32.VK_MEDIA_PLAY_PAUSE KeyLaunchMail Key = w32.VK_LAUNCH_MAIL KeyLaunchMediaSelect Key = w32.VK_LAUNCH_MEDIA_SELECT KeyLaunchApp1 Key = w32.VK_LAUNCH_APP1 KeyLaunchApp2 Key = w32.VK_LAUNCH_APP2 KeyOEM1 Key = w32.VK_OEM_1 KeyOEMPlus Key = w32.VK_OEM_PLUS KeyOEMComma Key = w32.VK_OEM_COMMA KeyOEMMinus Key = w32.VK_OEM_MINUS KeyOEMPeriod Key = w32.VK_OEM_PERIOD KeyOEM2 Key = w32.VK_OEM_2 KeyOEM3 Key = w32.VK_OEM_3 KeyOEM4 Key = w32.VK_OEM_4 KeyOEM5 Key = w32.VK_OEM_5 KeyOEM6 Key = w32.VK_OEM_6 KeyOEM7 Key = w32.VK_OEM_7 KeyOEM8 Key = w32.VK_OEM_8 KeyOEM102 Key = w32.VK_OEM_102 KeyProcessKey Key = w32.VK_PROCESSKEY KeyPacket Key = w32.VK_PACKET KeyAttn Key = w32.VK_ATTN KeyCRSel Key = w32.VK_CRSEL KeyEXSel Key = w32.VK_EXSEL KeyErEOF Key = w32.VK_EREOF KeyPlay Key = w32.VK_PLAY KeyZoom Key = w32.VK_ZOOM KeyNoName Key = w32.VK_NONAME KeyPA1 Key = w32.VK_PA1 KeyOEMClear Key = w32.VK_OEM_CLEAR )
type KeyUpEventData ¶
type KeyUpEventData struct {
VKey, Code int
}
type Label ¶
type Label struct {
ControlBase
}
func NewLabel ¶
func NewLabel(parent Controller) *Label
type LabelEditEventData ¶
type LayoutControl ¶
type LayoutControl struct {
// contains filtered or unexported fields
}
type LayoutControls ¶
type LayoutControls []*LayoutControl
func (LayoutControls) Len ¶
func (lc LayoutControls) Len() int
func (LayoutControls) Less ¶
func (lc LayoutControls) Less(i, j int) bool
func (LayoutControls) Swap ¶
func (lc LayoutControls) Swap(i, j int)
type LayoutManager ¶
type LayoutManager interface {
Update()
}
type LayoutState ¶
type ListItem ¶
type ListItem interface { Text() []string // Text returns the text of the multi-column item. ImageIndex() int // ImageIndex is used only if SetImageList is called on the listview }
ListItem represents an item in a ListView widget.
type ListItemChecker ¶
ListItemChecker is used for checkbox support in ListView.
type ListItemSetter ¶
type ListItemSetter interface {
SetText(s string) // set first item in the array via LabelEdit event
}
ListItemSetter is used in OnEndLabelEdit event.
type ListView ¶
type ListView struct { ControlBase // contains filtered or unexported fields }
func NewListView ¶
func NewListView(parent Controller) *ListView
func (*ListView) CheckBoxes ¶
CheckBoxes returns if the *TableView has check boxes.
func (*ListView) DeleteAllItems ¶
func (*ListView) DeleteItem ¶
func (*ListView) EnableDoubleBuffer ¶
func (*ListView) EnableEditLabels ¶
func (*ListView) EnableFullRowSelect ¶
func (*ListView) EnableHotTrack ¶
func (*ListView) EnableSingleSelect ¶
func (*ListView) EnableSortAscending ¶
func (*ListView) EnableSortHeader ¶
func (*ListView) EnsureVisible ¶
func (*ListView) InsertItem ¶
func (*ListView) OnCheckChanged ¶
func (lv *ListView) OnCheckChanged() *EventManager
func (*ListView) OnClick ¶
func (lv *ListView) OnClick() *EventManager
func (*ListView) OnDoubleClick ¶
func (lv *ListView) OnDoubleClick() *EventManager
func (*ListView) OnEndLabelEdit ¶
func (lv *ListView) OnEndLabelEdit() *EventManager
Event publishers
func (*ListView) OnEndScroll ¶
func (lv *ListView) OnEndScroll() *EventManager
func (*ListView) OnItemChanged ¶
func (lv *ListView) OnItemChanged() *EventManager
func (*ListView) OnItemChanging ¶
func (lv *ListView) OnItemChanging() *EventManager
func (*ListView) OnKeyDown ¶
func (lv *ListView) OnKeyDown() *EventManager
func (*ListView) OnViewChange ¶
func (lv *ListView) OnViewChange() *EventManager
func (*ListView) SelectedCount ¶
func (*ListView) SelectedIndex ¶
GetSelectedIndex first selected item index. Returns -1 if no item is selected.
func (*ListView) SelectedItem ¶
func (*ListView) SelectedItems ¶
mask is used to set the LVITEM.Mask for ListView.GetItem which indicates which attributes you'd like to receive of LVITEM.
func (*ListView) SetCheckBoxes ¶
SetCheckBoxes sets if the *TableView has check boxes.
func (*ListView) SetImageList ¶
func (*ListView) SetItemCount ¶
func (*ListView) SetSelectedIndex ¶
Set i to -1 to select all items.
func (*ListView) SetSelectedItem ¶
func (*ListView) StretchLastColumn ¶
StretchLastColumn makes the last column take up all remaining horizontal space of the *ListView. The effect of this is not persistent.
func (*ListView) UpdateItem ¶
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
Menu for main window and context menus on controls. Most methods used for both main window menu and context menu.
func (*Menu) AddSubMenu ¶
AddSubMenu returns item that is used as submenu to perform AddItem(s).
func (*Menu) IsDisposed ¶
type MenuItem ¶
type MenuItem struct {
// contains filtered or unexported fields
}
func NewContextMenu ¶
func NewContextMenu() *MenuItem
func (*MenuItem) AddItemCheckable ¶
AddItemCheckable adds plain menu item that can have a checkmark.
func (*MenuItem) AddItemRadio ¶
AddItemRadio adds plain menu item that can have a checkmark and is part of a radio group.
func (*MenuItem) AddItemWithBitmap ¶
AddItemWithBitmap adds menu item with shortcut and bitmap.
func (*MenuItem) AddSeparator ¶
func (mi *MenuItem) AddSeparator()
func (*MenuItem) AddSubMenu ¶
AddSubMenu adds a submenu.
func (*MenuItem) IsSeparator ¶
func (*MenuItem) OnClick ¶
func (mi *MenuItem) OnClick() *EventManager
func (*MenuItem) SetCheckable ¶
func (*MenuItem) SetChecked ¶
func (*MenuItem) SetEnabled ¶
func (*MenuItem) SetSeparator ¶
func (mi *MenuItem) SetSeparator()
func (*MenuItem) SetToolTip ¶
type MouseControl ¶
type MouseControl struct { ControlBase // contains filtered or unexported fields }
MouseControl used for creating custom controls that need mouse hover or mouse leave events.
func (*MouseControl) Init ¶
func (cc *MouseControl) Init(parent Controller, className string, exStyle, style uint)
type MouseEventData ¶
type MultiEdit ¶
type MultiEdit struct { ControlBase // contains filtered or unexported fields }
MultiEdit is multiline text edit.
func NewMultiEdit ¶
func NewMultiEdit(parent Controller) *MultiEdit
type MultiPanel ¶
type MultiPanel struct { ControlBase // contains filtered or unexported fields }
MultiPanel contains other panels and only makes one of them visible.
func NewMultiPanel ¶
func NewMultiPanel(parent Controller) *MultiPanel
func (*MultiPanel) AddPanel ¶
func (mpa *MultiPanel) AddPanel(panel *Panel)
AddPanel adds panels to the internal list, first panel is visible all others are hidden.
func (*MultiPanel) Count ¶
func (mpa *MultiPanel) Count() int
func (*MultiPanel) Current ¶
func (mpa *MultiPanel) Current() int
func (*MultiPanel) DeletePanel ¶
func (mpa *MultiPanel) DeletePanel(index int)
DeletePanel removed panel.
func (*MultiPanel) ReplacePanel ¶
func (mpa *MultiPanel) ReplacePanel(index int, panel *Panel)
ReplacePanel replaces panel, useful for refreshing controls on screen.
func (*MultiPanel) SetCurrent ¶
func (mpa *MultiPanel) SetCurrent(index int)
type PaintEventData ¶
type PaintEventData struct {
Canvas *Canvas
}
type Panel ¶
type Panel struct { ControlBase // contains filtered or unexported fields }
func NewPanel ¶
func NewPanel(parent Controller) *Panel
func (*Panel) SetLayout ¶
func (pa *Panel) SetLayout(mng LayoutManager)
SetLayout panel implements DockAllow interface.
type Pen ¶
type Pen struct {
// contains filtered or unexported fields
}
func NewNullPen ¶
func NewNullPen() *Pen
type ProgressBar ¶
type ProgressBar struct {
ControlBase
}
func NewProgressBar ¶
func NewProgressBar(parent Controller) *ProgressBar
func (*ProgressBar) Range ¶
func (pr *ProgressBar) Range() (min, max uint)
func (*ProgressBar) SetRange ¶
func (pr *ProgressBar) SetRange(min, max int)
func (*ProgressBar) SetValue ¶
func (pr *ProgressBar) SetValue(v int)
func (*ProgressBar) Value ¶
func (pr *ProgressBar) Value() int
type PushButton ¶
type PushButton struct {
Button
}
func NewPushButton ¶
func NewPushButton(parent Controller) *PushButton
func (*PushButton) SetDefault ¶
func (pb *PushButton) SetDefault()
SetDefault is used for dialogs to set default button.
type RadioButton ¶
type RadioButton struct {
Button
}
func NewRadioButton ¶
func NewRadioButton(parent Controller) *RadioButton
type RadioGroup ¶
type RadioGroup struct {
// contains filtered or unexported fields
}
type Rect ¶
type Rect struct {
// contains filtered or unexported fields
}
func NewEmptyRect ¶
func NewEmptyRect() *Rect
func (*Rect) GetW32Rect ¶
type ScrollView ¶
type ScrollView struct { ControlBase // contains filtered or unexported fields }
func NewScrollView ¶
func NewScrollView(parent Controller) *ScrollView
func (*ScrollView) SetChild ¶
func (sv *ScrollView) SetChild(child Dockable)
func (*ScrollView) UpdateScrollBars ¶
func (sv *ScrollView) UpdateScrollBars()
type SimpleDock ¶
type SimpleDock struct {
// contains filtered or unexported fields
}
func NewSimpleDock ¶
func NewSimpleDock(parent DockAllow) *SimpleDock
func (*SimpleDock) Dock ¶
func (sd *SimpleDock) Dock(child Dockable, dir Direction)
Layout management for the child controls.
func (*SimpleDock) LoadState ¶
func (sd *SimpleDock) LoadState(r io.Reader) error
LoadState of the layout. Only works for Docks with parent set to main form.
func (*SimpleDock) LoadStateFile ¶
func (sd *SimpleDock) LoadStateFile(file string) error
LoadStateFile loads state ignores error if file is not found.
func (*SimpleDock) SaveState ¶
func (sd *SimpleDock) SaveState(w io.Writer) error
SaveState of the layout. Only works for Docks with parent set to main form.
func (*SimpleDock) SaveStateFile ¶
func (sd *SimpleDock) SaveStateFile(file string) error
SaveStateFile convenience function.
func (*SimpleDock) Update ¶
func (sd *SimpleDock) Update()
Update is called to resize child items based on layout directions.
type SizeEventData ¶
type Slider ¶
type Slider struct { ControlBase // contains filtered or unexported fields }
func NewSlider ¶
func NewSlider(parent Controller) *Slider
func (*Slider) OnScroll ¶
func (tb *Slider) OnScroll() *EventManager
type StringListItem ¶
StringListItem is helper for basic string lists.
func (StringListItem) Checked ¶
func (s StringListItem) Checked() bool
func (StringListItem) ImageIndex ¶
func (s StringListItem) ImageIndex() int
func (StringListItem) SetChecked ¶
func (s StringListItem) SetChecked(checked bool)
func (StringListItem) Text ¶
func (s StringListItem) Text() []string
type StringTreeItem ¶
StringTreeItem is helper for basic string lists.
func (StringTreeItem) ImageIndex ¶
func (s StringTreeItem) ImageIndex() int
func (StringTreeItem) Text ¶
func (s StringTreeItem) Text() string
type TabView ¶
type TabView struct { ControlBase // contains filtered or unexported fields }
TabView creates MultiPanel internally and manages tabs as panels.
func NewTabView ¶
func NewTabView(parent Controller) *TabView
func (*TabView) DeletePanel ¶
func (*TabView) Panels ¶
func (tv *TabView) Panels() *MultiPanel
func (*TabView) SetCurrent ¶
type ToolButton ¶
type ToolButton struct {
// contains filtered or unexported fields
}
func (*ToolButton) Checkable ¶
func (bt *ToolButton) Checkable() bool
func (*ToolButton) Checked ¶
func (bt *ToolButton) Checked() bool
func (*ToolButton) Enabled ¶
func (bt *ToolButton) Enabled() bool
func (*ToolButton) Image ¶
func (bt *ToolButton) Image() int
func (*ToolButton) IsSeparator ¶
func (bt *ToolButton) IsSeparator() bool
func (*ToolButton) OnClick ¶
func (bt *ToolButton) OnClick() *EventManager
func (*ToolButton) SetCheckable ¶
func (bt *ToolButton) SetCheckable(b bool)
func (*ToolButton) SetChecked ¶
func (bt *ToolButton) SetChecked(b bool)
func (*ToolButton) SetEnabled ¶
func (bt *ToolButton) SetEnabled(b bool)
func (*ToolButton) SetImage ¶
func (bt *ToolButton) SetImage(i int)
func (*ToolButton) SetSeparator ¶
func (bt *ToolButton) SetSeparator()
func (*ToolButton) SetText ¶
func (bt *ToolButton) SetText(s string)
func (*ToolButton) Text ¶
func (bt *ToolButton) Text() string
type ToolTip ¶
type ToolTip struct {
ControlBase
}
func NewToolTip ¶
func NewToolTip(parent Controller) *ToolTip
type Toolbar ¶
type Toolbar struct { ControlBase // contains filtered or unexported fields }
func NewHToolbar ¶
func NewHToolbar(parent Controller) *Toolbar
NewHToolbar creates horizontal toolbar with text on same line as image.
func NewToolbar ¶
func NewToolbar(parent Controller) *Toolbar
NewToolbar creates toolbar with text below the image.
func (*Toolbar) AddButton ¶
func (tb *Toolbar) AddButton(text string, image int) *ToolButton
AddButton creates and adds button to the toolbar. Use returned toolbutton to setup OnClick event.
func (*Toolbar) AddSeparator ¶
func (tb *Toolbar) AddSeparator()
func (*Toolbar) SetImageList ¶
type TreeItem ¶
type TreeItem interface { Text() string // Text returns the text of the item. ImageIndex() int // ImageIndex is used only if SetImageList is called on the treeview }
TreeItem represents an item in a TreeView widget.
type TreeView ¶
type TreeView struct { ControlBase // contains filtered or unexported fields }
func NewTreeView ¶
func NewTreeView(parent Controller) *TreeView
func (*TreeView) DeleteAllItems ¶
func (*TreeView) DeleteItem ¶
func (*TreeView) EnableDoubleBuffer ¶
func (*TreeView) EnsureVisible ¶
func (*TreeView) InsertItem ¶
func (*TreeView) OnCollapse ¶
func (tv *TreeView) OnCollapse() *EventManager
func (*TreeView) OnExpand ¶
func (tv *TreeView) OnExpand() *EventManager
func (*TreeView) OnSelectedChange ¶
func (tv *TreeView) OnSelectedChange() *EventManager
func (*TreeView) OnViewChange ¶
func (tv *TreeView) OnViewChange() *EventManager
func (*TreeView) SelectedItem ¶
SelectedItem is current selected item after OnSelectedChange event.
func (*TreeView) SetImageList ¶
func (*TreeView) SetSelectedItem ¶
func (*TreeView) UpdateItem ¶
type VResizer ¶
type VResizer struct { ControlBase // contains filtered or unexported fields }
func NewVResizer ¶
func NewVResizer(parent Controller) *VResizer
func (*VResizer) SetControl ¶
Source Files ¶
- app.go
- bitmap.go
- brush.go
- buttons.go
- canvas.go
- color.go
- combobox.go
- commondlgs.go
- controlbase.go
- controller.go
- dialog.go
- edit.go
- event.go
- eventdata.go
- eventmanager.go
- font.go
- form.go
- globalvars.go
- icon.go
- imagelist.go
- imageview.go
- imageviewbox.go
- init.go
- keyboard.go
- label.go
- layout.go
- listview.go
- menu.go
- mousecontrol.go
- msghandlerregistry.go
- panel.go
- path.go
- pen.go
- progressbar.go
- rect.go
- resizer.go
- scrollview.go
- slider.go
- tabview.go
- toolbar.go
- tooltip.go
- treeview.go
- utils.go
- wndproc.go