Documentation ¶
Index ¶
- Variables
- func Attach(hwnd win32.HWND, window *WindowBase) error
- func PreTranslateMessage(msg *win32.MSG) bool
- type MouseClickOpt
- type MsgListenerKey
- type PopupMenuSpec
- type Spec
- type Window
- type WindowBase
- func (w *WindowBase) AddMsgListener(message win32.UINT, ...) MsgListenerKey
- func (w *WindowBase) DPI() (win32.UINT, error)
- func (w *WindowBase) Destroy() error
- func (w *WindowBase) GetClientRect() (*win32.RECT, error)
- func (w *WindowBase) HWND() win32.HWND
- func (w *WindowBase) InvalidateRect(rect *win32.RECT, eraseBk bool) error
- func (w *WindowBase) SetPaintCallback(f func(dc *paint.PaintDC, prev func(*paint.PaintDC)))
- func (w *WindowBase) SetText(text string) error
- func (w *WindowBase) SetValue(key, value any)
- func (w *WindowBase) SetWndProc(wndProc WndProc)
- func (w *WindowBase) Show(cmd win32.SHOW_WINDOW_CMD)
- func (w *WindowBase) Text() (string, error)
- func (w *WindowBase) TrackPopupMenu(menu *menu.Menu, spec *PopupMenuSpec) error
- func (w *WindowBase) Value(key any) any
- type WndProc
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyAttached = errors.New("already attached")
wiErrAlreadyAttached is returned by Attach if the HWND or *WindowBase is already attached.
Functions ¶
func PreTranslateMessage ¶
Types ¶
type MouseClickOpt ¶
func (MouseClickOpt) Control ¶
func (mk MouseClickOpt) Control() bool
func (MouseClickOpt) LButton ¶
func (mk MouseClickOpt) LButton() bool
func (MouseClickOpt) MButton ¶
func (mk MouseClickOpt) MButton() bool
func (MouseClickOpt) RDown ¶
func (mk MouseClickOpt) RDown() bool
func (MouseClickOpt) Shift ¶
func (mk MouseClickOpt) Shift() bool
func (MouseClickOpt) XButton1 ¶
func (mk MouseClickOpt) XButton1() bool
func (MouseClickOpt) XButton2 ¶
func (mk MouseClickOpt) XButton2() bool
type MsgListenerKey ¶
type MsgListenerKey struct {
// contains filtered or unexported fields
}
MsgListenerKey represents a message listener added by WindowBase.AddMsgListener.
type PopupMenuSpec ¶
type Spec ¶
type Spec struct { ClassName string Text string Style win32.WINDOW_STYLE ExStyle win32.WINDOW_EX_STYLE X win32.INT Y win32.INT Width win32.INT Height win32.INT InCurrentDPI bool // If true, X, Y, Width and Height are in current DPI, otherwise in USER_DEFAULT_SCREEN_DPI. WndParent win32.HWND Menu *menu.Menu Instance win32.HINSTANCE // 0 for this module. OnCreate func() OnClose func() }
type Window ¶
type Window struct { WindowBase OnCreate func() OnClose func() }
type WindowBase ¶
type WindowBase struct { OnLButtonUp func(opt MouseClickOpt, x int, y int) OnLButtonDown func(opt MouseClickOpt, x int, y int) OnRButtonUp func(opt MouseClickOpt, x int, y int) OnRButtonDown func(opt MouseClickOpt, x int, y int) // contains filtered or unexported fields }
func Query ¶
func Query(hwnd win32.HWND) *WindowBase
func (*WindowBase) AddMsgListener ¶
func (w *WindowBase) AddMsgListener(message win32.UINT, listener func(hwnd win32.HWND, message win32.UINT, wParam win32.WPARAM, lParam win32.LPARAM)) MsgListenerKey
AddMsgListener adds a listener that is called when the message is received in the window procedure. To remove the listener, call Remove() of the returned MsgListenerKey.
func (*WindowBase) Destroy ¶
func (w *WindowBase) Destroy() error
func (*WindowBase) GetClientRect ¶
func (w *WindowBase) GetClientRect() (*win32.RECT, error)
func (*WindowBase) HWND ¶
func (w *WindowBase) HWND() win32.HWND
func (*WindowBase) InvalidateRect ¶
func (w *WindowBase) InvalidateRect(rect *win32.RECT, eraseBk bool) error
func (*WindowBase) SetPaintCallback ¶
func (w *WindowBase) SetPaintCallback(f func(dc *paint.PaintDC, prev func(*paint.PaintDC)))
func (*WindowBase) SetText ¶
func (w *WindowBase) SetText(text string) error
func (*WindowBase) SetValue ¶
func (w *WindowBase) SetValue(key, value any)
Value sets the value associated with this window for key. Setting A nil value deletes the value associated with key if any. See Context.Value() in context package for the concept and usage of associated value.
func (*WindowBase) SetWndProc ¶
func (w *WindowBase) SetWndProc(wndProc WndProc)
SetWndProc sets the window procedure of w. It panics if wndProc is nil.
func (*WindowBase) Show ¶
func (w *WindowBase) Show(cmd win32.SHOW_WINDOW_CMD)
func (*WindowBase) Text ¶
func (w *WindowBase) Text() (string, error)
func (*WindowBase) TrackPopupMenu ¶
func (w *WindowBase) TrackPopupMenu(menu *menu.Menu, spec *PopupMenuSpec) error
TrackPopupMenu tracks a popup menu. If spec is nil, default flag, empty exclude RECT and GetCursorPos() are used.
func (*WindowBase) Value ¶
func (w *WindowBase) Value(key any) any
Value returns the value associated with this window for key, or nil if no value is associated with key. See Context.Value() in context package for the concept and usage of associated value.