Showing preview only (1,188K chars total). Download the full file or copy to clipboard to get everything.
Repository: lxn/walk
Branch: master
Commit: c389da54e794
Files: 254
Total size: 1.1 MB
Directory structure:
gitextract_aroynwxm/
├── AUTHORS
├── LICENSE
├── README.mdown
├── accessibility.go
├── action.go
├── actionlist.go
├── application.go
├── bitmap.go
├── boxlayout.go
├── brush.go
├── button.go
├── cancelevent.go
├── canvas.go
├── checkbox.go
├── clipboard.go
├── closeevent.go
├── color.go
├── combobox.go
├── commondialogs.go
├── composite.go
├── condition.go
├── container.go
├── cursor.go
├── customwidget.go
├── databinding.go
├── dateedit.go
├── datelabel.go
├── declarative/
│ ├── accessibility.go
│ ├── action.go
│ ├── brush.go
│ ├── builder.go
│ ├── checkbox.go
│ ├── combobox.go
│ ├── composite.go
│ ├── customwidget.go
│ ├── databinder.go
│ ├── dateedit.go
│ ├── datelabel.go
│ ├── dialog.go
│ ├── font.go
│ ├── gradientcomposite.go
│ ├── groupbox.go
│ ├── imageview.go
│ ├── interfaces.go
│ ├── label.go
│ ├── layouts.go
│ ├── lineedit.go
│ ├── linklabel.go
│ ├── listbox.go
│ ├── mainwindow.go
│ ├── nonwin.go
│ ├── numberedit.go
│ ├── numberlabel.go
│ ├── progressbar.go
│ ├── pushbutton.go
│ ├── radiobutton.go
│ ├── radiobuttongroup.go
│ ├── radiobuttongroupbox.go
│ ├── scrollview.go
│ ├── separator.go
│ ├── slider.go
│ ├── spacer.go
│ ├── splitbutton.go
│ ├── splitter.go
│ ├── tableview.go
│ ├── tableviewcolumn.go
│ ├── tabpage.go
│ ├── tabwidget.go
│ ├── textedit.go
│ ├── textlabel.go
│ ├── toolbar.go
│ ├── toolbutton.go
│ ├── treeview.go
│ ├── validators.go
│ └── webview.go
├── dialog.go
├── dropfilesevent.go
├── error.go
├── errorevent.go
├── event.go
├── examples/
│ ├── actions/
│ │ ├── actions.exe.manifest
│ │ ├── actions.go
│ │ └── rsrc.syso
│ ├── clipboard/
│ │ ├── clipboard.exe.manifest
│ │ ├── clipboard.go
│ │ └── rsrc.syso
│ ├── databinding/
│ │ ├── databinding.exe.manifest
│ │ ├── databinding.go
│ │ └── rsrc.syso
│ ├── drawing/
│ │ ├── drawing.exe.manifest
│ │ ├── drawing.go
│ │ └── rsrc.syso
│ ├── dropfiles/
│ │ ├── dropfiles.exe.manifest
│ │ ├── dropfiles.go
│ │ └── rsrc.syso
│ ├── externalwidgets/
│ │ ├── externalwidgets.exe.manifest
│ │ ├── externalwidgets.go
│ │ └── rsrc.syso
│ ├── filebrowser/
│ │ ├── filebrowser.exe.manifest
│ │ ├── filebrowser.go
│ │ └── rsrc.syso
│ ├── gradientcomposite/
│ │ ├── gradientcomposite.exe.manifest
│ │ ├── gradientcomposite.go
│ │ └── rsrc.syso
│ ├── imageicon/
│ │ ├── imageicon.exe.manifest
│ │ ├── main.go
│ │ └── rsrc.syso
│ ├── imageview/
│ │ ├── imageview.exe.manifest
│ │ ├── imageview.go
│ │ └── rsrc.syso
│ ├── imageviewer/
│ │ ├── imageviewer.exe.manifest
│ │ ├── imageviewer.go
│ │ └── rsrc.syso
│ ├── img/
│ │ └── README
│ ├── linklabel/
│ │ ├── linklabel.exe.manifest
│ │ ├── linklabel.go
│ │ └── rsrc.syso
│ ├── listbox/
│ │ ├── listbox.exe.manifest
│ │ ├── listbox.go
│ │ └── rsrc.syso
│ ├── listbox_ownerdrawing/
│ │ ├── listbox_ownerdrawing.exe.manifest
│ │ ├── listbox_ownerdrawing.go
│ │ └── rsrc.syso
│ ├── logview/
│ │ ├── logview.exe.manifest
│ │ ├── logview.go
│ │ ├── logviewapp.go
│ │ └── rsrc.syso
│ ├── multiplepages/
│ │ ├── main.go
│ │ ├── multipagemainwindow.go
│ │ ├── multiplepages.exe.manifest
│ │ └── rsrc.syso
│ ├── notifyicon/
│ │ ├── notifyicon.exe.manifest
│ │ ├── notifyicon.go
│ │ └── rsrc.syso
│ ├── progressindicator/
│ │ ├── dialog.ui
│ │ ├── dialog_ui.go
│ │ ├── pi.go
│ │ ├── progressindicator.exe.manifest
│ │ └── rsrc.syso
│ ├── radiobutton/
│ │ ├── radiobutton.exe.manifest
│ │ ├── radiobutton.go
│ │ └── rsrc.syso
│ ├── settings/
│ │ ├── rsrc.syso
│ │ ├── settings.exe.manifest
│ │ └── settings.go
│ ├── slider/
│ │ ├── rsrc.syso
│ │ ├── slider.exe.manifest
│ │ └── slider.go
│ ├── statusbar/
│ │ ├── rsrc.syso
│ │ ├── statusbar.exe.manifest
│ │ └── statusbar.go
│ ├── tableview/
│ │ ├── rsrc.syso
│ │ ├── tableview.exe.manifest
│ │ └── tableview.go
│ ├── webview/
│ │ ├── rsrc.syso
│ │ ├── webview.exe.manifest
│ │ └── webview.go
│ └── webview_events/
│ ├── rsrc.syso
│ ├── webview_events.exe.manifest
│ └── webview_events.go
├── expression.go
├── flowlayout.go
├── font.go
├── fontresource.go
├── form.go
├── gradientcomposite.go
├── graphicseffects.go
├── gridlayout.go
├── groupbox.go
├── icon.go
├── iconcache.go
├── image.go
├── imagelist.go
├── imageview.go
├── inifilesettings.go
├── intevent.go
├── intrangeevent.go
├── keyboard.go
├── keyevent.go
├── l10n/
│ ├── update.bat
│ ├── walk-de.tr
│ └── walk-ko.tr
├── label.go
├── layout.go
├── lineedit.go
├── linklabel.go
├── listbox.go
├── mainloop_cgo.go
├── mainloop_default.go
├── mainwindow.go
├── maptablemodel.go
├── menu.go
├── messagebox.go
├── metafile.go
├── models.go
├── mouseevent.go
├── notifyicon.go
├── numberedit.go
├── numberlabel.go
├── path.go
├── pen.go
├── point.go
├── progressbar.go
├── progressindicator.go
├── property.go
├── pushbutton.go
├── radiobutton.go
├── rectangle.go
├── reflectmodels.go
├── registry.go
├── resourcemanager.go
├── scrollview.go
├── separator.go
├── simpletypes.go
├── size.go
├── slider.go
├── spacer.go
├── splitbutton.go
├── splitter.go
├── splitterhandle.go
├── splitterlayout.go
├── static.go
├── statusbar.go
├── stopwatch.go
├── stringevent.go
├── tableview.go
├── tableviewcolumn.go
├── tableviewcolumnlist.go
├── tabpage.go
├── tabpagelist.go
├── tabwidget.go
├── textedit.go
├── textlabel.go
├── toolbar.go
├── toolbutton.go
├── tools/
│ └── ui2walk/
│ └── ui2walk.go
├── tooltip.go
├── tooltiperrorpresenter.go
├── treeitemevent.go
├── treeview.go
├── util.go
├── validators.go
├── walk.go
├── webview.go
├── webview_dwebbrowserevents2.go
├── webview_events.go
├── webview_idochostuihandler.go
├── webview_ioleclientsite.go
├── webview_ioleinplaceframe.go
├── webview_ioleinplacesite.go
├── widget.go
├── widgetlist.go
├── window.go
└── windowgroup.go
================================================
FILE CONTENTS
================================================
================================================
FILE: AUTHORS
================================================
# This is the official list of 'Walk' authors for copyright purposes.
# Names should be added to this file as
# Name or Organization <email address>
# The email address is not required for organizations.
# Please keep the list sorted.
# Contributors
# ============
Alexander Neumann <an2048@gmail.com>
Aman Gupta <aman@tmm1.net>
Anthony Dong <adongy@users.noreply.github.com>
Attila Tajti <attila.tajti@gmail.com>
Audrius Karabanovas <audrius@karabanovas.net>
Benny Siegert <bsiegert@gmail.com>
Cary Cherng <ccherng@gmail.com>
Dmitry Bagdanov <dimbojob@gmail.com>
Ham Yeongtaek <yeongtaek.ham@gmail.com>
Hill <zhu.bicen@gmail.com>
iquanxin <iquanxin@aliyun.com>
James Scholes <james@jamesscholes.com>
Jason A. Donenfeld <Jason@zx2c4.com>
Joseph Watson <jtwatson@linux-consulting.us>
Joshua D. Sjoding <joshua.sjoding@scjalliance.com>
ktye <ktye.users.noreply.github.com>
llxwj <llxwjlove@gmail.com>
Mateusz Czapliński <czapkofan@gmail.com>
Michael Teichgräber <mteichgraeber@gmx.de>
Paul Wolf <paul.wolf23@gmail.com>
ryujimiya <ryujimiya236@gmail.com>
Semyon Tokarev <zlobzn@gmail.com>
Shawn Sun <datago@yeah.net>
Simon Rozman <simon@rozman.si>
Tim Dufrane <tim.dufrane@gmail.com>
Vincent Vanackere <vincent.vanackere@gmail.com>
xoviat <xoviat@gmail.com>
evangwt <evangwt@gmail.com>
================================================
FILE: LICENSE
================================================
Copyright (c) 2010 The Walk Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
================================================
FILE: README.mdown
================================================
About Walk
==========
Walk is a "Windows Application Library Kit" for the Go Programming Language.
Its primarily useful for Desktop GUI development, but there is some more stuff.
Setup
=====
Make sure you have a working Go installation.
See [Getting Started](http://golang.org/doc/install.html)
##### Note
Walk currently requires Go 1.11.x or later.
##### To Install
Now run `go get github.com/lxn/walk`
Using Walk
==========
The preferred way to create GUIs with Walk is to use its declarative sub package,
as illustrated in this small example:
##### `test.go`
```go
package main
import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"strings"
)
func main() {
var inTE, outTE *walk.TextEdit
MainWindow{
Title: "SCREAMO",
MinSize: Size{600, 400},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "SCREAM",
OnClicked: func() {
outTE.SetText(strings.ToUpper(inTE.Text()))
},
},
},
}.Run()
}
```
##### Create Manifest `test.manifest`
```xml
<?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="SomeFunkyNameHere" type="win32"/>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
</windowsSettings>
</application>
</assembly>
```
Then either compile the manifest using the [rsrc tool](https://github.com/akavel/rsrc), like this:
go get github.com/akavel/rsrc
rsrc -manifest test.manifest -o rsrc.syso
or rename the `test.manifest` file to `test.exe.manifest` and distribute it with the application instead.
##### Build app
In the directory containing `test.go` run
go build
To get rid of the cmd window, instead run
go build -ldflags="-H windowsgui"
##### Run app
test.exe
##### Sample Output (Windows 7)

##### More Examples
There are some [examples](examples) that should get you started.
Application Manifest Files
==========================
Walk requires Common Controls 6. This means that you must put an appropriate
application manifest file either next to your executable or embedded as a
resource.
You can copy one of the application manifest files that come with the examples.
To embed a manifest file as a resource, you can use the [rsrc tool](https://github.com/akavel/rsrc).
IMPORTANT: If you don't embed a manifest as a resource, then you should not launch
your executable before the manifest file is in place.
If you do anyway, the program will not run properly. And worse, Windows will not
recognize a manifest file, you later drop next to the executable. To fix this,
rebuild your executable and only launch it with a manifest file in place.
CGo Optimizations
=================
The usual default message loop includes calls to win32 API functions, which incurs a decent amount
of runtime overhead coming from Go. As an alternative to this, you may compile Walk using an
optional C implementation of the main message loop, by passing the `walk_use_cgo` build tag:
go build -tags walk_use_cgo
================================================
FILE: accessibility.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import "github.com/lxn/win"
// AccState enum defines the state of the window/control
type AccState int32
// Window/control states
const (
AccStateNormal AccState = win.STATE_SYSTEM_NORMAL
AccStateUnavailable AccState = win.STATE_SYSTEM_UNAVAILABLE
AccStateSelected AccState = win.STATE_SYSTEM_SELECTED
AccStateFocused AccState = win.STATE_SYSTEM_FOCUSED
AccStatePressed AccState = win.STATE_SYSTEM_PRESSED
AccStateChecked AccState = win.STATE_SYSTEM_CHECKED
AccStateMixed AccState = win.STATE_SYSTEM_MIXED
AccStateIndeterminate AccState = win.STATE_SYSTEM_INDETERMINATE
AccStateReadonly AccState = win.STATE_SYSTEM_READONLY
AccStateHotTracked AccState = win.STATE_SYSTEM_HOTTRACKED
AccStateDefault AccState = win.STATE_SYSTEM_DEFAULT
AccStateExpanded AccState = win.STATE_SYSTEM_EXPANDED
AccStateCollapsed AccState = win.STATE_SYSTEM_COLLAPSED
AccStateBusy AccState = win.STATE_SYSTEM_BUSY
AccStateFloating AccState = win.STATE_SYSTEM_FLOATING
AccStateMarqueed AccState = win.STATE_SYSTEM_MARQUEED
AccStateAnimated AccState = win.STATE_SYSTEM_ANIMATED
AccStateInvisible AccState = win.STATE_SYSTEM_INVISIBLE
AccStateOffscreen AccState = win.STATE_SYSTEM_OFFSCREEN
AccStateSizeable AccState = win.STATE_SYSTEM_SIZEABLE
AccStateMoveable AccState = win.STATE_SYSTEM_MOVEABLE
AccStateSelfVoicing AccState = win.STATE_SYSTEM_SELFVOICING
AccStateFocusable AccState = win.STATE_SYSTEM_FOCUSABLE
AccStateSelectable AccState = win.STATE_SYSTEM_SELECTABLE
AccStateLinked AccState = win.STATE_SYSTEM_LINKED
AccStateTraversed AccState = win.STATE_SYSTEM_TRAVERSED
AccStateMultiselectable AccState = win.STATE_SYSTEM_MULTISELECTABLE
AccStateExtselectable AccState = win.STATE_SYSTEM_EXTSELECTABLE
AccStateAlertLow AccState = win.STATE_SYSTEM_ALERT_LOW
AccStateAlertMedium AccState = win.STATE_SYSTEM_ALERT_MEDIUM
AccStateAlertHigh AccState = win.STATE_SYSTEM_ALERT_HIGH
AccStateProtected AccState = win.STATE_SYSTEM_PROTECTED
AccStateHasPopup AccState = win.STATE_SYSTEM_HASPOPUP
AccStateValid AccState = win.STATE_SYSTEM_VALID
)
// AccRole enum defines the role of the window/control in UI.
type AccRole int32
// Window/control system roles
const (
AccRoleTitlebar AccRole = win.ROLE_SYSTEM_TITLEBAR
AccRoleMenubar AccRole = win.ROLE_SYSTEM_MENUBAR
AccRoleScrollbar AccRole = win.ROLE_SYSTEM_SCROLLBAR
AccRoleGrip AccRole = win.ROLE_SYSTEM_GRIP
AccRoleSound AccRole = win.ROLE_SYSTEM_SOUND
AccRoleCursor AccRole = win.ROLE_SYSTEM_CURSOR
AccRoleCaret AccRole = win.ROLE_SYSTEM_CARET
AccRoleAlert AccRole = win.ROLE_SYSTEM_ALERT
AccRoleWindow AccRole = win.ROLE_SYSTEM_WINDOW
AccRoleClient AccRole = win.ROLE_SYSTEM_CLIENT
AccRoleMenuPopup AccRole = win.ROLE_SYSTEM_MENUPOPUP
AccRoleMenuItem AccRole = win.ROLE_SYSTEM_MENUITEM
AccRoleTooltip AccRole = win.ROLE_SYSTEM_TOOLTIP
AccRoleApplication AccRole = win.ROLE_SYSTEM_APPLICATION
AccRoleDocument AccRole = win.ROLE_SYSTEM_DOCUMENT
AccRolePane AccRole = win.ROLE_SYSTEM_PANE
AccRoleChart AccRole = win.ROLE_SYSTEM_CHART
AccRoleDialog AccRole = win.ROLE_SYSTEM_DIALOG
AccRoleBorder AccRole = win.ROLE_SYSTEM_BORDER
AccRoleGrouping AccRole = win.ROLE_SYSTEM_GROUPING
AccRoleSeparator AccRole = win.ROLE_SYSTEM_SEPARATOR
AccRoleToolbar AccRole = win.ROLE_SYSTEM_TOOLBAR
AccRoleStatusbar AccRole = win.ROLE_SYSTEM_STATUSBAR
AccRoleTable AccRole = win.ROLE_SYSTEM_TABLE
AccRoleColumnHeader AccRole = win.ROLE_SYSTEM_COLUMNHEADER
AccRoleRowHeader AccRole = win.ROLE_SYSTEM_ROWHEADER
AccRoleColumn AccRole = win.ROLE_SYSTEM_COLUMN
AccRoleRow AccRole = win.ROLE_SYSTEM_ROW
AccRoleCell AccRole = win.ROLE_SYSTEM_CELL
AccRoleLink AccRole = win.ROLE_SYSTEM_LINK
AccRoleHelpBalloon AccRole = win.ROLE_SYSTEM_HELPBALLOON
AccRoleCharacter AccRole = win.ROLE_SYSTEM_CHARACTER
AccRoleList AccRole = win.ROLE_SYSTEM_LIST
AccRoleListItem AccRole = win.ROLE_SYSTEM_LISTITEM
AccRoleOutline AccRole = win.ROLE_SYSTEM_OUTLINE
AccRoleOutlineItem AccRole = win.ROLE_SYSTEM_OUTLINEITEM
AccRolePagetab AccRole = win.ROLE_SYSTEM_PAGETAB
AccRolePropertyPage AccRole = win.ROLE_SYSTEM_PROPERTYPAGE
AccRoleIndicator AccRole = win.ROLE_SYSTEM_INDICATOR
AccRoleGraphic AccRole = win.ROLE_SYSTEM_GRAPHIC
AccRoleStatictext AccRole = win.ROLE_SYSTEM_STATICTEXT
AccRoleText AccRole = win.ROLE_SYSTEM_TEXT
AccRolePushbutton AccRole = win.ROLE_SYSTEM_PUSHBUTTON
AccRoleCheckbutton AccRole = win.ROLE_SYSTEM_CHECKBUTTON
AccRoleRadiobutton AccRole = win.ROLE_SYSTEM_RADIOBUTTON
AccRoleCombobox AccRole = win.ROLE_SYSTEM_COMBOBOX
AccRoleDroplist AccRole = win.ROLE_SYSTEM_DROPLIST
AccRoleProgressbar AccRole = win.ROLE_SYSTEM_PROGRESSBAR
AccRoleDial AccRole = win.ROLE_SYSTEM_DIAL
AccRoleHotkeyfield AccRole = win.ROLE_SYSTEM_HOTKEYFIELD
AccRoleSlider AccRole = win.ROLE_SYSTEM_SLIDER
AccRoleSpinbutton AccRole = win.ROLE_SYSTEM_SPINBUTTON
AccRoleDiagram AccRole = win.ROLE_SYSTEM_DIAGRAM
AccRoleAnimation AccRole = win.ROLE_SYSTEM_ANIMATION
AccRoleEquation AccRole = win.ROLE_SYSTEM_EQUATION
AccRoleButtonDropdown AccRole = win.ROLE_SYSTEM_BUTTONDROPDOWN
AccRoleButtonMenu AccRole = win.ROLE_SYSTEM_BUTTONMENU
AccRoleButtonDropdownGrid AccRole = win.ROLE_SYSTEM_BUTTONDROPDOWNGRID
AccRoleWhitespace AccRole = win.ROLE_SYSTEM_WHITESPACE
AccRolePageTabList AccRole = win.ROLE_SYSTEM_PAGETABLIST
AccRoleClock AccRole = win.ROLE_SYSTEM_CLOCK
AccRoleSplitButton AccRole = win.ROLE_SYSTEM_SPLITBUTTON
AccRoleIPAddress AccRole = win.ROLE_SYSTEM_IPADDRESS
AccRoleOutlineButton AccRole = win.ROLE_SYSTEM_OUTLINEBUTTON
)
// Accessibility provides basic Dynamic Annotation of windows and controls.
type Accessibility struct {
wb *WindowBase
}
// SetAccelerator sets window accelerator name using Dynamic Annotation.
func (a *Accessibility) SetAccelerator(acc string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_KEYBOARDSHORTCUT, win.EVENT_OBJECT_ACCELERATORCHANGE, acc)
}
// SetDefaultAction sets window default action using Dynamic Annotation.
func (a *Accessibility) SetDefaultAction(defAction string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_DEFAULTACTION, win.EVENT_OBJECT_DEFACTIONCHANGE, defAction)
}
// SetDescription sets window description using Dynamic Annotation.
func (a *Accessibility) SetDescription(acc string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_DESCRIPTION, win.EVENT_OBJECT_DESCRIPTIONCHANGE, acc)
}
// SetHelp sets window help using Dynamic Annotation.
func (a *Accessibility) SetHelp(help string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_HELP, win.EVENT_OBJECT_HELPCHANGE, help)
}
// SetName sets window name using Dynamic Annotation.
func (a *Accessibility) SetName(name string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_NAME, win.EVENT_OBJECT_NAMECHANGE, name)
}
// SetRole sets window role using Dynamic Annotation. The role must be set when the window is
// created and is not to be modified later.
func (a *Accessibility) SetRole(role AccRole) error {
return a.accSetPropertyInt(a.wb.hWnd, &win.PROPID_ACC_ROLE, 0, int32(role))
}
// SetRoleMap sets window role map using Dynamic Annotation. The role map must be set when the
// window is created and is not to be modified later.
func (a *Accessibility) SetRoleMap(roleMap string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_ROLEMAP, 0, roleMap)
}
// SetState sets window state using Dynamic Annotation.
func (a *Accessibility) SetState(state AccState) error {
return a.accSetPropertyInt(a.wb.hWnd, &win.PROPID_ACC_STATE, win.EVENT_OBJECT_STATECHANGE, int32(state))
}
// SetStateMap sets window state map using Dynamic Annotation. The state map must be set when
// the window is created and is not to be modified later.
func (a *Accessibility) SetStateMap(stateMap string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_STATEMAP, 0, stateMap)
}
// SetValueMap sets window value map using Dynamic Annotation. The value map must be set when
// the window is created and is not to be modified later.
func (a *Accessibility) SetValueMap(valueMap string) error {
return a.accSetPropertyStr(a.wb.hWnd, &win.PROPID_ACC_VALUEMAP, 0, valueMap)
}
// accSetPropertyInt sets integer window property for Dynamic Annotation.
func (a *Accessibility) accSetPropertyInt(hwnd win.HWND, idProp *win.MSAAPROPID, event uint32, value int32) error {
accPropServices := a.wb.group.accessibilityServices()
if accPropServices == nil {
return newError("Dynamic Annotation not available")
}
var v win.VARIANT
v.SetLong(value)
hr := accPropServices.SetHwndProp(hwnd, win.OBJID_CLIENT, win.CHILDID_SELF, idProp, &v)
if win.FAILED(hr) {
return errorFromHRESULT("IAccPropServices.SetHwndProp", hr)
}
if win.EVENT_OBJECT_CREATE <= event && event <= win.EVENT_OBJECT_END {
win.NotifyWinEvent(event, hwnd, win.OBJID_CLIENT, win.CHILDID_SELF)
}
return nil
}
// accSetPropertyStr sets string window property for Dynamic Annotation.
func (a *Accessibility) accSetPropertyStr(hwnd win.HWND, idProp *win.MSAAPROPID, event uint32, value string) error {
accPropServices := a.wb.group.accessibilityServices()
if accPropServices == nil {
return newError("Dynamic Annotation not available")
}
hr := accPropServices.SetHwndPropStr(hwnd, win.OBJID_CLIENT, win.CHILDID_SELF, idProp, value)
if win.FAILED(hr) {
return errorFromHRESULT("IAccPropServices.SetHwndPropStr", hr)
}
if win.EVENT_OBJECT_CREATE <= event && event <= win.EVENT_OBJECT_END {
win.NotifyWinEvent(event, hwnd, win.OBJID_CLIENT, win.CHILDID_SELF)
}
return nil
}
================================================
FILE: action.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
type actionChangedHandler interface {
onActionChanged(action *Action) error
onActionVisibleChanged(action *Action) error
}
var (
// ISSUE: When pressing enter resp. escape,
// WM_COMMAND with wParam=1 resp. 2 is sent.
// Maybe there is more to consider.
nextActionId uint16 = 3
actionsById = make(map[uint16]*Action)
shortcut2Action = make(map[Shortcut]*Action)
)
type Action struct {
menu *Menu
triggeredPublisher EventPublisher
changedHandlers []actionChangedHandler
text string
toolTip string
image Image
checkedCondition Condition
checkedConditionChangedHandle int
defaultCondition Condition
defaultConditionChangedHandle int
enabledCondition Condition
enabledConditionChangedHandle int
visibleCondition Condition
visibleConditionChangedHandle int
refCount int
shortcut Shortcut
enabled bool
visible bool
checkable bool
checked bool
defawlt bool
exclusive bool
id uint16
}
func NewAction() *Action {
a := &Action{
enabled: true,
id: nextActionId,
visible: true,
}
actionsById[a.id] = a
nextActionId++
return a
}
func NewMenuAction(menu *Menu) *Action {
a := NewAction()
a.menu = menu
return a
}
func NewSeparatorAction() *Action {
return &Action{
enabled: true,
visible: true,
}
}
func (a *Action) addRef() {
a.refCount++
}
func (a *Action) release() {
a.refCount--
if a.refCount == 0 {
a.SetEnabledCondition(nil)
a.SetVisibleCondition(nil)
if a.menu != nil {
a.menu.actions.Clear()
a.menu.Dispose()
}
delete(actionsById, a.id)
delete(shortcut2Action, a.shortcut)
}
}
func (a *Action) Menu() *Menu {
return a.menu
}
func (a *Action) Checkable() bool {
return a.checkable
}
func (a *Action) SetCheckable(value bool) (err error) {
if value != a.checkable {
old := a.checkable
a.checkable = value
if err = a.raiseChanged(); err != nil {
a.checkable = old
a.raiseChanged()
}
}
return
}
func (a *Action) Checked() bool {
return a.checked
}
func (a *Action) SetChecked(value bool) (err error) {
if a.checkedCondition != nil {
if bp, ok := a.checkedCondition.(*boolProperty); ok {
if err := bp.Set(value); err != nil {
return err
}
} else {
return newError("CheckedCondition != nil")
}
}
if value != a.checked {
old := a.checked
a.checked = value
if err = a.raiseChanged(); err != nil {
a.checked = old
a.raiseChanged()
}
}
return
}
func (a *Action) CheckedCondition() Condition {
return a.checkedCondition
}
func (a *Action) SetCheckedCondition(c Condition) {
if a.checkedCondition != nil {
a.checkedCondition.Changed().Detach(a.checkedConditionChangedHandle)
}
a.checkedCondition = c
if c != nil {
a.checked = c.Satisfied()
a.checkedConditionChangedHandle = c.Changed().Attach(func() {
if a.checked != c.Satisfied() {
a.checked = !a.checked
a.raiseChanged()
}
})
}
a.raiseChanged()
}
func (a *Action) Default() bool {
return a.defawlt
}
func (a *Action) SetDefault(value bool) (err error) {
if a.defaultCondition != nil {
if bp, ok := a.defaultCondition.(*boolProperty); ok {
if err := bp.Set(value); err != nil {
return err
}
} else {
return newError("DefaultCondition != nil")
}
}
if value != a.defawlt {
old := a.defawlt
a.defawlt = value
if err = a.raiseChanged(); err != nil {
a.defawlt = old
a.raiseChanged()
}
}
return
}
func (a *Action) DefaultCondition() Condition {
return a.defaultCondition
}
func (a *Action) SetDefaultCondition(c Condition) {
if a.defaultCondition != nil {
a.defaultCondition.Changed().Detach(a.defaultConditionChangedHandle)
}
a.defaultCondition = c
if c != nil {
a.defawlt = c.Satisfied()
a.defaultConditionChangedHandle = c.Changed().Attach(func() {
if a.defawlt != c.Satisfied() {
a.defawlt = !a.defawlt
a.raiseChanged()
}
})
}
a.raiseChanged()
}
func (a *Action) Enabled() bool {
return a.enabled
}
func (a *Action) SetEnabled(value bool) (err error) {
if a.enabledCondition != nil {
return newError("EnabledCondition != nil")
}
if value != a.enabled {
old := a.enabled
a.enabled = value
if err = a.raiseChanged(); err != nil {
a.enabled = old
a.raiseChanged()
}
}
return
}
func (a *Action) EnabledCondition() Condition {
return a.enabledCondition
}
func (a *Action) SetEnabledCondition(c Condition) {
if a.enabledCondition != nil {
a.enabledCondition.Changed().Detach(a.enabledConditionChangedHandle)
}
a.enabledCondition = c
if c != nil {
a.enabled = c.Satisfied()
a.enabledConditionChangedHandle = c.Changed().Attach(func() {
if a.enabled != c.Satisfied() {
a.enabled = !a.enabled
a.raiseChanged()
}
})
}
a.raiseChanged()
}
func (a *Action) Exclusive() bool {
return a.exclusive
}
func (a *Action) SetExclusive(value bool) (err error) {
if value != a.exclusive {
old := a.exclusive
a.exclusive = value
if err = a.raiseChanged(); err != nil {
a.exclusive = old
a.raiseChanged()
}
}
return
}
func (a *Action) Image() Image {
return a.image
}
func (a *Action) SetImage(value Image) (err error) {
if value != a.image {
old := a.image
a.image = value
if err = a.raiseChanged(); err != nil {
a.image = old
a.raiseChanged()
}
}
return
}
func (a *Action) Shortcut() Shortcut {
return a.shortcut
}
func (a *Action) SetShortcut(shortcut Shortcut) (err error) {
if shortcut != a.shortcut {
old := a.shortcut
a.shortcut = shortcut
defer func() {
if err != nil {
a.shortcut = old
}
}()
if err = a.raiseChanged(); err != nil {
a.shortcut = old
a.raiseChanged()
} else {
if shortcut.Key == 0 {
delete(shortcut2Action, old)
} else {
shortcut2Action[shortcut] = a
}
}
}
return
}
func (a *Action) Text() string {
return a.text
}
func (a *Action) SetText(value string) (err error) {
if value != a.text {
old := a.text
a.text = value
if err = a.raiseChanged(); err != nil {
a.text = old
a.raiseChanged()
}
}
return
}
func (a *Action) IsSeparator() bool {
return a.id == 0 || a.text == "-"
}
func (a *Action) ToolTip() string {
return a.toolTip
}
func (a *Action) SetToolTip(value string) (err error) {
if value != a.toolTip {
old := a.toolTip
a.toolTip = value
if err = a.raiseChanged(); err != nil {
a.toolTip = old
a.raiseChanged()
}
}
return
}
func (a *Action) Visible() bool {
return a.visible
}
func (a *Action) SetVisible(value bool) (err error) {
if a.visibleCondition != nil {
return newError("VisibleCondition != nil")
}
if value != a.visible {
old := a.visible
a.visible = value
if err = a.raiseVisibleChanged(); err != nil {
a.visible = old
a.raiseVisibleChanged()
}
}
return
}
func (a *Action) VisibleCondition() Condition {
return a.visibleCondition
}
func (a *Action) SetVisibleCondition(c Condition) {
if a.visibleCondition != nil {
a.visibleCondition.Changed().Detach(a.visibleConditionChangedHandle)
}
a.visibleCondition = c
if c != nil {
a.visible = c.Satisfied()
a.visibleConditionChangedHandle = c.Changed().Attach(func() {
if a.visible != c.Satisfied() {
a.visible = !a.visible
a.raiseVisibleChanged()
}
})
}
a.raiseChanged()
}
func (a *Action) Triggered() *Event {
return a.triggeredPublisher.Event()
}
func (a *Action) raiseTriggered() {
if a.Checkable() {
a.SetChecked(!a.Checked())
}
a.triggeredPublisher.Publish()
}
func (a *Action) addChangedHandler(handler actionChangedHandler) {
a.changedHandlers = append(a.changedHandlers, handler)
}
func (a *Action) removeChangedHandler(handler actionChangedHandler) {
for i, h := range a.changedHandlers {
if h == handler {
a.changedHandlers = append(a.changedHandlers[:i], a.changedHandlers[i+1:]...)
break
}
}
}
func (a *Action) raiseChanged() error {
for _, handler := range a.changedHandlers {
if err := handler.onActionChanged(a); err != nil {
return err
}
}
return nil
}
func (a *Action) raiseVisibleChanged() error {
for _, handler := range a.changedHandlers {
if err := handler.onActionVisibleChanged(a); err != nil {
return err
}
}
return nil
}
================================================
FILE: actionlist.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
type actionListObserver interface {
onInsertedAction(action *Action) error
onRemovingAction(action *Action) error
onClearingActions() error
}
type nopActionListObserver struct{}
func (nopActionListObserver) onInsertedAction(action *Action) error {
return nil
}
func (nopActionListObserver) onRemovingAction(action *Action) error {
return nil
}
func (nopActionListObserver) onClearingActions() error {
return nil
}
type ActionList struct {
actions []*Action
observer actionListObserver
}
func newActionList(observer actionListObserver) *ActionList {
if observer == nil {
panic("observer == nil")
}
return &ActionList{observer: observer}
}
func (l *ActionList) Add(action *Action) error {
return l.Insert(len(l.actions), action)
}
func (l *ActionList) AddMenu(menu *Menu) (*Action, error) {
return l.InsertMenu(len(l.actions), menu)
}
func (l *ActionList) At(index int) *Action {
return l.actions[index]
}
func (l *ActionList) Clear() error {
if err := l.observer.onClearingActions(); err != nil {
return err
}
for _, a := range l.actions {
a.release()
}
l.actions = l.actions[:0]
return nil
}
func (l *ActionList) Contains(action *Action) bool {
return l.Index(action) > -1
}
func (l *ActionList) Index(action *Action) int {
for i, a := range l.actions {
if a == action {
return i
}
}
return -1
}
func (l *ActionList) indexInObserver(action *Action) int {
var idx int
for _, a := range l.actions {
if a == action {
return idx
}
if a.Visible() {
idx++
}
}
return -1
}
func (l *ActionList) Insert(index int, action *Action) error {
l.actions = append(l.actions, nil)
copy(l.actions[index+1:], l.actions[index:])
l.actions[index] = action
if err := l.observer.onInsertedAction(action); err != nil {
l.actions = append(l.actions[:index], l.actions[index+1:]...)
return err
}
action.addRef()
if action.Visible() {
return l.updateSeparatorVisibility()
}
return nil
}
func (l *ActionList) InsertMenu(index int, menu *Menu) (*Action, error) {
action := NewAction()
action.menu = menu
if err := l.Insert(index, action); err != nil {
return nil, err
}
return action, nil
}
func (l *ActionList) Len() int {
return len(l.actions)
}
func (l *ActionList) Remove(action *Action) error {
index := l.Index(action)
if index == -1 {
return nil
}
return l.RemoveAt(index)
}
func (l *ActionList) RemoveAt(index int) error {
action := l.actions[index]
if action.Visible() {
if err := l.observer.onRemovingAction(action); err != nil {
return err
}
}
action.release()
l.actions = append(l.actions[:index], l.actions[index+1:]...)
if action.Visible() {
return l.updateSeparatorVisibility()
}
return nil
}
func (l *ActionList) updateSeparatorVisibility() error {
var hasCurVisAct bool
var curVisSep *Action
for _, a := range l.actions {
if visible := a.Visible(); a.IsSeparator() {
toggle := visible != hasCurVisAct
if toggle {
visible = !visible
if err := a.SetVisible(visible); err != nil {
return err
}
}
if visible {
curVisSep = a
}
hasCurVisAct = false
} else if visible {
hasCurVisAct = true
}
}
if !hasCurVisAct && curVisSep != nil {
return curVisSep.SetVisible(false)
}
return nil
}
================================================
FILE: application.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"runtime"
"sync"
"time"
"github.com/lxn/win"
)
type Settings interface {
Get(key string) (string, bool)
Timestamp(key string) (time.Time, bool)
Put(key, value string) error
PutExpiring(key, value string) error
Remove(key string) error
ExpireDuration() time.Duration
SetExpireDuration(expireDuration time.Duration)
Load() error
Save() error
}
type Persistable interface {
Persistent() bool
SetPersistent(value bool)
SaveState() error
RestoreState() error
}
type Application struct {
mutex sync.RWMutex
organizationName string
productName string
settings Settings
exiting bool
exitCode int
panickingPublisher ErrorEventPublisher
}
var appSingleton *Application = new(Application)
func App() *Application {
return appSingleton
}
func (app *Application) OrganizationName() string {
app.mutex.RLock()
defer app.mutex.RUnlock()
return app.organizationName
}
func (app *Application) SetOrganizationName(value string) {
app.mutex.Lock()
defer app.mutex.Unlock()
app.organizationName = value
}
func (app *Application) ProductName() string {
app.mutex.RLock()
defer app.mutex.RUnlock()
return app.productName
}
func (app *Application) SetProductName(value string) {
app.mutex.Lock()
defer app.mutex.Unlock()
app.productName = value
}
func (app *Application) Settings() Settings {
app.mutex.RLock()
defer app.mutex.RUnlock()
return app.settings
}
func (app *Application) SetSettings(value Settings) {
app.mutex.Lock()
defer app.mutex.Unlock()
app.settings = value
}
func (app *Application) Exit(exitCode int) {
app.mutex.Lock()
defer app.mutex.Unlock()
app.exiting = true
app.exitCode = exitCode
win.PostQuitMessage(int32(exitCode))
}
func (app *Application) ExitCode() int {
app.mutex.RLock()
defer app.mutex.RUnlock()
return app.exitCode
}
func (app *Application) Panicking() *ErrorEvent {
app.mutex.RLock()
defer app.mutex.RUnlock()
return app.panickingPublisher.Event()
}
// ActiveForm returns the currently active form for the caller's thread.
// It returns nil if no form is active or the caller's thread does not
// have any windows associated with it. It should be called from within
// synchronized functions.
func (app *Application) ActiveForm() Form {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
tid := win.GetCurrentThreadId()
group := wgm.Group(tid)
if group == nil {
return nil
}
return group.ActiveForm()
}
================================================
FILE: bitmap.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"fmt"
"image"
"image/color"
"math"
"syscall"
"unsafe"
"github.com/lxn/win"
)
const inchesPerMeter float64 = 39.37007874
type Bitmap struct {
hBmp win.HBITMAP
hPackedDIB win.HGLOBAL
size Size // in native pixels
dpi int
transparencyStatus transparencyStatus
}
type transparencyStatus byte
const (
transparencyUnknown transparencyStatus = iota
transparencyOpaque
transparencyTransparent
)
func BitmapFrom(src interface{}, dpi int) (*Bitmap, error) {
if src == nil {
return nil, nil
}
img, err := ImageFrom(src)
if err != nil {
return nil, err
}
return iconCache.Bitmap(img, dpi)
}
// NewBitmap creates an opaque bitmap with given size in 1/96" units at screen DPI.
//
// Deprecated: Newer applications should use NewBitmapForDPI.
func NewBitmap(size Size) (*Bitmap, error) {
dpi := screenDPI()
return newBitmap(SizeFrom96DPI(size, dpi), false, dpi)
}
// NewBitmapForDPI creates an opaque bitmap with given size in native pixels and DPI.
func NewBitmapForDPI(size Size, dpi int) (*Bitmap, error) {
return newBitmap(size, false, dpi)
}
// NewBitmapWithTransparentPixels creates a transparent bitmap with given size in 1/96" units at screen DPI.
//
// Deprecated: Newer applications should use NewBitmapWithTransparentPixelsForDPI.
func NewBitmapWithTransparentPixels(size Size) (*Bitmap, error) {
dpi := screenDPI()
return newBitmap(SizeFrom96DPI(size, dpi), true, dpi)
}
// NewBitmapWithTransparentPixelsForDPI creates a transparent bitmap with given size in native pixels and DPI.
func NewBitmapWithTransparentPixelsForDPI(size Size, dpi int) (*Bitmap, error) {
return newBitmap(size, true, dpi)
}
// newBitmap creates a bitmap with given size in native pixels and DPI.
func newBitmap(size Size, transparent bool, dpi int) (bmp *Bitmap, err error) {
err = withCompatibleDC(func(hdc win.HDC) error {
bufSize := int(size.Width * size.Height * 4)
var hdr win.BITMAPINFOHEADER
hdr.BiSize = uint32(unsafe.Sizeof(hdr))
hdr.BiBitCount = 32
hdr.BiCompression = win.BI_RGB
hdr.BiPlanes = 1
hdr.BiWidth = int32(size.Width)
hdr.BiHeight = int32(size.Height)
hdr.BiSizeImage = uint32(bufSize)
dpm := int32(math.Round(float64(dpi) * inchesPerMeter))
hdr.BiXPelsPerMeter = dpm
hdr.BiYPelsPerMeter = dpm
var bitsPtr unsafe.Pointer
hBmp := win.CreateDIBSection(hdc, &hdr, win.DIB_RGB_COLORS, &bitsPtr, 0, 0)
switch hBmp {
case 0, win.ERROR_INVALID_PARAMETER:
return newError("CreateDIBSection failed")
}
if transparent {
win.GdiFlush()
bits := (*[1 << 24]byte)(bitsPtr)
for i := 0; i < bufSize; i += 4 {
// Mark pixel as not drawn to by GDI.
bits[i+3] = 0x01
}
}
bmp, err = newBitmapFromHBITMAP(hBmp, dpi)
return err
})
return
}
// NewBitmapFromFile creates new bitmap from a bitmap file at 96dpi.
//
// Deprecated: Newer applications should use NewBitmapFromFileForDPI.
func NewBitmapFromFile(filePath string) (*Bitmap, error) {
return NewBitmapFromFileForDPI(filePath, 96)
}
// NewBitmapFromFileForDPI creates new bitmap from a bitmap file at given DPI.
func NewBitmapFromFileForDPI(filePath string, dpi int) (*Bitmap, error) {
var si win.GdiplusStartupInput
si.GdiplusVersion = 1
if status := win.GdiplusStartup(&si, nil); status != win.Ok {
return nil, newError(fmt.Sprintf("GdiplusStartup failed with status '%s'", status))
}
defer win.GdiplusShutdown()
var gpBmp *win.GpBitmap
if status := win.GdipCreateBitmapFromFile(syscall.StringToUTF16Ptr(filePath), &gpBmp); status != win.Ok {
return nil, newError(fmt.Sprintf("GdipCreateBitmapFromFile failed with status '%s' for file '%s'", status, filePath))
}
defer win.GdipDisposeImage((*win.GpImage)(gpBmp))
var hBmp win.HBITMAP
if status := win.GdipCreateHBITMAPFromBitmap(gpBmp, &hBmp, 0); status != win.Ok {
return nil, newError(fmt.Sprintf("GdipCreateHBITMAPFromBitmap failed with status '%s' for file '%s'", status, filePath))
}
return newBitmapFromHBITMAP(hBmp, dpi)
}
// NewBitmapFromImage creates a Bitmap from image.Image at 96dpi.
//
// Deprecated: Newer applications should use NewBitmapFromImageForDPI.
func NewBitmapFromImage(im image.Image) (*Bitmap, error) {
return NewBitmapFromImageForDPI(im, 96)
}
// NewBitmapFromImageForDPI creates a Bitmap from image.Image at given DPI.
func NewBitmapFromImageForDPI(im image.Image, dpi int) (*Bitmap, error) {
hBmp, err := hBitmapFromImage(im, dpi)
if err != nil {
return nil, err
}
return newBitmapFromHBITMAP(hBmp, dpi)
}
// NewBitmapFromResource creates a Bitmap at 96dpi from resource by name.
//
// Deprecated: Newer applications should use NewBitmapFromResourceForDPI.
func NewBitmapFromResource(name string) (*Bitmap, error) {
return newBitmapFromResource(syscall.StringToUTF16Ptr(name), 96)
}
// NewBitmapFromResourceForDPI creates a Bitmap at given DPI from resource by name.
func NewBitmapFromResourceForDPI(name string, dpi int) (*Bitmap, error) {
return newBitmapFromResource(syscall.StringToUTF16Ptr(name), dpi)
}
// NewBitmapFromResourceId creates a Bitmap at 96dpi from resource by ID.
//
// Deprecated: Newer applications should use NewBitmapFromResourceIdForDPI.
func NewBitmapFromResourceId(id int) (*Bitmap, error) {
return newBitmapFromResource(win.MAKEINTRESOURCE(uintptr(id)), 96)
}
// NewBitmapFromResourceIdForDPI creates a Bitmap at given DPI from resource by ID.
func NewBitmapFromResourceIdForDPI(id int, dpi int) (*Bitmap, error) {
return newBitmapFromResource(win.MAKEINTRESOURCE(uintptr(id)), dpi)
}
func newBitmapFromResource(res *uint16, dpi int) (bm *Bitmap, err error) {
hInst := win.GetModuleHandle(nil)
if hInst == 0 {
err = lastError("GetModuleHandle")
return
}
if hBmp := win.LoadImage(hInst, res, win.IMAGE_BITMAP, 0, 0, win.LR_CREATEDIBSECTION); hBmp == 0 {
err = lastError("LoadImage")
} else {
bm, err = newBitmapFromHBITMAP(win.HBITMAP(hBmp), dpi)
}
return
}
// NewBitmapFromImageWithSize creates a bitmap with given size in native units and paints the image on it streched.
func NewBitmapFromImageWithSize(image Image, size Size) (*Bitmap, error) {
var disposables Disposables
defer disposables.Treat()
dpi := int(math.Round(float64(size.Width) / float64(image.Size().Width) * 96.0))
bmp, err := NewBitmapWithTransparentPixelsForDPI(size, dpi)
if err != nil {
return nil, err
}
disposables.Add(bmp)
canvas, err := NewCanvasFromImage(bmp)
if err != nil {
return nil, err
}
defer canvas.Dispose()
canvas.dpi = dpi
if err := canvas.DrawImageStretchedPixels(image, Rectangle{0, 0, size.Width, size.Height}); err != nil {
return nil, err
}
disposables.Spare()
return bmp, nil
}
func NewBitmapFromWindow(window Window) (*Bitmap, error) {
hBmp, err := hBitmapFromWindow(window)
if err != nil {
return nil, err
}
return newBitmapFromHBITMAP(hBmp, window.DPI())
}
// NewBitmapFromIcon creates a new bitmap with given size in native pixels and 96dpi and paints the
// icon on it.
//
// Deprecated: Newer applications should use NewBitmapFromIconForDPI.
func NewBitmapFromIcon(icon *Icon, size Size) (*Bitmap, error) {
return NewBitmapFromIconForDPI(icon, size, 96)
}
// NewBitmapFromIconForDPI creates a new bitmap with given size in native pixels and DPI and paints
// the icon on it.
func NewBitmapFromIconForDPI(icon *Icon, size Size, dpi int) (*Bitmap, error) {
hBmp, err := hBitmapFromIcon(icon, size, dpi)
if err != nil {
return nil, err
}
return newBitmapFromHBITMAP(hBmp, dpi)
}
func (bmp *Bitmap) ToImage() (*image.RGBA, error) {
var bi win.BITMAPINFO
bi.BmiHeader.BiSize = uint32(unsafe.Sizeof(bi.BmiHeader))
hdc := win.GetDC(0)
if ret := win.GetDIBits(hdc, bmp.hBmp, 0, 0, nil, &bi, win.DIB_RGB_COLORS); ret == 0 {
return nil, newError("GetDIBits get bitmapinfo failed")
}
buf := make([]byte, bi.BmiHeader.BiSizeImage)
bi.BmiHeader.BiCompression = win.BI_RGB
if ret := win.GetDIBits(hdc, bmp.hBmp, 0, uint32(bi.BmiHeader.BiHeight), &buf[0], &bi, win.DIB_RGB_COLORS); ret == 0 {
return nil, newError("GetDIBits failed")
}
width := int(bi.BmiHeader.BiWidth)
height := int(bi.BmiHeader.BiHeight)
img := image.NewRGBA(image.Rect(0, 0, width, height))
n := 0
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
a := buf[n+3]
r := buf[n+2]
g := buf[n+1]
b := buf[n+0]
n += int(bi.BmiHeader.BiBitCount) / 8
img.Set(x, height-y-1, color.RGBA{r, g, b, a})
}
}
return img, nil
}
func (bmp *Bitmap) hasTransparency() (bool, error) {
if bmp.transparencyStatus == transparencyUnknown {
if err := bmp.withPixels(func(bi *win.BITMAPINFO, hdc win.HDC, pixels *[maxPixels]bgraPixel, pixelsLen int) error {
for i := 0; i < pixelsLen; i++ {
if pixels[i].A == 0x00 {
bmp.transparencyStatus = transparencyTransparent
break
}
}
return nil
}); err != nil {
return false, err
}
if bmp.transparencyStatus == transparencyUnknown {
bmp.transparencyStatus = transparencyOpaque
}
}
return bmp.transparencyStatus == transparencyTransparent, nil
}
func (bmp *Bitmap) postProcess() error {
return bmp.withPixels(func(bi *win.BITMAPINFO, hdc win.HDC, pixels *[maxPixels]bgraPixel, pixelsLen int) error {
for i := 0; i < pixelsLen; i++ {
switch pixels[i].A {
case 0x00:
// The pixel has been drawn to by GDI, so we make it fully opaque.
pixels[i].A = 0xff
case 0x01:
// The pixel has not been drawn to by GDI, so we make it fully transparent.
pixels[i].A = 0x00
bmp.transparencyStatus = transparencyTransparent
}
}
if 0 == win.SetDIBits(hdc, bmp.hBmp, 0, uint32(bi.BmiHeader.BiHeight), &pixels[0].B, bi, win.DIB_RGB_COLORS) {
return newError("SetDIBits")
}
return nil
})
}
type bgraPixel struct {
B byte
G byte
R byte
A byte
}
const maxPixels = 2 << 27
func (bmp *Bitmap) withPixels(f func(bi *win.BITMAPINFO, hdc win.HDC, pixels *[maxPixels]bgraPixel, pixelsLen int) error) error {
var bi win.BITMAPINFO
bi.BmiHeader.BiSize = uint32(unsafe.Sizeof(bi.BmiHeader))
hdc := win.GetDC(0)
if hdc == 0 {
return newError("GetDC")
}
defer win.ReleaseDC(0, hdc)
if ret := win.GetDIBits(hdc, bmp.hBmp, 0, 0, nil, &bi, win.DIB_RGB_COLORS); ret == 0 {
return newError("GetDIBits #1")
}
hPixels := win.GlobalAlloc(win.GMEM_FIXED, uintptr(bi.BmiHeader.BiSizeImage))
defer win.GlobalFree(hPixels)
pixels := (*[maxPixels]bgraPixel)(unsafe.Pointer(uintptr(hPixels)))
bi.BmiHeader.BiCompression = win.BI_RGB
if ret := win.GetDIBits(hdc, bmp.hBmp, 0, uint32(bi.BmiHeader.BiHeight), &pixels[0].B, &bi, win.DIB_RGB_COLORS); ret == 0 {
return newError("GetDIBits #2")
}
win.GdiFlush()
return f(&bi, hdc, pixels, int(bi.BmiHeader.BiSizeImage)/4)
}
func (bmp *Bitmap) Dispose() {
if bmp.hBmp != 0 {
win.DeleteObject(win.HGDIOBJ(bmp.hBmp))
win.GlobalUnlock(bmp.hPackedDIB)
win.GlobalFree(bmp.hPackedDIB)
bmp.hPackedDIB = 0
bmp.hBmp = 0
}
}
// Size returns bitmap size in 1/96" units.
func (bmp *Bitmap) Size() Size {
return SizeTo96DPI(bmp.size, bmp.dpi)
}
func (bmp *Bitmap) handle() win.HBITMAP {
return bmp.hBmp
}
func (bmp *Bitmap) draw(hdc win.HDC, location Point) error {
return bmp.drawStretched(hdc, Rectangle{X: location.X, Y: location.Y, Width: bmp.size.Width, Height: bmp.size.Height})
}
func (bmp *Bitmap) drawStretched(hdc win.HDC, bounds Rectangle) error {
return bmp.alphaBlend(hdc, bounds, 255)
}
// alphaBlend displays bitmaps that have transparent or semitransparent pixels. bounds is represented in native pixels.
func (bmp *Bitmap) alphaBlend(hdc win.HDC, bounds Rectangle, opacity byte) error {
return bmp.alphaBlendPart(hdc, bounds, Rectangle{0, 0, bmp.size.Width, bmp.size.Height}, opacity)
}
// alphaBlendPart displays bitmaps that have transparent or semitransparent pixels. dst and src are
// represented in native pixels.
func (bmp *Bitmap) alphaBlendPart(hdc win.HDC, dst, src Rectangle, opacity byte) error {
return bmp.withSelectedIntoMemDC(func(hdcMem win.HDC) error {
if opacity == 255 && (dst.Width != src.Width || dst.Height != src.Height) {
transparent, err := bmp.hasTransparency()
if err != nil {
return err
}
if !transparent {
if 0 == win.SetStretchBltMode(hdc, win.HALFTONE) {
return newError("SetStretchBltMode")
}
if !win.StretchBlt(
hdc,
int32(dst.X),
int32(dst.Y),
int32(dst.Width),
int32(dst.Height),
hdcMem,
int32(src.X),
int32(src.Y),
int32(src.Width),
int32(src.Height),
win.SRCCOPY,
) {
return newError("StretchBlt failed")
}
return nil
}
}
if !win.AlphaBlend(
hdc,
int32(dst.X),
int32(dst.Y),
int32(dst.Width),
int32(dst.Height),
hdcMem,
int32(src.X),
int32(src.Y),
int32(src.Width),
int32(src.Height),
win.BLENDFUNCTION{AlphaFormat: win.AC_SRC_ALPHA, SourceConstantAlpha: opacity},
) {
return newError("AlphaBlend failed")
}
return nil
})
}
func (bmp *Bitmap) withSelectedIntoMemDC(f func(hdcMem win.HDC) error) error {
return withCompatibleDC(func(hdcMem win.HDC) error {
hBmpOld := win.SelectObject(hdcMem, win.HGDIOBJ(bmp.hBmp))
if hBmpOld == 0 {
return newError("SelectObject failed")
}
defer win.SelectObject(hdcMem, hBmpOld)
return f(hdcMem)
})
}
// newBitmapFromHBITMAP creates Bitmap from win.HBITMAP.
//
// The BiXPelsPerMeter and BiYPelsPerMeter fields of win.BITMAPINFOHEADER are unreliable (for
// loaded PNG they are both unset). Therefore, we require caller to specify DPI explicitly.
func newBitmapFromHBITMAP(hBmp win.HBITMAP, dpi int) (bmp *Bitmap, err error) {
var dib win.DIBSECTION
if win.GetObject(win.HGDIOBJ(hBmp), unsafe.Sizeof(dib), unsafe.Pointer(&dib)) == 0 {
return nil, newError("GetObject failed")
}
bmih := &dib.DsBmih
bmihSize := uintptr(unsafe.Sizeof(*bmih))
pixelsSize := uintptr(int32(bmih.BiBitCount)*bmih.BiWidth*bmih.BiHeight) / 8
totalSize := uintptr(bmihSize + pixelsSize)
hPackedDIB := win.GlobalAlloc(win.GHND, totalSize)
dest := win.GlobalLock(hPackedDIB)
defer win.GlobalUnlock(hPackedDIB)
src := unsafe.Pointer(&dib.DsBmih)
win.MoveMemory(dest, src, bmihSize)
dest = unsafe.Pointer(uintptr(dest) + bmihSize)
src = dib.DsBm.BmBits
win.MoveMemory(dest, src, pixelsSize)
return &Bitmap{
hBmp: hBmp,
hPackedDIB: hPackedDIB,
size: Size{
int(bmih.BiWidth),
int(bmih.BiHeight),
},
dpi: dpi,
}, nil
}
func hBitmapFromImage(im image.Image, dpi int) (win.HBITMAP, error) {
var bi win.BITMAPV5HEADER
bi.BiSize = uint32(unsafe.Sizeof(bi))
bi.BiWidth = int32(im.Bounds().Dx())
bi.BiHeight = -int32(im.Bounds().Dy())
bi.BiPlanes = 1
bi.BiBitCount = 32
bi.BiCompression = win.BI_BITFIELDS
dpm := int32(math.Round(float64(dpi) * inchesPerMeter))
bi.BiXPelsPerMeter = dpm
bi.BiYPelsPerMeter = dpm
// The following mask specification specifies a supported 32 BPP
// alpha format for Windows XP.
bi.BV4RedMask = 0x00FF0000
bi.BV4GreenMask = 0x0000FF00
bi.BV4BlueMask = 0x000000FF
bi.BV4AlphaMask = 0xFF000000
hdc := win.GetDC(0)
defer win.ReleaseDC(0, hdc)
var lpBits unsafe.Pointer
// Create the DIB section with an alpha channel.
hBitmap := win.CreateDIBSection(hdc, &bi.BITMAPINFOHEADER, win.DIB_RGB_COLORS, &lpBits, 0, 0)
switch hBitmap {
case 0, win.ERROR_INVALID_PARAMETER:
return 0, newError("CreateDIBSection failed")
}
// Fill the image
bitmap_array := (*[1 << 30]byte)(unsafe.Pointer(lpBits))
i := 0
for y := im.Bounds().Min.Y; y != im.Bounds().Max.Y; y++ {
for x := im.Bounds().Min.X; x != im.Bounds().Max.X; x++ {
r, g, b, a := im.At(x, y).RGBA()
bitmap_array[i+3] = byte(a >> 8)
bitmap_array[i+2] = byte(r >> 8)
bitmap_array[i+1] = byte(g >> 8)
bitmap_array[i+0] = byte(b >> 8)
i += 4
}
}
return hBitmap, nil
}
func hBitmapFromWindow(window Window) (win.HBITMAP, error) {
hdcMem := win.CreateCompatibleDC(0)
if hdcMem == 0 {
return 0, newError("CreateCompatibleDC failed")
}
defer win.DeleteDC(hdcMem)
var r win.RECT
if !win.GetWindowRect(window.Handle(), &r) {
return 0, newError("GetWindowRect failed")
}
hdc := win.GetDC(window.Handle())
width, height := r.Right-r.Left, r.Bottom-r.Top
hBmp := win.CreateCompatibleBitmap(hdc, width, height)
win.ReleaseDC(window.Handle(), hdc)
hOld := win.SelectObject(hdcMem, win.HGDIOBJ(hBmp))
flags := win.PRF_CHILDREN | win.PRF_CLIENT | win.PRF_ERASEBKGND | win.PRF_NONCLIENT | win.PRF_OWNED
window.SendMessage(win.WM_PRINT, uintptr(hdcMem), uintptr(flags))
win.SelectObject(hdcMem, hOld)
return hBmp, nil
}
// hBitmapFromIcon creates a new win.HBITMAP with given size in native pixels and DPI, and paints
// the icon on it stretched.
func hBitmapFromIcon(icon *Icon, size Size, dpi int) (win.HBITMAP, error) {
hdc := win.GetDC(0)
defer win.ReleaseDC(0, hdc)
hdcMem := win.CreateCompatibleDC(hdc)
if hdcMem == 0 {
return 0, newError("CreateCompatibleDC failed")
}
defer win.DeleteDC(hdcMem)
var bi win.BITMAPV5HEADER
bi.BiSize = uint32(unsafe.Sizeof(bi))
bi.BiWidth = int32(size.Width)
bi.BiHeight = int32(size.Height)
bi.BiPlanes = 1
bi.BiBitCount = 32
bi.BiCompression = win.BI_RGB
dpm := int32(math.Round(float64(dpi) * inchesPerMeter))
bi.BiXPelsPerMeter = dpm
bi.BiYPelsPerMeter = dpm
// The following mask specification specifies a supported 32 BPP
// alpha format for Windows XP.
bi.BV4RedMask = 0x00FF0000
bi.BV4GreenMask = 0x0000FF00
bi.BV4BlueMask = 0x000000FF
bi.BV4AlphaMask = 0xFF000000
hBmp := win.CreateDIBSection(hdcMem, &bi.BITMAPINFOHEADER, win.DIB_RGB_COLORS, nil, 0, 0)
switch hBmp {
case 0, win.ERROR_INVALID_PARAMETER:
return 0, newError("CreateDIBSection failed")
}
hOld := win.SelectObject(hdcMem, win.HGDIOBJ(hBmp))
defer win.SelectObject(hdcMem, hOld)
err := icon.drawStretched(hdcMem, Rectangle{Width: size.Width, Height: size.Height})
if err != nil {
return 0, err
}
return hBmp, nil
}
func withCompatibleDC(f func(hdc win.HDC) error) error {
hdc := win.CreateCompatibleDC(0)
if hdc == 0 {
return newError("CreateCompatibleDC failed")
}
defer win.DeleteDC(hdc)
return f(hdc)
}
================================================
FILE: boxlayout.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"math"
"sort"
"sync"
"github.com/lxn/win"
)
type Orientation byte
const (
NoOrientation Orientation = 0
Horizontal = 1 << 0
Vertical = 1 << 1
)
type BoxLayout struct {
LayoutBase
orientation Orientation
hwnd2StretchFactor map[win.HWND]int
}
func newBoxLayout(orientation Orientation) *BoxLayout {
l := &BoxLayout{
LayoutBase: LayoutBase{
margins96dpi: Margins{9, 9, 9, 9},
spacing96dpi: 6,
},
orientation: orientation,
hwnd2StretchFactor: make(map[win.HWND]int),
}
l.layout = l
return l
}
func NewHBoxLayout() *BoxLayout {
return newBoxLayout(Horizontal)
}
func NewVBoxLayout() *BoxLayout {
return newBoxLayout(Vertical)
}
func (l *BoxLayout) Orientation() Orientation {
return l.orientation
}
func (l *BoxLayout) SetOrientation(value Orientation) error {
if value != l.orientation {
switch value {
case Horizontal, Vertical:
default:
return newError("invalid Orientation value")
}
l.orientation = value
l.container.RequestLayout()
}
return nil
}
func (l *BoxLayout) StretchFactor(widget Widget) int {
if factor, ok := l.hwnd2StretchFactor[widget.Handle()]; ok {
return factor
}
return 1
}
func (l *BoxLayout) SetStretchFactor(widget Widget, factor int) error {
if factor != l.StretchFactor(widget) {
if l.container == nil {
return newError("container required")
}
handle := widget.Handle()
if !l.container.Children().containsHandle(handle) {
return newError("unknown widget")
}
if factor < 1 {
return newError("factor must be >= 1")
}
l.hwnd2StretchFactor[handle] = factor
l.container.RequestLayout()
}
return nil
}
func (l *BoxLayout) CreateLayoutItem(ctx *LayoutContext) ContainerLayoutItem {
li := &boxLayoutItem{
size2MinSize: make(map[Size]Size),
orientation: l.orientation,
hwnd2StretchFactor: make(map[win.HWND]int),
}
for hwnd, sf := range l.hwnd2StretchFactor {
li.hwnd2StretchFactor[hwnd] = sf
}
return li
}
type boxLayoutItemInfo struct {
item LayoutItem
index int
prefSize int // in native pixels
minSize int // in native pixels
maxSize int // in native pixels
stretch int
greedy bool
}
type boxLayoutItemInfoList []boxLayoutItemInfo
func (l boxLayoutItemInfoList) Len() int {
return len(l)
}
func (l boxLayoutItemInfoList) Less(i, j int) bool {
_, iIsSpacer := l[i].item.(*spacerLayoutItem)
_, jIsSpacer := l[j].item.(*spacerLayoutItem)
if l[i].greedy == l[j].greedy {
if iIsSpacer == jIsSpacer {
minDiff := l[i].minSize - l[j].minSize
if minDiff == 0 {
return l[i].maxSize/l[i].stretch < l[j].maxSize/l[j].stretch
}
return minDiff > 0
}
return jIsSpacer
}
return l[i].greedy
}
func (l boxLayoutItemInfoList) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
type boxLayoutItem struct {
ContainerLayoutItemBase
mutex sync.Mutex
size2MinSize map[Size]Size // in native pixels
orientation Orientation
hwnd2StretchFactor map[win.HWND]int
}
func (li *boxLayoutItem) LayoutFlags() LayoutFlags {
return boxLayoutFlags(li.orientation, li.children)
}
func (li *boxLayoutItem) IdealSize() Size {
return li.MinSize()
}
func (li *boxLayoutItem) MinSize() Size {
return li.MinSizeForSize(li.geometry.ClientSize)
}
func (li *boxLayoutItem) HeightForWidth(width int) int {
return li.MinSizeForSize(Size{width, li.geometry.ClientSize.Height}).Height
}
func (li *boxLayoutItem) MinSizeForSize(size Size) Size {
li.mutex.Lock()
defer li.mutex.Unlock()
if min, ok := li.size2MinSize[size]; ok {
return min
}
bounds := Rectangle{Width: size.Width, Height: size.Height}
items := boxLayoutItems(li, itemsToLayout(li.children), li.orientation, li.alignment, bounds, li.margins96dpi, li.spacing96dpi, li.hwnd2StretchFactor)
margins := MarginsFrom96DPI(li.margins96dpi, li.ctx.dpi)
spacing := IntFrom96DPI(li.spacing96dpi, li.ctx.dpi)
s := Size{margins.HNear + margins.HFar, margins.VNear + margins.VFar}
var maxSecondary int
for _, item := range items {
min := li.MinSizeEffectiveForChild(item.Item)
if hfw, ok := item.Item.(HeightForWidther); ok && hfw.HasHeightForWidth() {
item.Bounds.Height = hfw.HeightForWidth(item.Bounds.Width)
} else {
item.Bounds.Height = min.Height
}
item.Bounds.Width = min.Width
if li.orientation == Horizontal {
maxSecondary = maxi(maxSecondary, item.Bounds.Height)
s.Width += item.Bounds.Width
} else {
maxSecondary = maxi(maxSecondary, item.Bounds.Width)
s.Height += item.Bounds.Height
}
}
if li.orientation == Horizontal {
s.Width += (len(items) - 1) * spacing
s.Height += maxSecondary
} else {
s.Height += (len(items) - 1) * spacing
s.Width += maxSecondary
}
if s.Width > 0 && s.Height > 0 {
li.size2MinSize[size] = s
}
return s
}
func (li *boxLayoutItem) PerformLayout() []LayoutResultItem {
cb := Rectangle{Width: li.geometry.ClientSize.Width, Height: li.geometry.ClientSize.Height}
return boxLayoutItems(li, itemsToLayout(li.children), li.orientation, li.alignment, cb, li.margins96dpi, li.spacing96dpi, li.hwnd2StretchFactor)
}
func boxLayoutFlags(orientation Orientation, children []LayoutItem) LayoutFlags {
if len(children) == 0 {
return ShrinkableHorz | ShrinkableVert | GrowableHorz | GrowableVert
}
var flags LayoutFlags
for i := 0; i < len(children); i++ {
item := children[i]
if _, ok := item.(*splitterHandleLayoutItem); ok || !shouldLayoutItem(item) {
continue
}
if s, ok := item.(*spacerLayoutItem); ok {
if s.greedyLocallyOnly {
continue
}
}
f := item.LayoutFlags()
flags |= f
}
return flags
}
// boxLayoutItems lays out items. bounds parameter is in native pixels.
func boxLayoutItems(container ContainerLayoutItem, items []LayoutItem, orientation Orientation, alignment Alignment2D, bounds Rectangle, margins96dpi Margins, spacing96dpi int, hwnd2StretchFactor map[win.HWND]int) []LayoutResultItem {
if len(items) == 0 {
return nil
}
dpi := container.Context().dpi
margins := MarginsFrom96DPI(margins96dpi, dpi)
spacing := IntFrom96DPI(spacing96dpi, dpi)
var greedyNonSpacerCount int
var greedySpacerCount int
var stretchFactorsTotal [3]int
stretchFactors := make([]int, len(items))
var minSizesRemaining int
minSizes := make([]int, len(items))
maxSizes := make([]int, len(items))
sizes := make([]int, len(items))
prefSizes2 := make([]int, len(items))
var shrinkableAmount1Total int
shrinkableAmount1 := make([]int, len(items))
shrinkable2 := make([]bool, len(items))
growable2 := make([]bool, len(items))
sortedItemInfo := boxLayoutItemInfoList(make([]boxLayoutItemInfo, len(items)))
for i, item := range items {
sf := hwnd2StretchFactor[item.Handle()]
if sf == 0 {
sf = 1
}
stretchFactors[i] = sf
geometry := item.Geometry()
flags := item.LayoutFlags()
max := geometry.MaxSize
var pref Size
if hfw, ok := item.(HeightForWidther); !ok || !hfw.HasHeightForWidth() {
if is, ok := item.(IdealSizer); ok {
pref = is.IdealSize()
}
}
if orientation == Horizontal {
growable2[i] = flags&GrowableVert > 0
minSizes[i] = container.MinSizeEffectiveForChild(item).Width
if max.Width > 0 {
maxSizes[i] = max.Width
} else if pref.Width > 0 && flags&GrowableHorz == 0 {
maxSizes[i] = pref.Width
} else {
maxSizes[i] = 32768
}
prefSizes2[i] = pref.Height
sortedItemInfo[i].prefSize = pref.Width
sortedItemInfo[i].greedy = flags&GreedyHorz > 0
} else {
growable2[i] = flags&GrowableHorz > 0
if hfw, ok := item.(HeightForWidther); ok && hfw.HasHeightForWidth() {
minSizes[i] = hfw.HeightForWidth(bounds.Width - margins.HNear - margins.HFar)
} else {
minSizes[i] = container.MinSizeEffectiveForChild(item).Height
}
if max.Height > 0 {
maxSizes[i] = max.Height
} else if hfw, ok := item.(HeightForWidther); ok && flags&GrowableVert == 0 && hfw.HasHeightForWidth() {
maxSizes[i] = minSizes[i]
} else if pref.Height > 0 && flags&GrowableVert == 0 {
maxSizes[i] = pref.Height
} else {
maxSizes[i] = 32768
}
prefSizes2[i] = pref.Width
sortedItemInfo[i].prefSize = pref.Height
sortedItemInfo[i].greedy = flags&GreedyVert > 0
}
sortedItemInfo[i].index = i
sortedItemInfo[i].minSize = minSizes[i]
sortedItemInfo[i].maxSize = maxSizes[i]
sortedItemInfo[i].stretch = sf
sortedItemInfo[i].item = item
if orientation == Horizontal && flags&(ShrinkableHorz|GrowableHorz|GreedyHorz) == ShrinkableHorz ||
orientation == Vertical && flags&(ShrinkableVert|GrowableVert|GreedyVert) == ShrinkableVert {
if amount := sortedItemInfo[i].prefSize - minSizes[i]; amount > 0 {
shrinkableAmount1[i] = amount
shrinkableAmount1Total += amount
}
}
shrinkable2[i] = orientation == Horizontal && flags&ShrinkableVert != 0 || orientation == Vertical && flags&ShrinkableHorz != 0
if shrinkableAmount1[i] > 0 {
minSizesRemaining += sortedItemInfo[i].prefSize
} else {
minSizesRemaining += minSizes[i]
}
if sortedItemInfo[i].greedy {
if _, isSpacer := item.(*spacerLayoutItem); !isSpacer {
greedyNonSpacerCount++
stretchFactorsTotal[0] += sf
} else {
greedySpacerCount++
stretchFactorsTotal[1] += sf
}
} else {
stretchFactorsTotal[2] += sf
}
}
sort.Stable(sortedItemInfo)
var start1, start2, space1, space2 int
if orientation == Horizontal {
start1 = bounds.X + margins.HNear
start2 = bounds.Y + margins.VNear
space1 = bounds.Width - margins.HNear - margins.HFar
space2 = bounds.Height - margins.VNear - margins.VFar
} else {
start1 = bounds.Y + margins.VNear
start2 = bounds.X + margins.HNear
space1 = bounds.Height - margins.VNear - margins.VFar
space2 = bounds.Width - margins.HNear - margins.HFar
}
spacingRemaining := spacing * (len(items) - 1)
excess := float64(space1 - minSizesRemaining - spacingRemaining)
offsets := [3]int{0, greedyNonSpacerCount, greedyNonSpacerCount + greedySpacerCount}
counts := [3]int{greedyNonSpacerCount, greedySpacerCount, len(items) - greedyNonSpacerCount - greedySpacerCount}
for i := 0; i < 3; i++ {
stretchFactorsRemaining := stretchFactorsTotal[i]
for j := 0; j < counts[i]; j++ {
info := sortedItemInfo[offsets[i]+j]
k := info.index
stretch := stretchFactors[k]
min := info.minSize
max := info.maxSize
var size int
var corrected bool
if shrinkableAmount1[k] > 0 {
size = info.prefSize
if excess < 0.0 {
size -= mini(shrinkableAmount1[k], int(math.Round(-excess/float64(shrinkableAmount1Total)*float64(shrinkableAmount1[k]))))
corrected = true
}
} else {
size = min
}
if !corrected && min < max {
excessSpace := float64(space1 - minSizesRemaining - spacingRemaining)
size += int(math.Round(excessSpace * float64(stretch) / float64(stretchFactorsRemaining)))
if size < min {
size = min
} else if size > max {
size = max
}
}
sizes[k] = size
if shrinkableAmount1[k] > 0 {
minSizesRemaining -= info.prefSize
} else {
minSizesRemaining -= min
}
stretchFactorsRemaining -= stretch
space1 -= (size + spacing)
spacingRemaining -= spacing
}
}
results := make([]LayoutResultItem, 0, len(items))
excessTotal := space1 - minSizesRemaining - spacingRemaining
excessShare := excessTotal / len(items)
halfExcessShare := excessTotal / (len(items) * 2)
p1 := start1
for i, item := range items {
s1 := sizes[i]
var s2 int
if hfw, ok := item.(HeightForWidther); ok && orientation == Horizontal && hfw.HasHeightForWidth() {
s2 = hfw.HeightForWidth(s1)
} else if shrinkable2[i] || growable2[i] {
s2 = space2
} else {
s2 = prefSizes2[i]
}
align := item.Geometry().Alignment
if align == AlignHVDefault {
align = alignment
}
var x, y, w, h, p2 int
if orientation == Horizontal {
switch align {
case AlignHNearVNear, AlignHNearVCenter, AlignHNearVFar:
// nop
case AlignHFarVNear, AlignHFarVCenter, AlignHFarVFar:
p1 += excessShare
default:
p1 += halfExcessShare
}
switch align {
case AlignHNearVNear, AlignHCenterVNear, AlignHFarVNear:
p2 = start2
case AlignHNearVFar, AlignHCenterVFar, AlignHFarVFar:
p2 = start2 + space2 - s2
default:
p2 = start2 + (space2-s2)/2
}
x, y, w, h = p1, p2, s1, s2
} else {
switch align {
case AlignHNearVNear, AlignHCenterVNear, AlignHFarVNear:
// nop
case AlignHNearVFar, AlignHCenterVFar, AlignHFarVFar:
p1 += excessShare
default:
p1 += halfExcessShare
}
switch align {
case AlignHNearVNear, AlignHNearVCenter, AlignHNearVFar:
p2 = start2
case AlignHFarVNear, AlignHFarVCenter, AlignHFarVFar:
p2 = start2 + space2 - s2
default:
p2 = start2 + (space2-s2)/2
}
x, y, w, h = p2, p1, s2, s1
}
if orientation == Horizontal {
switch align {
case AlignHNearVNear, AlignHNearVCenter, AlignHNearVFar:
p1 += excessShare
case AlignHFarVNear, AlignHFarVCenter, AlignHFarVFar:
// nop
default:
p1 += halfExcessShare
}
} else {
switch align {
case AlignHNearVNear, AlignHCenterVNear, AlignHFarVNear:
p1 += excessShare
case AlignHNearVFar, AlignHCenterVFar, AlignHFarVFar:
// nop
default:
p1 += halfExcessShare
}
}
p1 += s1 + spacing
results = append(results, LayoutResultItem{Item: item, Bounds: Rectangle{X: x, Y: y, Width: w, Height: h}})
}
return results
}
================================================
FILE: brush.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"unsafe"
"github.com/lxn/win"
)
type HatchStyle int
const (
HatchHorizontal HatchStyle = win.HS_HORIZONTAL
HatchVertical HatchStyle = win.HS_VERTICAL
HatchForwardDiagonal HatchStyle = win.HS_FDIAGONAL
HatchBackwardDiagonal HatchStyle = win.HS_BDIAGONAL
HatchCross HatchStyle = win.HS_CROSS
HatchDiagonalCross HatchStyle = win.HS_DIAGCROSS
)
type SystemColor int
const (
SysColor3DDkShadow SystemColor = win.COLOR_3DDKSHADOW
SysColor3DFace SystemColor = win.COLOR_3DFACE
SysColor3DHighlight SystemColor = win.COLOR_3DHIGHLIGHT
SysColor3DLight SystemColor = win.COLOR_3DLIGHT
SysColor3DShadow SystemColor = win.COLOR_3DSHADOW
SysColorActiveBorder SystemColor = win.COLOR_ACTIVEBORDER
SysColorActiveCaption SystemColor = win.COLOR_ACTIVECAPTION
SysColorAppWorkspace SystemColor = win.COLOR_APPWORKSPACE
SysColorBackground SystemColor = win.COLOR_BACKGROUND
SysColorDesktop SystemColor = win.COLOR_DESKTOP
SysColorBtnFace SystemColor = win.COLOR_BTNFACE
SysColorBtnHighlight SystemColor = win.COLOR_BTNHIGHLIGHT
SysColorBtnShadow SystemColor = win.COLOR_BTNSHADOW
SysColorBtnText SystemColor = win.COLOR_BTNTEXT
SysColorCaptionText SystemColor = win.COLOR_CAPTIONTEXT
SysColorGrayText SystemColor = win.COLOR_GRAYTEXT
SysColorHighlight SystemColor = win.COLOR_HIGHLIGHT
SysColorHighlightText SystemColor = win.COLOR_HIGHLIGHTTEXT
SysColorInactiveBorder SystemColor = win.COLOR_INACTIVEBORDER
SysColorInactiveCaption SystemColor = win.COLOR_INACTIVECAPTION
SysColorInactiveCaptionText SystemColor = win.COLOR_INACTIVECAPTIONTEXT
SysColorInfoBk SystemColor = win.COLOR_INFOBK
SysColorInfoText SystemColor = win.COLOR_INFOTEXT
SysColorMenu SystemColor = win.COLOR_MENU
SysColorMenuText SystemColor = win.COLOR_MENUTEXT
SysColorScrollBar SystemColor = win.COLOR_SCROLLBAR
SysColorWindow SystemColor = win.COLOR_WINDOW
SysColorWindowFrame SystemColor = win.COLOR_WINDOWFRAME
SysColorWindowText SystemColor = win.COLOR_WINDOWTEXT
SysColorHotLight SystemColor = win.COLOR_HOTLIGHT
SysColorGradientActiveCaption SystemColor = win.COLOR_GRADIENTACTIVECAPTION
SysColorGradientInactiveCaption SystemColor = win.COLOR_GRADIENTINACTIVECAPTION
)
type Brush interface {
Dispose()
handle() win.HBRUSH
logbrush() *win.LOGBRUSH
attachWindow(wb *WindowBase)
detachWindow(wb *WindowBase)
simple() bool
}
type perWindowBrush interface {
Brush
delegateForWindow(wb *WindowBase) Brush
}
type windowBrushInfo struct {
SizeChangedHandle int
Delegate *BitmapBrush
}
type brushBase struct {
hBrush win.HBRUSH
wb2info map[*WindowBase]*windowBrushInfo
}
func (bb *brushBase) Dispose() {
if bb.hBrush != 0 {
win.DeleteObject(win.HGDIOBJ(bb.hBrush))
bb.hBrush = 0
}
}
func (bb *brushBase) handle() win.HBRUSH {
return bb.hBrush
}
func (bb *brushBase) attachWindow(wb *WindowBase) {
if wb == nil {
return
}
if bb.wb2info == nil {
bb.wb2info = make(map[*WindowBase]*windowBrushInfo)
}
bb.wb2info[wb] = nil
}
func (bb *brushBase) detachWindow(wb *WindowBase) {
if bb.wb2info == nil || wb == nil {
return
}
delete(bb.wb2info, wb)
if len(bb.wb2info) == 0 {
bb.Dispose()
}
}
type nullBrush struct {
brushBase
}
func newNullBrush() *nullBrush {
lb := &win.LOGBRUSH{LbStyle: win.BS_NULL}
hBrush := win.CreateBrushIndirect(lb)
if hBrush == 0 {
panic("failed to create null brush")
}
return &nullBrush{brushBase: brushBase{hBrush: hBrush}}
}
func (b *nullBrush) Dispose() {
if b == nullBrushSingleton {
return
}
b.brushBase.Dispose()
}
func (*nullBrush) logbrush() *win.LOGBRUSH {
return &win.LOGBRUSH{LbStyle: win.BS_NULL}
}
func (*nullBrush) simple() bool {
return true
}
var (
nullBrushSingleton Brush
sysColorBtnFaceBrush *SystemColorBrush
)
func NullBrush() Brush {
return nullBrushSingleton
}
type SystemColorBrush struct {
brushBase
sysColor SystemColor
}
func init() {
AppendToWalkInit(func() {
nullBrushSingleton = newNullBrush()
sysColorBtnFaceBrush, _ = NewSystemColorBrush(SysColorBtnFace)
})
}
func NewSystemColorBrush(sysColor SystemColor) (*SystemColorBrush, error) {
hBrush := win.GetSysColorBrush(int(sysColor))
if hBrush == 0 {
return nil, newError("GetSysColorBrush failed")
}
return &SystemColorBrush{brushBase: brushBase{hBrush: hBrush}, sysColor: sysColor}, nil
}
func (b *SystemColorBrush) Color() Color {
return Color(win.GetSysColor(int(b.sysColor)))
}
func (b *SystemColorBrush) SystemColor() SystemColor {
return b.sysColor
}
func (*SystemColorBrush) Dispose() {
// nop
}
func (b *SystemColorBrush) logbrush() *win.LOGBRUSH {
return &win.LOGBRUSH{
LbStyle: win.BS_SOLID,
LbColor: win.COLORREF(win.GetSysColor(int(b.sysColor))),
}
}
func (*SystemColorBrush) simple() bool {
return true
}
type SolidColorBrush struct {
brushBase
color Color
}
func NewSolidColorBrush(color Color) (*SolidColorBrush, error) {
lb := &win.LOGBRUSH{LbStyle: win.BS_SOLID, LbColor: win.COLORREF(color)}
hBrush := win.CreateBrushIndirect(lb)
if hBrush == 0 {
return nil, newError("CreateBrushIndirect failed")
}
return &SolidColorBrush{brushBase: brushBase{hBrush: hBrush}, color: color}, nil
}
func (b *SolidColorBrush) Color() Color {
return b.color
}
func (b *SolidColorBrush) logbrush() *win.LOGBRUSH {
return &win.LOGBRUSH{LbStyle: win.BS_SOLID, LbColor: win.COLORREF(b.color)}
}
func (*SolidColorBrush) simple() bool {
return true
}
type HatchBrush struct {
brushBase
color Color
style HatchStyle
}
func NewHatchBrush(color Color, style HatchStyle) (*HatchBrush, error) {
lb := &win.LOGBRUSH{LbStyle: win.BS_HATCHED, LbColor: win.COLORREF(color), LbHatch: uintptr(style)}
hBrush := win.CreateBrushIndirect(lb)
if hBrush == 0 {
return nil, newError("CreateBrushIndirect failed")
}
return &HatchBrush{brushBase: brushBase{hBrush: hBrush}, color: color, style: style}, nil
}
func (b *HatchBrush) Color() Color {
return b.color
}
func (b *HatchBrush) logbrush() *win.LOGBRUSH {
return &win.LOGBRUSH{LbStyle: win.BS_HATCHED, LbColor: win.COLORREF(b.color), LbHatch: uintptr(b.style)}
}
func (b *HatchBrush) Style() HatchStyle {
return b.style
}
func (b *HatchBrush) simple() bool {
return false
}
type BitmapBrush struct {
brushBase
bitmap *Bitmap
}
func NewBitmapBrush(bitmap *Bitmap) (*BitmapBrush, error) {
if bitmap == nil {
return nil, newError("bitmap cannot be nil")
}
hBrush := win.CreatePatternBrush(bitmap.hBmp)
if hBrush == 0 {
return nil, newError("CreatePatternBrush failed")
}
return &BitmapBrush{brushBase: brushBase{hBrush: hBrush}, bitmap: bitmap}, nil
}
func (b *BitmapBrush) logbrush() *win.LOGBRUSH {
return &win.LOGBRUSH{LbStyle: win.BS_DIBPATTERN, LbColor: win.DIB_RGB_COLORS, LbHatch: uintptr(b.bitmap.hPackedDIB)}
}
func (b *BitmapBrush) Bitmap() *Bitmap {
return b.bitmap
}
func (b *BitmapBrush) simple() bool {
return false
}
type GradientStop struct {
Offset float64
Color Color
}
type GradientVertex struct {
X float64
Y float64
Color Color
}
type GradientTriangle struct {
Vertex1 int
Vertex2 int
Vertex3 int
}
type GradientBrush struct {
brushBase
mainDelegate *BitmapBrush
vertexes []GradientVertex
triangles []GradientTriangle
orientation gradientOrientation
absolute bool
}
type gradientOrientation int
const (
gradientOrientationNone gradientOrientation = iota
gradientOrientationHorizontal
gradientOrientationVertical
)
func NewHorizontalGradientBrush(stops []GradientStop) (*GradientBrush, error) {
return newGradientBrushWithOrientation(stops, gradientOrientationHorizontal)
}
func NewVerticalGradientBrush(stops []GradientStop) (*GradientBrush, error) {
return newGradientBrushWithOrientation(stops, gradientOrientationVertical)
}
func newGradientBrushWithOrientation(stops []GradientStop, orientation gradientOrientation) (*GradientBrush, error) {
if len(stops) < 2 {
return nil, newError("at least 2 stops are required")
}
var vertexes []GradientVertex
var triangles []GradientTriangle
for i, stop := range stops {
var x0, y0, x1, y1 float64
if orientation == gradientOrientationHorizontal {
x0 = stop.Offset
x1 = stop.Offset
y1 = 1.0
} else {
y0 = stop.Offset
x1 = 1.0
y1 = stop.Offset
}
vertexes = append(vertexes, GradientVertex{X: x0, Y: y0, Color: stop.Color})
vertexes = append(vertexes, GradientVertex{X: x1, Y: y1, Color: stop.Color})
if i > 0 {
triangles = append(triangles, GradientTriangle{Vertex1: i*2 - 2, Vertex2: i*2 + 1, Vertex3: i*2 - 1})
triangles = append(triangles, GradientTriangle{Vertex1: i*2 - 2, Vertex2: i * 2, Vertex3: i*2 + 1})
}
}
return newGradientBrush(vertexes, triangles, orientation)
}
func NewGradientBrush(vertexes []GradientVertex, triangles []GradientTriangle) (*GradientBrush, error) {
if len(vertexes) < 3 {
return nil, newError("at least 3 vertexes are required")
}
if len(triangles) < 1 {
return nil, newError("at least 1 triangle is required")
}
return newGradientBrush(vertexes, triangles, gradientOrientationNone)
}
func newGradientBrush(vertexes []GradientVertex, triangles []GradientTriangle, orientation gradientOrientation) (*GradientBrush, error) {
var size Size
for _, v := range vertexes {
size = maxSize(size, Size{int(v.X), int(v.Y)})
}
gb := &GradientBrush{vertexes: vertexes, triangles: triangles, orientation: orientation, absolute: size.Width > 1 || size.Height > 1}
if gb.absolute {
bb, err := gb.create(size)
if err != nil {
return nil, err
}
gb.mainDelegate = bb
gb.hBrush = bb.hBrush
}
return gb, nil
}
func (b *GradientBrush) logbrush() *win.LOGBRUSH {
if b.mainDelegate == nil {
return nil
}
return b.mainDelegate.logbrush()
}
func (*GradientBrush) simple() bool {
return false
}
// create creates a gradient brush at given size in native pixels.
func (b *GradientBrush) create(size Size) (*BitmapBrush, error) {
var disposables Disposables
defer disposables.Treat()
switch b.orientation {
case gradientOrientationHorizontal:
size.Height = 1
case gradientOrientationVertical:
size.Width = 1
}
bitmap, err := NewBitmapForDPI(size, 96) // Size is in native pixels and bitmap is used for brush only => DPI is not used anywhere.
if err != nil {
return nil, err
}
disposables.Add(bitmap)
canvas, err := NewCanvasFromImage(bitmap)
if err != nil {
return nil, err
}
defer canvas.Dispose()
var scaleX, scaleY float64
if b.absolute {
scaleX, scaleY = 1, 1
} else {
scaleX, scaleY = float64(size.Width), float64(size.Height)
}
vertexes := make([]win.TRIVERTEX, len(b.vertexes))
for i, src := range b.vertexes {
dst := &vertexes[i]
dst.X = int32(src.X * scaleX)
dst.Y = int32(src.Y * scaleY)
dst.Red = uint16(src.Color.R()) * 256
dst.Green = uint16(src.Color.G()) * 256
dst.Blue = uint16(src.Color.B()) * 256
}
triangles := make([]win.GRADIENT_TRIANGLE, len(b.triangles))
for i, src := range b.triangles {
dst := &triangles[i]
dst.Vertex1 = uint32(src.Vertex1)
dst.Vertex2 = uint32(src.Vertex2)
dst.Vertex3 = uint32(src.Vertex3)
}
if !win.GradientFill(canvas.hdc, &vertexes[0], uint32(len(vertexes)), unsafe.Pointer(&triangles[0]), uint32(len(triangles)), win.GRADIENT_FILL_TRIANGLE) {
return nil, newError("GradientFill failed")
}
disposables.Spare()
return NewBitmapBrush(bitmap)
}
func (b *GradientBrush) attachWindow(wb *WindowBase) {
b.brushBase.attachWindow(wb)
if b.absolute {
return
}
var info *windowBrushInfo
update := func() {
if bb, err := b.create(wb.window.ClientBoundsPixels().Size()); err == nil {
if info.Delegate != nil {
info.Delegate.bitmap.Dispose()
info.Delegate.Dispose()
}
info.Delegate = bb
wb.Invalidate()
}
}
info = &windowBrushInfo{
SizeChangedHandle: wb.SizeChanged().Attach(update),
}
update()
b.wb2info[wb] = info
}
func (b *GradientBrush) detachWindow(wb *WindowBase) {
if !b.absolute {
if info, ok := b.wb2info[wb]; ok {
if info.Delegate != nil {
info.Delegate.bitmap.Dispose()
info.Delegate.Dispose()
}
wb.SizeChanged().Detach(info.SizeChangedHandle)
}
}
b.brushBase.detachWindow(wb)
}
func (b *GradientBrush) delegateForWindow(wb *WindowBase) Brush {
if b.absolute {
return b.mainDelegate
}
if info, ok := b.wb2info[wb]; ok && info.Delegate != nil {
return info.Delegate
}
return nil
}
================================================
FILE: button.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"fmt"
"unsafe"
"github.com/lxn/win"
)
type clickable interface {
raiseClicked()
}
type setCheckeder interface {
setChecked(checked bool)
}
type Button struct {
WidgetBase
checkedChangedPublisher EventPublisher
clickedPublisher EventPublisher
textChangedPublisher EventPublisher
imageChangedPublisher EventPublisher
image Image
persistent bool
}
func (b *Button) init() {
b.MustRegisterProperty("Checked", NewBoolProperty(
func() bool {
return b.Checked()
},
func(v bool) error {
b.SetChecked(v)
return nil
},
b.CheckedChanged()))
b.MustRegisterProperty("Image", NewProperty(
func() interface{} {
return b.Image()
},
func(v interface{}) error {
img, err := ImageFrom(v)
if err != nil {
return err
}
b.SetImage(img)
return nil
},
b.imageChangedPublisher.Event()))
b.MustRegisterProperty("Text", NewProperty(
func() interface{} {
return b.Text()
},
func(v interface{}) error {
return b.SetText(assertStringOr(v, ""))
},
b.textChangedPublisher.Event()))
}
func (b *Button) ApplyDPI(dpi int) {
b.WidgetBase.ApplyDPI(dpi)
b.SetImage(b.image)
}
func (b *Button) Image() Image {
return b.image
}
func (b *Button) SetImage(image Image) error {
var typ, handle uintptr
switch img := image.(type) {
case nil:
case *Bitmap:
typ = win.IMAGE_BITMAP
handle = uintptr(img.hBmp)
case *Icon:
typ = win.IMAGE_ICON
handle = uintptr(img.handleForDPI(b.DPI()))
default:
bmp, err := iconCache.Bitmap(image, b.DPI())
if err != nil {
return err
}
typ = win.IMAGE_BITMAP
handle = uintptr(bmp.hBmp)
}
b.SendMessage(win.BM_SETIMAGE, typ, handle)
b.image = image
b.RequestLayout()
b.imageChangedPublisher.Publish()
return nil
}
func (b *Button) ImageChanged() *Event {
return b.imageChangedPublisher.Event()
}
func (b *Button) Text() string {
return b.text()
}
func (b *Button) SetText(value string) error {
if value == b.Text() {
return nil
}
if err := b.setText(value); err != nil {
return err
}
b.RequestLayout()
return nil
}
func (b *Button) Checked() bool {
return b.SendMessage(win.BM_GETCHECK, 0, 0) == win.BST_CHECKED
}
func (b *Button) SetChecked(checked bool) {
if checked == b.Checked() {
return
}
b.window.(setCheckeder).setChecked(checked)
}
func (b *Button) setChecked(checked bool) {
var chk uintptr
if checked {
chk = win.BST_CHECKED
} else {
chk = win.BST_UNCHECKED
}
b.SendMessage(win.BM_SETCHECK, chk, 0)
b.checkedChangedPublisher.Publish()
}
func (b *Button) CheckedChanged() *Event {
return b.checkedChangedPublisher.Event()
}
func (b *Button) Persistent() bool {
return b.persistent
}
func (b *Button) SetPersistent(value bool) {
b.persistent = value
}
func (b *Button) SaveState() error {
return b.WriteState(fmt.Sprintf("%t", b.Checked()))
}
func (b *Button) RestoreState() error {
s, err := b.ReadState()
if err != nil {
return err
}
b.SetChecked(s == "true")
return nil
}
func (b *Button) Clicked() *Event {
return b.clickedPublisher.Event()
}
func (b *Button) raiseClicked() {
b.clickedPublisher.Publish()
}
func (b *Button) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_COMMAND:
hiWP := win.HIWORD(uint32(wParam))
if hiWP == 0 && lParam == 0 {
if a, ok := actionsById[win.LOWORD(uint32(wParam))]; ok {
a.raiseTriggered()
}
} else {
switch hiWP {
case win.BN_CLICKED:
b.raiseClicked()
}
}
case win.WM_SETTEXT:
b.textChangedPublisher.Publish()
}
return b.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
}
// idealSize returns ideal button size in native pixels.
func (b *Button) idealSize() Size {
min := b.dialogBaseUnitsToPixels(Size{50, 14})
if b.Text() == "" {
return min
}
var s win.SIZE
b.SendMessage(win.BCM_GETIDEALSIZE, 0, uintptr(unsafe.Pointer(&s)))
return maxSize(sizeFromSIZE(s), min)
}
func (b *Button) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
return &buttonLayoutItem{
idealSize: b.idealSize(),
}
}
type buttonLayoutItem struct {
LayoutItemBase
idealSize Size // in native pixels
}
func (li *buttonLayoutItem) LayoutFlags() LayoutFlags {
return 0
}
func (li *buttonLayoutItem) IdealSize() Size {
return li.MinSize()
}
func (li *buttonLayoutItem) MinSize() Size {
return li.idealSize
}
================================================
FILE: cancelevent.go
================================================
// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
type cancelEventHandlerInfo struct {
handler CancelEventHandler
once bool
}
type CancelEventHandler func(canceled *bool)
type CancelEvent struct {
handlers []cancelEventHandlerInfo
}
func (e *CancelEvent) Attach(handler CancelEventHandler) int {
handlerInfo := cancelEventHandlerInfo{handler, false}
for i, h := range e.handlers {
if h.handler == nil {
e.handlers[i] = handlerInfo
return i
}
}
e.handlers = append(e.handlers, handlerInfo)
return len(e.handlers) - 1
}
func (e *CancelEvent) Detach(handle int) {
e.handlers[handle].handler = nil
}
func (e *CancelEvent) Once(handler CancelEventHandler) {
i := e.Attach(handler)
e.handlers[i].once = true
}
type CancelEventPublisher struct {
event CancelEvent
}
func (p *CancelEventPublisher) Event() *CancelEvent {
return &p.event
}
func (p *CancelEventPublisher) Publish(canceled *bool) {
for i, h := range p.event.handlers {
if h.handler != nil {
h.handler(canceled)
if h.once {
p.event.Detach(i)
}
}
}
}
================================================
FILE: canvas.go
================================================
// Copyright 2010 The Walk Authorc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"log"
"syscall"
"unicode/utf8"
"unsafe"
"github.com/lxn/win"
)
// DrawText format flags
type DrawTextFormat uint
const (
TextTop DrawTextFormat = win.DT_TOP
TextLeft DrawTextFormat = win.DT_LEFT
TextCenter DrawTextFormat = win.DT_CENTER
TextRight DrawTextFormat = win.DT_RIGHT
TextVCenter DrawTextFormat = win.DT_VCENTER
TextBottom DrawTextFormat = win.DT_BOTTOM
TextWordbreak DrawTextFormat = win.DT_WORDBREAK
TextSingleLine DrawTextFormat = win.DT_SINGLELINE
TextExpandTabs DrawTextFormat = win.DT_EXPANDTABS
TextTabstop DrawTextFormat = win.DT_TABSTOP
TextNoClip DrawTextFormat = win.DT_NOCLIP
TextExternalLeading DrawTextFormat = win.DT_EXTERNALLEADING
TextCalcRect DrawTextFormat = win.DT_CALCRECT
TextNoPrefix DrawTextFormat = win.DT_NOPREFIX
TextInternal DrawTextFormat = win.DT_INTERNAL
TextEditControl DrawTextFormat = win.DT_EDITCONTROL
TextPathEllipsis DrawTextFormat = win.DT_PATH_ELLIPSIS
TextEndEllipsis DrawTextFormat = win.DT_END_ELLIPSIS
TextModifyString DrawTextFormat = win.DT_MODIFYSTRING
TextRTLReading DrawTextFormat = win.DT_RTLREADING
TextWordEllipsis DrawTextFormat = win.DT_WORD_ELLIPSIS
TextNoFullWidthCharBreak DrawTextFormat = win.DT_NOFULLWIDTHCHARBREAK
TextHidePrefix DrawTextFormat = win.DT_HIDEPREFIX
TextPrefixOnly DrawTextFormat = win.DT_PREFIXONLY
)
var gM *uint16
func init() {
AppendToWalkInit(func() {
gM = syscall.StringToUTF16Ptr("gM")
})
}
type Canvas struct {
hdc win.HDC
hBmpStock win.HBITMAP
window Window
dpi int
bitmap *Bitmap
recordingMetafile *Metafile
measureTextMetafile *Metafile
doNotDispose bool
}
func NewCanvasFromImage(image Image) (*Canvas, error) {
switch img := image.(type) {
case *Bitmap:
hdc := win.CreateCompatibleDC(0)
if hdc == 0 {
return nil, newError("CreateCompatibleDC failed")
}
succeeded := false
defer func() {
if !succeeded {
win.DeleteDC(hdc)
}
}()
var hBmpStock win.HBITMAP
if hBmpStock = win.HBITMAP(win.SelectObject(hdc, win.HGDIOBJ(img.hBmp))); hBmpStock == 0 {
return nil, newError("SelectObject failed")
}
succeeded = true
return (&Canvas{hdc: hdc, hBmpStock: hBmpStock, bitmap: img, dpi: img.dpi}).init()
case *Metafile:
c, err := newCanvasFromHDC(img.hdc)
if err != nil {
return nil, err
}
c.recordingMetafile = img
return c, nil
}
return nil, newError("unsupported image type")
}
func newCanvasFromWindow(window Window) (*Canvas, error) {
hdc := win.GetDC(window.Handle())
if hdc == 0 {
return nil, newError("GetDC failed")
}
return (&Canvas{hdc: hdc, window: window}).init()
}
func newCanvasFromHDC(hdc win.HDC) (*Canvas, error) {
if hdc == 0 {
return nil, newError("invalid hdc")
}
return (&Canvas{hdc: hdc, doNotDispose: true}).init()
}
func (c *Canvas) init() (*Canvas, error) {
if c.dpi == 0 {
c.dpi = dpiForHDC(c.hdc)
}
if win.SetBkMode(c.hdc, win.TRANSPARENT) == 0 {
return nil, newError("SetBkMode failed")
}
switch win.SetStretchBltMode(c.hdc, win.HALFTONE) {
case 0, win.ERROR_INVALID_PARAMETER:
return nil, newError("SetStretchBltMode failed")
}
if !win.SetBrushOrgEx(c.hdc, 0, 0, nil) {
return nil, newError("SetBrushOrgEx failed")
}
return c, nil
}
func (c *Canvas) Dispose() {
if !c.doNotDispose && c.hdc != 0 {
if c.bitmap != nil {
win.SelectObject(c.hdc, win.HGDIOBJ(c.hBmpStock))
win.DeleteDC(c.hdc)
if err := c.bitmap.postProcess(); err != nil {
log.Printf("*Canvas.Dispose - failed to post-process bitmap: %s", err.Error())
}
} else {
win.ReleaseDC(c.window.Handle(), c.hdc)
}
c.hdc = 0
}
if c.recordingMetafile != nil {
c.recordingMetafile.ensureFinished()
c.recordingMetafile = nil
}
if c.measureTextMetafile != nil {
c.measureTextMetafile.Dispose()
c.measureTextMetafile = nil
}
}
func (c *Canvas) DPI() int {
if c.window != nil {
return c.window.DPI()
}
return c.dpi
}
func (c *Canvas) withGdiObj(handle win.HGDIOBJ, f func() error) error {
oldHandle := win.SelectObject(c.hdc, handle)
if oldHandle == 0 {
return newError("SelectObject failed")
}
defer win.SelectObject(c.hdc, oldHandle)
return f()
}
func (c *Canvas) withBrush(brush Brush, f func() error) error {
return c.withGdiObj(win.HGDIOBJ(brush.handle()), f)
}
func (c *Canvas) withFontAndTextColor(font *Font, color Color, f func() error) error {
return c.withGdiObj(win.HGDIOBJ(font.handleForDPI(c.DPI())), func() error {
oldColor := win.SetTextColor(c.hdc, win.COLORREF(color))
if oldColor == win.CLR_INVALID {
return newError("SetTextColor failed")
}
defer func() {
win.SetTextColor(c.hdc, oldColor)
}()
return f()
})
}
func (c *Canvas) HDC() win.HDC {
return c.hdc
}
func (c *Canvas) Bounds() Rectangle {
return RectangleTo96DPI(c.BoundsPixels(), c.DPI())
}
func (c *Canvas) BoundsPixels() Rectangle {
return Rectangle{
Width: int(win.GetDeviceCaps(c.hdc, win.HORZRES)),
Height: int(win.GetDeviceCaps(c.hdc, win.VERTRES)),
}
}
func (c *Canvas) withPen(pen Pen, f func() error) error {
return c.withGdiObj(win.HGDIOBJ(pen.handleForDPI(c.dpi)), f)
}
func (c *Canvas) withBrushAndPen(brush Brush, pen Pen, f func() error) error {
return c.withBrush(brush, func() error {
return c.withPen(pen, f)
})
}
// ellipse draws an ellipse in 1/96" units. sizeCorrection parameter is in native pixels.
//
// Deprecated: Newer applications should use ellipsePixels.
func (c *Canvas) ellipse(brush Brush, pen Pen, bounds Rectangle, sizeCorrection int) error {
return c.ellipsePixels(brush, pen, RectangleFrom96DPI(bounds, c.DPI()), sizeCorrection)
}
// ellipsePixels draws an ellipse in native pixels.
func (c *Canvas) ellipsePixels(brush Brush, pen Pen, bounds Rectangle, sizeCorrection int) error {
return c.withBrushAndPen(brush, pen, func() error {
if !win.Ellipse(
c.hdc,
int32(bounds.X),
int32(bounds.Y),
int32(bounds.X+bounds.Width+sizeCorrection),
int32(bounds.Y+bounds.Height+sizeCorrection)) {
return newError("Ellipse failed")
}
return nil
})
}
// DrawEllipse draws an ellipse in 1/96" units.
//
// Deprecated: Newer applications should use DrawEllipsePixels.
func (c *Canvas) DrawEllipse(pen Pen, bounds Rectangle) error {
return c.ellipse(nullBrushSingleton, pen, bounds, 0)
}
// DrawEllipsePixels draws an ellipse in native pixels.
func (c *Canvas) DrawEllipsePixels(pen Pen, bounds Rectangle) error {
return c.ellipsePixels(nullBrushSingleton, pen, bounds, 0)
}
// FillEllipse draws a filled ellipse in 1/96" units.
//
// Deprecated: Newer applications should use FillEllipsePixels.
func (c *Canvas) FillEllipse(brush Brush, bounds Rectangle) error {
return c.ellipse(brush, nullPenSingleton, bounds, 1)
}
// FillEllipsePixels draws a filled in native pixels.
func (c *Canvas) FillEllipsePixels(brush Brush, bounds Rectangle) error {
return c.ellipsePixels(brush, nullPenSingleton, bounds, 1)
}
// DrawImage draws image at given location (upper left) in 1/96" units unstretched.
//
// Deprecated: Newer applications should use DrawImagePixels.
func (c *Canvas) DrawImage(image Image, location Point) error {
return c.DrawImagePixels(image, PointFrom96DPI(location, c.DPI()))
}
// DrawImagePixels draws image at given location (upper left) in native pixels unstretched.
func (c *Canvas) DrawImagePixels(image Image, location Point) error {
if image == nil {
return newError("image cannot be nil")
}
return image.draw(c.hdc, location)
}
// DrawImageStretched draws image at given location in 1/96" units stretched.
//
// Deprecated: Newer applications should use DrawImageStretchedPixels.
func (c *Canvas) DrawImageStretched(image Image, bounds Rectangle) error {
return c.DrawImageStretchedPixels(image, RectangleFrom96DPI(bounds, c.DPI()))
}
// DrawImageStretchedPixels draws image at given location in native pixels stretched.
func (c *Canvas) DrawImageStretchedPixels(image Image, bounds Rectangle) error {
if image == nil {
return newError("image cannot be nil")
}
if dsoc, ok := image.(interface {
drawStretchedOnCanvasPixels(canvas *Canvas, bounds Rectangle) error
}); ok {
return dsoc.drawStretchedOnCanvasPixels(c, bounds)
}
return image.drawStretched(c.hdc, bounds)
}
// DrawBitmapWithOpacity draws bitmap with opacity at given location in 1/96" units stretched.
//
// Deprecated: Newer applications should use DrawBitmapWithOpacityPixels.
func (c *Canvas) DrawBitmapWithOpacity(bmp *Bitmap, bounds Rectangle, opacity byte) error {
return c.DrawBitmapWithOpacityPixels(bmp, RectangleFrom96DPI(bounds, c.DPI()), opacity)
}
// DrawBitmapWithOpacityPixels draws bitmap with opacity at given location in native pixels
// stretched.
func (c *Canvas) DrawBitmapWithOpacityPixels(bmp *Bitmap, bounds Rectangle, opacity byte) error {
if bmp == nil {
return newError("bmp cannot be nil")
}
return bmp.alphaBlend(c.hdc, bounds, opacity)
}
// DrawBitmapPart draws bitmap at given location in native pixels.
func (c *Canvas) DrawBitmapPart(bmp *Bitmap, dst, src Rectangle) error {
return c.DrawBitmapPartWithOpacityPixels(bmp, dst, src, 0xff)
}
// DrawBitmapPartWithOpacity draws bitmap at given location in 1/96" units.
//
// Deprecated: Newer applications should use DrawBitmapPartWithOpacityPixels.
func (c *Canvas) DrawBitmapPartWithOpacity(bmp *Bitmap, dst, src Rectangle, opacity byte) error {
dpi := c.DPI()
return c.DrawBitmapPartWithOpacityPixels(bmp, RectangleFrom96DPI(dst, dpi), RectangleFrom96DPI(src, dpi), opacity)
}
// DrawBitmapPartWithOpacityPixels draws bitmap at given location in native pixels.
func (c *Canvas) DrawBitmapPartWithOpacityPixels(bmp *Bitmap, dst, src Rectangle, opacity byte) error {
if bmp == nil {
return newError("bmp cannot be nil")
}
return bmp.alphaBlendPart(c.hdc, dst, src, opacity)
}
// DrawLine draws a line between two points in 1/96" units.
//
// Deprecated: Newer applications should use DrawLinePixels.
func (c *Canvas) DrawLine(pen Pen, from, to Point) error {
dpi := c.DPI()
return c.DrawLinePixels(pen, PointFrom96DPI(from, dpi), PointFrom96DPI(to, dpi))
}
// DrawLinePixels draws a line between two points in native pixels.
func (c *Canvas) DrawLinePixels(pen Pen, from, to Point) error {
if !win.MoveToEx(c.hdc, int(from.X), int(from.Y), nil) {
return newError("MoveToEx failed")
}
return c.withPen(pen, func() error {
if !win.LineTo(c.hdc, int32(to.X), int32(to.Y)) {
return newError("LineTo failed")
}
return nil
})
}
// DrawLine draws a line between given points in 1/96" units.
//
// Deprecated: Newer applications should use DrawLinePixels.
func (c *Canvas) DrawPolyline(pen Pen, points []Point) error {
if len(points) < 1 {
return nil
}
dpi := c.DPI()
pts := make([]win.POINT, len(points))
for i, p := range points {
pts[i] = PointFrom96DPI(p, dpi).toPOINT()
}
return c.withPen(pen, func() error {
if !win.Polyline(c.hdc, unsafe.Pointer(&pts[0].X), int32(len(pts))) {
return newError("Polyline failed")
}
return nil
})
}
// DrawPolylinePixels draws a line between given points in native pixels.
func (c *Canvas) DrawPolylinePixels(pen Pen, points []Point) error {
if len(points) < 1 {
return nil
}
pts := make([]win.POINT, len(points))
for i, p := range points {
pts[i] = p.toPOINT()
}
return c.withPen(pen, func() error {
if !win.Polyline(c.hdc, unsafe.Pointer(&pts[0].X), int32(len(pts))) {
return newError("Polyline failed")
}
return nil
})
}
// rectangle draws a rectangle in 1/96" units. sizeCorrection parameter is in native pixels.
//
// Deprecated: Newer applications should use rectanglePixels.
func (c *Canvas) rectangle(brush Brush, pen Pen, bounds Rectangle, sizeCorrection int) error {
return c.rectanglePixels(brush, pen, RectangleFrom96DPI(bounds, c.DPI()), sizeCorrection)
}
// rectanglePixels draws a rectangle in native pixels.
func (c *Canvas) rectanglePixels(brush Brush, pen Pen, bounds Rectangle, sizeCorrection int) error {
return c.withBrushAndPen(brush, pen, func() error {
if !win.Rectangle_(
c.hdc,
int32(bounds.X),
int32(bounds.Y),
int32(bounds.X+bounds.Width+sizeCorrection),
int32(bounds.Y+bounds.Height+sizeCorrection)) {
return newError("Rectangle_ failed")
}
return nil
})
}
// DrawRectangle draws a rectangle in 1/96" units.
//
// Deprecated: Newer applications should use DrawRectanglePixels.
func (c *Canvas) DrawRectangle(pen Pen, bounds Rectangle) error {
return c.rectangle(nullBrushSingleton, pen, bounds, 0)
}
// DrawRectanglePixels draws a rectangle in native pixels.
func (c *Canvas) DrawRectanglePixels(pen Pen, bounds Rectangle) error {
return c.rectanglePixels(nullBrushSingleton, pen, bounds, 0)
}
// FillRectangle draws a filled rectangle in 1/96" units.
//
// Deprecated: Newer applications should use FillRectanglePixels.
func (c *Canvas) FillRectangle(brush Brush, bounds Rectangle) error {
return c.rectangle(brush, nullPenSingleton, bounds, 1)
}
// FillRectanglePixels draws a filled rectangle in native pixels.
func (c *Canvas) FillRectanglePixels(brush Brush, bounds Rectangle) error {
return c.rectanglePixels(brush, nullPenSingleton, bounds, 1)
}
// roundedRectangle draws a rounded rectangle in 1/96" units. sizeCorrection parameter is in native
// pixels.
//
// Deprecated: Newer applications should use roundedRectanglePixels.
func (c *Canvas) roundedRectangle(brush Brush, pen Pen, bounds Rectangle, ellipseSize Size, sizeCorrection int) error {
dpi := c.DPI()
return c.roundedRectanglePixels(brush, pen, RectangleFrom96DPI(bounds, dpi), SizeFrom96DPI(ellipseSize, dpi), sizeCorrection)
}
// roundedRectanglePixels draws a rounded rectangle in native pixels.
func (c *Canvas) roundedRectanglePixels(brush Brush, pen Pen, bounds Rectangle, ellipseSize Size, sizeCorrection int) error {
return c.withBrushAndPen(brush, pen, func() error {
if !win.RoundRect(
c.hdc,
int32(bounds.X),
int32(bounds.Y),
int32(bounds.X+bounds.Width+sizeCorrection),
int32(bounds.Y+bounds.Height+sizeCorrection),
int32(ellipseSize.Width),
int32(ellipseSize.Height)) {
return newError("RoundRect failed")
}
return nil
})
}
// DrawRoundedRectangle draws a rounded rectangle in 1/96" units. sizeCorrection parameter is in native
// pixels.
//
// Deprecated: Newer applications should use DrawRoundedRectanglePixels.
func (c *Canvas) DrawRoundedRectangle(pen Pen, bounds Rectangle, ellipseSize Size) error {
return c.roundedRectangle(nullBrushSingleton, pen, bounds, ellipseSize, 0)
}
// DrawRoundedRectanglePixels draws a rounded rectangle in native pixels.
func (c *Canvas) DrawRoundedRectanglePixels(pen Pen, bounds Rectangle, ellipseSize Size) error {
return c.roundedRectanglePixels(nullBrushSingleton, pen, bounds, ellipseSize, 0)
}
// FillRoundedRectangle draws a filled rounded rectangle in 1/96" units. sizeCorrection parameter
// is in native
// pixels.
//
// Deprecated: Newer applications should use FillRoundedRectanglePixels.
func (c *Canvas) FillRoundedRectangle(brush Brush, bounds Rectangle, ellipseSize Size) error {
return c.roundedRectangle(brush, nullPenSingleton, bounds, ellipseSize, 1)
}
// FillRoundedRectanglePixels draws a filled rounded rectangle in native pixels.
func (c *Canvas) FillRoundedRectanglePixels(brush Brush, bounds Rectangle, ellipseSize Size) error {
return c.roundedRectanglePixels(brush, nullPenSingleton, bounds, ellipseSize, 1)
}
// GradientFillRectangle draws a gradient filled rectangle in 1/96" units.
//
// Deprecated: Newer applications should use GradientFillRectanglePixels.
func (c *Canvas) GradientFillRectangle(color1, color2 Color, orientation Orientation, bounds Rectangle) error {
return c.GradientFillRectanglePixels(color1, color2, orientation, RectangleFrom96DPI(bounds, c.DPI()))
}
// GradientFillRectanglePixels draws a gradient filled rectangle in native pixels.
func (c *Canvas) GradientFillRectanglePixels(color1, color2 Color, orientation Orientation, bounds Rectangle) error {
vertices := [2]win.TRIVERTEX{
{
X: int32(bounds.X),
Y: int32(bounds.Y),
Red: uint16(color1.R()) * 256,
Green: uint16(color1.G()) * 256,
Blue: uint16(color1.B()) * 256,
Alpha: 0,
}, {
X: int32(bounds.X + bounds.Width),
Y: int32(bounds.Y + bounds.Height),
Red: uint16(color2.R()) * 256,
Green: uint16(color2.G()) * 256,
Blue: uint16(color2.B()) * 256,
Alpha: 0,
},
}
indices := win.GRADIENT_RECT{
UpperLeft: 0,
LowerRight: 1,
}
var o uint32
if orientation == Vertical {
o = 1
}
if !win.GradientFill(c.hdc, &vertices[0], 2, unsafe.Pointer(&indices), 1, o) {
return newError("GradientFill failed")
}
return nil
}
// DrawText draws text at given location in 1/96" units.
//
// Deprecated: Newer applications should use DrawTextPixels.
func (c *Canvas) DrawText(text string, font *Font, color Color, bounds Rectangle, format DrawTextFormat) error {
return c.DrawTextPixels(text, font, color, RectangleFrom96DPI(bounds, c.DPI()), format)
}
// DrawTextPixels draws text at given location in native pixels.
func (c *Canvas) DrawTextPixels(text string, font *Font, color Color, bounds Rectangle, format DrawTextFormat) error {
return c.withFontAndTextColor(font, color, func() error {
rect := bounds.toRECT()
ret := win.DrawTextEx(
c.hdc,
syscall.StringToUTF16Ptr(text),
-1,
&rect,
uint32(format)|win.DT_EDITCONTROL,
nil)
if ret == 0 {
return newError("DrawTextEx failed")
}
return nil
})
}
// fontHeight returns font height in native pixels.
func (c *Canvas) fontHeight(font *Font) (height int, err error) {
err = c.withFontAndTextColor(font, 0, func() error {
var size win.SIZE
if !win.GetTextExtentPoint32(c.hdc, gM, 2, &size) {
return newError("GetTextExtentPoint32 failed")
}
height = int(size.CY)
if height == 0 {
return newError("invalid font height")
}
return nil
})
return
}
// measureTextForDPI measures text for given DPI. Input and output bounds are in native pixels.
func (c *Canvas) measureTextForDPI(text string, font *Font, bounds Rectangle, format DrawTextFormat, dpi int) (boundsMeasured Rectangle, err error) {
hFont := win.HGDIOBJ(font.handleForDPI(dpi))
oldHandle := win.SelectObject(c.hdc, hFont)
if oldHandle == 0 {
err = newError("SelectObject failed")
return
}
defer win.SelectObject(c.hdc, oldHandle)
rect := &win.RECT{
int32(bounds.X),
int32(bounds.Y),
int32(bounds.X + bounds.Width),
int32(bounds.Y + bounds.Height),
}
var params win.DRAWTEXTPARAMS
params.CbSize = uint32(unsafe.Sizeof(params))
strPtr := syscall.StringToUTF16Ptr(text)
dtfmt := uint32(format) | win.DT_CALCRECT | win.DT_EDITCONTROL | win.DT_NOPREFIX | win.DT_WORDBREAK
height := win.DrawTextEx(
c.hdc, strPtr, -1, rect, dtfmt, ¶ms)
if height == 0 {
err = newError("DrawTextEx failed")
return
}
boundsMeasured = Rectangle{
int(rect.Left),
int(rect.Top),
int(rect.Right - rect.Left),
int(height),
}
return
}
// MeasureText measures text size. Input and output bounds are in 1/96" units.
//
// Deprecated: Newer applications should use MeasureTextPixels.
func (c *Canvas) MeasureText(text string, font *Font, bounds Rectangle, format DrawTextFormat) (boundsMeasured Rectangle, runesFitted int, err error) {
dpi := c.DPI()
var boundsMeasuredPixels Rectangle
boundsMeasuredPixels, runesFitted, err = c.MeasureTextPixels(text, font, RectangleFrom96DPI(bounds, dpi), format)
if err != nil {
return
}
boundsMeasured = RectangleTo96DPI(boundsMeasuredPixels, dpi)
return
}
// MeasureTextPixels measures text size. Input and output bounds are in native pixels.
func (c *Canvas) MeasureTextPixels(text string, font *Font, bounds Rectangle, format DrawTextFormat) (boundsMeasured Rectangle, runesFitted int, err error) {
boundsMeasured, _, runesFitted, err = c.measureAndModifyTextPixels(text, font, bounds, format)
return
}
// MeasureAndModifyTextPixels measures text size and also supports modification
// of the text which occurs if it does not fit into the specified bounds.
//
// Input and output bounds are in native pixels.
func (c *Canvas) MeasureAndModifyTextPixels(text string, font *Font, bounds Rectangle, format DrawTextFormat) (boundsMeasured Rectangle, textDisplayed string, err error) {
var textPtr *uint16
var runesFitted int
if boundsMeasured, textPtr, runesFitted, err = c.measureAndModifyTextPixels(text, font, bounds, format|TextModifyString); err != nil {
return
}
if runesFitted == utf8.RuneCountInString(text) {
textDisplayed = text
} else {
if format&(TextEndEllipsis|TextPathEllipsis) != 0 {
textDisplayed = win.UTF16PtrToString(textPtr)
} else {
textDisplayed = string(([]rune)(text)[:runesFitted])
}
}
return
}
func (c *Canvas) measureAndModifyTextPixels(text string, font *Font, bounds Rectangle, format DrawTextFormat) (boundsMeasured Rectangle, textPtr *uint16, runesFitted int, err error) {
// HACK: We don't want to actually draw on the Canvas here, but if we use
// the DT_CALCRECT flag to avoid drawing, params.UiLengthDrawn will
// not contain a useful value. To work around this, we create an in-memory
// metafile and draw into that instead.
if c.measureTextMetafile == nil {
c.measureTextMetafile, err = NewMetafile(c)
if err != nil {
return
}
}
hFont := win.HGDIOBJ(font.handleForDPI(c.DPI()))
oldHandle := win.SelectObject(c.measureTextMetafile.hdc, hFont)
if oldHandle == 0 {
err = newError("SelectObject failed")
return
}
defer win.SelectObject(c.measureTextMetafile.hdc, oldHandle)
rect := &win.RECT{
int32(bounds.X),
int32(bounds.Y),
int32(bounds.X + bounds.Width),
int32(bounds.Y + bounds.Height),
}
var params win.DRAWTEXTPARAMS
params.CbSize = uint32(unsafe.Sizeof(params))
strPtr := syscall.StringToUTF16Ptr(text)
dtfmt := uint32(format) | win.DT_EDITCONTROL | win.DT_WORDBREAK
height := win.DrawTextEx(
c.measureTextMetafile.hdc, strPtr, -1, rect, dtfmt, ¶ms)
if height == 0 {
err = newError("DrawTextEx failed")
return
}
boundsMeasured = Rectangle{
int(rect.Left),
int(rect.Top),
int(rect.Right - rect.Left),
int(height),
}
textPtr = strPtr
runesFitted = int(params.UiLengthDrawn)
return
}
================================================
FILE: checkbox.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"strconv"
"github.com/lxn/win"
)
type CheckState int
const (
CheckUnchecked CheckState = win.BST_UNCHECKED
CheckChecked CheckState = win.BST_CHECKED
CheckIndeterminate CheckState = win.BST_INDETERMINATE
)
var checkBoxCheckSize Size // in native pixels
type CheckBox struct {
Button
checkStateChangedPublisher EventPublisher
}
func NewCheckBox(parent Container) (*CheckBox, error) {
cb := new(CheckBox)
if err := InitWidget(
cb,
parent,
"BUTTON",
win.WS_TABSTOP|win.WS_VISIBLE|win.BS_AUTOCHECKBOX,
0); err != nil {
return nil, err
}
cb.Button.init()
cb.SetBackground(nullBrushSingleton)
cb.GraphicsEffects().Add(InteractionEffect)
cb.GraphicsEffects().Add(FocusEffect)
cb.MustRegisterProperty("CheckState", NewProperty(
func() interface{} {
return cb.CheckState()
},
func(v interface{}) error {
cb.SetCheckState(CheckState(assertIntOr(v, 0)))
return nil
},
cb.CheckStateChanged()))
return cb, nil
}
func (cb *CheckBox) TextOnLeftSide() bool {
return cb.hasStyleBits(win.BS_LEFTTEXT)
}
func (cb *CheckBox) SetTextOnLeftSide(textLeft bool) error {
return cb.ensureStyleBits(win.BS_LEFTTEXT, textLeft)
}
func (cb *CheckBox) setChecked(checked bool) {
cb.Button.setChecked(checked)
cb.checkStateChangedPublisher.Publish()
}
func (cb *CheckBox) Tristate() bool {
return cb.hasStyleBits(win.BS_AUTO3STATE)
}
func (cb *CheckBox) SetTristate(tristate bool) error {
var set, clear uint32
if tristate {
set, clear = win.BS_AUTO3STATE, win.BS_AUTOCHECKBOX
} else {
set, clear = win.BS_AUTOCHECKBOX, win.BS_AUTO3STATE
}
return cb.setAndClearStyleBits(set, clear)
}
func (cb *CheckBox) CheckState() CheckState {
return CheckState(cb.SendMessage(win.BM_GETCHECK, 0, 0))
}
func (cb *CheckBox) SetCheckState(state CheckState) {
if state == cb.CheckState() {
return
}
cb.SendMessage(win.BM_SETCHECK, uintptr(state), 0)
cb.checkedChangedPublisher.Publish()
cb.checkStateChangedPublisher.Publish()
}
func (cb *CheckBox) CheckStateChanged() *Event {
return cb.checkStateChangedPublisher.Event()
}
func (cb *CheckBox) SaveState() error {
return cb.WriteState(strconv.Itoa(int(cb.CheckState())))
}
func (cb *CheckBox) RestoreState() error {
s, err := cb.ReadState()
if err != nil {
return err
}
cs, err := strconv.Atoi(s)
if err != nil {
return err
}
cb.SetCheckState(CheckState(cs))
return nil
}
func (cb *CheckBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_COMMAND:
switch win.HIWORD(uint32(wParam)) {
case win.BN_CLICKED:
cb.checkedChangedPublisher.Publish()
cb.checkStateChangedPublisher.Publish()
}
}
return cb.Button.WndProc(hwnd, msg, wParam, lParam)
}
================================================
FILE: clipboard.go
================================================
// Copyright 2013 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"syscall"
"unsafe"
"github.com/lxn/win"
)
const clipboardWindowClass = `\o/ Walk_Clipboard_Class \o/`
func init() {
AppendToWalkInit(func() {
MustRegisterWindowClassWithWndProcPtr(clipboardWindowClass, syscall.NewCallback(clipboardWndProc))
hwnd := win.CreateWindowEx(
0,
syscall.StringToUTF16Ptr(clipboardWindowClass),
nil,
0,
0,
0,
0,
0,
win.HWND_MESSAGE,
0,
0,
nil)
if hwnd == 0 {
panic("failed to create clipboard window")
}
if !win.AddClipboardFormatListener(hwnd) {
lastError("AddClipboardFormatListener")
}
clipboard.hwnd = hwnd
})
}
func clipboardWndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr {
switch msg {
case win.WM_CLIPBOARDUPDATE:
clipboard.contentsChangedPublisher.Publish()
return 0
}
return win.DefWindowProc(hwnd, msg, wp, lp)
}
var clipboard ClipboardService
// Clipboard returns an object that provides access to the system clipboard.
func Clipboard() *ClipboardService {
return &clipboard
}
// ClipboardService provides access to the system clipboard.
type ClipboardService struct {
hwnd win.HWND
contentsChangedPublisher EventPublisher
}
// ContentsChanged returns an Event that you can attach to for handling
// clipboard content changes.
func (c *ClipboardService) ContentsChanged() *Event {
return c.contentsChangedPublisher.Event()
}
// Clear clears the contents of the clipboard.
func (c *ClipboardService) Clear() error {
return c.withOpenClipboard(func() error {
if !win.EmptyClipboard() {
return lastError("EmptyClipboard")
}
return nil
})
}
// ContainsText returns whether the clipboard currently contains text data.
func (c *ClipboardService) ContainsText() (available bool, err error) {
err = c.withOpenClipboard(func() error {
available = win.IsClipboardFormatAvailable(win.CF_UNICODETEXT)
return nil
})
return
}
// Text returns the current text data of the clipboard.
func (c *ClipboardService) Text() (text string, err error) {
err = c.withOpenClipboard(func() error {
hMem := win.HGLOBAL(win.GetClipboardData(win.CF_UNICODETEXT))
if hMem == 0 {
return lastError("GetClipboardData")
}
p := win.GlobalLock(hMem)
if p == nil {
return lastError("GlobalLock()")
}
defer win.GlobalUnlock(hMem)
text = win.UTF16PtrToString((*uint16)(p))
return nil
})
return
}
// SetText sets the current text data of the clipboard.
func (c *ClipboardService) SetText(s string) error {
return c.withOpenClipboard(func() error {
utf16, err := syscall.UTF16FromString(s)
if err != nil {
return err
}
hMem := win.GlobalAlloc(win.GMEM_MOVEABLE, uintptr(len(utf16)*2))
if hMem == 0 {
return lastError("GlobalAlloc")
}
p := win.GlobalLock(hMem)
if p == nil {
return lastError("GlobalLock()")
}
win.MoveMemory(p, unsafe.Pointer(&utf16[0]), uintptr(len(utf16)*2))
win.GlobalUnlock(hMem)
if 0 == win.SetClipboardData(win.CF_UNICODETEXT, win.HANDLE(hMem)) {
// We need to free hMem.
defer win.GlobalFree(hMem)
return lastError("SetClipboardData")
}
// The system now owns the memory referred to by hMem.
return nil
})
}
func (c *ClipboardService) withOpenClipboard(f func() error) error {
if !win.OpenClipboard(c.hwnd) {
return lastError("OpenClipboard")
}
defer win.CloseClipboard()
return f()
}
================================================
FILE: closeevent.go
================================================
// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
type closeEventHandlerInfo struct {
handler CloseEventHandler
once bool
}
type CloseEventHandler func(canceled *bool, reason CloseReason)
type CloseEvent struct {
handlers []closeEventHandlerInfo
}
func (e *CloseEvent) Attach(handler CloseEventHandler) int {
handlerInfo := closeEventHandlerInfo{handler, false}
for i, h := range e.handlers {
if h.handler == nil {
e.handlers[i] = handlerInfo
return i
}
}
e.handlers = append(e.handlers, handlerInfo)
return len(e.handlers) - 1
}
func (e *CloseEvent) Detach(handle int) {
e.handlers[handle].handler = nil
}
func (e *CloseEvent) Once(handler CloseEventHandler) {
i := e.Attach(handler)
e.handlers[i].once = true
}
type CloseEventPublisher struct {
event CloseEvent
}
func (p *CloseEventPublisher) Event() *CloseEvent {
return &p.event
}
func (p *CloseEventPublisher) Publish(canceled *bool, reason CloseReason) {
for i, h := range p.event.handlers {
if h.handler != nil {
h.handler(canceled, reason)
if h.once {
p.event.Detach(i)
}
}
}
}
================================================
FILE: color.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
type Color uint32
func RGB(r, g, b byte) Color {
return Color(uint32(r) | uint32(g)<<8 | uint32(b)<<16)
}
func (c Color) R() byte {
return byte(c & 0xff)
}
func (c Color) G() byte {
return byte((c >> 8) & 0xff)
}
func (c Color) B() byte {
return byte((c >> 16) & 0xff)
}
================================================
FILE: combobox.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"fmt"
"math/big"
"reflect"
"strconv"
"syscall"
"time"
"unsafe"
"github.com/lxn/win"
)
type ComboBox struct {
WidgetBase
bindingValueProvider BindingValueProvider
model ListModel
providedModel interface{}
bindingMember string
displayMember string
format string
precision int
itemsResetHandlerHandle int
itemChangedHandlerHandle int
itemsInsertedHandlerHandle int
itemsRemovedHandlerHandle int
maxItemTextWidth int // in native pixels
currentValue interface{}
prevCurIndex int
selChangeIndex int
maxLength int
currentIndexChangedPublisher EventPublisher
textChangedPublisher EventPublisher
editingFinishedPublisher EventPublisher
editOrigWndProcPtr uintptr
editing bool
persistent bool
}
var comboBoxEditWndProcPtr uintptr
func init() {
AppendToWalkInit(func() {
comboBoxEditWndProcPtr = syscall.NewCallback(comboBoxEditWndProc)
})
}
func comboBoxEditWndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
cb := (*ComboBox)(unsafe.Pointer(win.GetWindowLongPtr(hwnd, win.GWLP_USERDATA)))
switch msg {
case win.WM_GETDLGCODE:
if !cb.editing {
if form := ancestor(cb); form != nil {
if dlg, ok := form.(dialogish); ok {
if dlg.DefaultButton() != nil {
// If the ComboBox lives in a Dialog that has a
// DefaultButton, we won't swallow the return key.
break
}
}
}
}
if wParam == win.VK_RETURN {
return win.DLGC_WANTALLKEYS
}
case win.WM_KEYDOWN:
if wParam != win.VK_RETURN || 0 == cb.SendMessage(win.CB_GETDROPPEDSTATE, 0, 0) {
cb.handleKeyDown(wParam, lParam)
}
if cb.editing && wParam == win.VK_RETURN {
cb.editing = false
cb.editingFinishedPublisher.Publish()
}
case win.WM_KEYUP:
if wParam != win.VK_RETURN || 0 == cb.SendMessage(win.CB_GETDROPPEDSTATE, 0, 0) {
cb.handleKeyUp(wParam, lParam)
}
case win.WM_SETFOCUS, win.WM_KILLFOCUS:
cb.invalidateBorderInParent()
if cb.editing && msg == win.WM_KILLFOCUS {
cb.editing = false
cb.editingFinishedPublisher.Publish()
}
}
return win.CallWindowProc(cb.editOrigWndProcPtr, hwnd, msg, wParam, lParam)
}
func NewComboBox(parent Container) (*ComboBox, error) {
cb, err := newComboBoxWithStyle(parent, win.CBS_AUTOHSCROLL|win.CBS_DROPDOWN)
if err != nil {
return nil, err
}
editHwnd := win.GetWindow(cb.hWnd, win.GW_CHILD)
win.SetWindowLongPtr(editHwnd, win.GWLP_USERDATA, uintptr(unsafe.Pointer(cb)))
cb.editOrigWndProcPtr = win.SetWindowLongPtr(editHwnd, win.GWLP_WNDPROC, comboBoxEditWndProcPtr)
return cb, nil
}
func NewDropDownBox(parent Container) (*ComboBox, error) {
return newComboBoxWithStyle(parent, win.CBS_DROPDOWNLIST)
}
func newComboBoxWithStyle(parent Container, style uint32) (*ComboBox, error) {
cb := &ComboBox{prevCurIndex: -1, selChangeIndex: -1, precision: 2}
if err := InitWidget(
cb,
parent,
"COMBOBOX",
win.WS_TABSTOP|win.WS_VISIBLE|win.WS_VSCROLL|style,
0); err != nil {
return nil, err
}
succeeded := false
defer func() {
if !succeeded {
cb.Dispose()
}
}()
var event *Event
if style&win.CBS_DROPDOWNLIST == win.CBS_DROPDOWNLIST {
event = cb.CurrentIndexChanged()
} else {
event = cb.TextChanged()
}
cb.GraphicsEffects().Add(InteractionEffect)
cb.GraphicsEffects().Add(FocusEffect)
cb.MustRegisterProperty("CurrentIndex", NewProperty(
func() interface{} {
return cb.CurrentIndex()
},
func(v interface{}) error {
return cb.SetCurrentIndex(assertIntOr(v, -1))
},
cb.CurrentIndexChanged()))
cb.MustRegisterProperty("Text", NewProperty(
func() interface{} {
return cb.Text()
},
func(v interface{}) error {
return cb.SetText(assertStringOr(v, ""))
},
event))
cb.MustRegisterProperty("CurrentItem", NewReadOnlyProperty(
func() interface{} {
if rlm, ok := cb.providedModel.(ReflectListModel); ok {
if i := cb.CurrentIndex(); i > -1 {
return reflect.ValueOf(rlm.Items()).Index(i).Interface()
}
}
return nil
},
cb.CurrentIndexChanged()))
cb.MustRegisterProperty("HasCurrentItem", NewReadOnlyBoolProperty(
func() bool {
return cb.CurrentIndex() != -1
},
cb.CurrentIndexChanged()))
cb.MustRegisterProperty("TextNotEmpty", NewReadOnlyBoolProperty(
func() bool {
return cb.Text() != ""
},
cb.CurrentIndexChanged()))
cb.MustRegisterProperty("Value", NewProperty(
func() interface{} {
if cb.Editable() {
return cb.Text()
}
index := cb.CurrentIndex()
if cb.bindingValueProvider == nil || index == -1 {
return nil
}
return cb.bindingValueProvider.BindingValue(index)
},
func(v interface{}) error {
if cb.Editable() {
return cb.SetText(assertStringOr(v, ""))
}
if cb.bindingValueProvider == nil {
if cb.model == nil {
return nil
} else {
return newError("Data binding is only supported using a model that implements BindingValueProvider.")
}
}
index := -1
count := cb.model.ItemCount()
for i := 0; i < count; i++ {
if cb.bindingValueProvider.BindingValue(i) == v {
index = i
break
}
}
return cb.SetCurrentIndex(index)
},
event))
succeeded = true
return cb, nil
}
func (cb *ComboBox) applyFont(font *Font) {
cb.WidgetBase.applyFont(font)
if cb.model != nil {
cb.maxItemTextWidth = cb.calculateMaxItemTextWidth()
cb.RequestLayout()
}
}
func (cb *ComboBox) Editable() bool {
return !cb.hasStyleBits(win.CBS_DROPDOWNLIST)
}
func (cb *ComboBox) itemString(index int) string {
switch val := cb.model.Value(index).(type) {
case string:
return val
case time.Time:
return val.Format(cb.format)
case *big.Rat:
return val.FloatString(cb.precision)
default:
return fmt.Sprintf(cb.format, val)
}
panic("unreachable")
}
func (cb *ComboBox) insertItemAt(index int) error {
str := cb.itemString(index)
lp := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(str)))
if win.CB_ERR == cb.SendMessage(win.CB_INSERTSTRING, uintptr(index), lp) {
return newError("SendMessage(CB_INSERTSTRING)")
}
return nil
}
func (cb *ComboBox) removeItem(index int) error {
if win.CB_ERR == cb.SendMessage(win.CB_DELETESTRING, uintptr(index), 0) {
return newError("SendMessage(CB_DELETESTRING")
}
return nil
}
func (cb *ComboBox) resetItems() error {
cb.SetSuspended(true)
defer cb.SetSuspended(false)
cb.selChangeIndex = -1
if win.FALSE == cb.SendMessage(win.CB_RESETCONTENT, 0, 0) {
return newError("SendMessage(CB_RESETCONTENT)")
}
cb.maxItemTextWidth = 0
oldValue := cb.currentValue
if cb.model == nil {
cb.SetCurrentIndex(-1)
return nil
}
count := cb.model.ItemCount()
for i := 0; i < count; i++ {
if err := cb.insertItemAt(i); err != nil {
return err
}
}
if oldValue != nil {
cb.Property("Value").Set(oldValue)
} else {
cb.SetCurrentIndex(-1)
}
cb.RequestLayout()
return nil
}
func (cb *ComboBox) attachModel() {
itemsResetHandler := func() {
cb.resetItems()
}
cb.itemsResetHandlerHandle = cb.model.ItemsReset().Attach(itemsResetHandler)
itemChangedHandler := func(index int) {
if win.CB_ERR == cb.SendMessage(win.CB_DELETESTRING, uintptr(index), 0) {
newError("SendMessage(CB_DELETESTRING)")
}
cb.insertItemAt(index)
cb.SetCurrentIndex(cb.prevCurIndex)
}
cb.itemChangedHandlerHandle = cb.model.ItemChanged().Attach(itemChangedHandler)
cb.itemsInsertedHandlerHandle = cb.model.ItemsInserted().Attach(func(from, to int) {
for i := from; i <= to; i++ {
cb.insertItemAt(i)
}
})
cb.itemsRemovedHandlerHandle = cb.model.ItemsRemoved().Attach(func(from, to int) {
for i := to; i >= from; i-- {
cb.removeItem(i)
}
})
}
func (cb *ComboBox) detachModel() {
cb.model.ItemsReset().Detach(cb.itemsResetHandlerHandle)
cb.model.ItemChanged().Detach(cb.itemChangedHandlerHandle)
cb.model.ItemsInserted().Detach(cb.itemsInsertedHandlerHandle)
cb.model.ItemsRemoved().Detach(cb.itemsRemovedHandlerHandle)
}
// Model returns the model of the ComboBox.
func (cb *ComboBox) Model() interface{} {
return cb.providedModel
}
// SetModel sets the model of the ComboBox.
//
// It is required that mdl either implements walk.ListModel or
// walk.ReflectListModel or be a slice of pointers to struct or a []string.
func (cb *ComboBox) SetModel(mdl interface{}) error {
model, ok := mdl.(ListModel)
if !ok && mdl != nil {
var err error
if model, err = newReflectListModel(mdl); err != nil {
return err
}
if _, ok := mdl.([]string); !ok {
if badms, ok := model.(bindingAndDisplayMemberSetter); ok {
var bindingMember string
if cb.Editable() {
bindingMember = cb.displayMember
} else {
bindingMember = cb.bindingMember
}
badms.setBindingMember(bindingMember)
badms.setDisplayMember(cb.displayMember)
}
}
}
cb.providedModel = mdl
if cb.model != nil {
cb.detachModel()
}
cb.model = model
cb.bindingValueProvider, _ = model.(BindingValueProvider)
if model != nil {
cb.attachModel()
}
if err := cb.resetItems(); err != nil {
return err
}
if !cb.Editable() && model != nil && model.ItemCount() == 1 {
cb.SetCurrentIndex(0)
}
return cb.Invalidate()
}
// BindingMember returns the member from the model of the ComboBox that is bound
// to a field of the data source managed by an associated DataBinder.
//
// This is only applicable to walk.ReflectListModel models and simple slices of
// pointers to struct.
func (cb *ComboBox) BindingMember() string {
return cb.bindingMember
}
// SetBindingMember sets the member from the model of the ComboBox that is bound
// to a field of the data source managed by an associated DataBinder.
//
// This is only applicable to walk.ReflectListModel models and simple slices of
// pointers to struct.
//
// For a model consisting of items of type S, data source field of type T and
// bindingMember "Foo", this can be one of the following:
//
// A field Foo T
// A method func (s S) Foo() T
// A method func (s S) Foo() (T, error)
//
// If bindingMember is not a simple member name like "Foo", but a path to a
// member like "A.B.Foo", members "A" and "B" both must be one of the options
// mentioned above, but with T having type pointer to struct.
func (cb *ComboBox) SetBindingMember(bindingMember string) error {
if bindingMember != "" {
if _, ok := cb.providedModel.([]string); ok {
return newError("invalid for []string model")
}
}
cb.bindingMember = bindingMember
if badms, ok := cb.model.(bindingAndDisplayMemberSetter); ok {
badms.setBindingMember(bindingMember)
}
return nil
}
// DisplayMember returns the member from the model of the ComboBox that is
// displayed in the ComboBox.
//
// This is only applicable to walk.ReflectListModel models and simple slices of
// pointers to struct.
func (cb *ComboBox) DisplayMember() string {
return cb.displayMember
}
// SetDisplayMember sets the member from the model of the ComboBox that is
// displayed in the ComboBox.
//
// This is only applicable to walk.ReflectListModel models and simple slices of
// pointers to struct.
//
// For a model consisting of items of type S, the type of the specified member T
// and displayMember "Foo", this can be one of the following:
//
// A field Foo T
// A method func (s S) Foo() T
// A method func (s S) Foo() (T, error)
//
// If displayMember is not a simple member name like "Foo", but a path to a
// member like "A.B.Foo", members "A" and "B" both must be one of the options
// mentioned above, but with T having type pointer to struct.
func (cb *ComboBox) SetDisplayMember(displayMember string) error {
if displayMember != "" {
if _, ok := cb.providedModel.([]string); ok {
return newError("invalid for []string model")
}
}
cb.displayMember = displayMember
if badms, ok := cb.model.(bindingAndDisplayMemberSetter); ok {
badms.setDisplayMember(displayMember)
}
return nil
}
func (cb *ComboBox) Format() string {
return cb.format
}
func (cb *ComboBox) SetFormat(value string) {
cb.format = value
}
func (cb *ComboBox) Precision() int {
return cb.precision
}
func (cb *ComboBox) SetPrecision(value int) {
cb.precision = value
}
func (cb *ComboBox) MaxLength() int {
return cb.maxLength
}
func (cb *ComboBox) SetMaxLength(value int) {
cb.SendMessage(win.CB_LIMITTEXT, uintptr(value), 0)
cb.maxLength = value
}
// calculateMaxItemTextWidth returns maximum item text width in native pixels.
func (cb *ComboBox) calculateMaxItemTextWidth() int {
hdc := win.GetDC(cb.hWnd)
if hdc == 0 {
newError("GetDC failed")
return -1
}
defer win.ReleaseDC(cb.hWnd, hdc)
hFontOld := win.SelectObject(hdc, win.HGDIOBJ(cb.Font().handleForDPI(cb.DPI())))
defer win.SelectObject(hdc, hFontOld)
var maxWidth int
count := cb.model.ItemCount()
for i := 0; i < count; i++ {
var s win.SIZE
str := syscall.StringToUTF16(cb.itemString(i))
if !win.GetTextExtentPoint32(hdc, &str[0], int32(len(str)-1), &s) {
newError("GetTextExtentPoint32 failed")
return -1
}
maxWidth = maxi(maxWidth, int(s.CX))
}
return maxWidth
}
func (cb *ComboBox) CurrentIndex() int {
return int(int32(cb.SendMessage(win.CB_GETCURSEL, 0, 0)))
}
func (cb *ComboBox) SetCurrentIndex(value int) error {
index := int(int32(cb.SendMessage(win.CB_SETCURSEL, uintptr(value), 0)))
if index != value {
return newError("invalid index")
}
if value != cb.prevCurIndex {
if value == -1 {
cb.currentValue = nil
} else {
cb.currentValue = cb.Property("Value").Get()
}
cb.prevCurIndex = value
cb.currentIndexChangedPublisher.Publish()
}
return nil
}
func (cb *ComboBox) CurrentIndexChanged() *Event {
return cb.currentIndexChangedPublisher.Event()
}
func (cb *ComboBox) Text() string {
return cb.text()
}
func (cb *ComboBox) SetText(value string) error {
var oldText string
oldText, _ = cb.currentValue.(string)
if err := cb.setText(value); err != nil {
return err
}
if value == oldText {
return nil
}
if cb.Editable() {
cb.currentValue = value
}
cb.textChangedPublisher.Publish()
return nil
}
func (cb *ComboBox) TextSelection() (start, end int) {
cb.SendMessage(win.CB_GETEDITSEL, uintptr(unsafe.Pointer(&start)), uintptr(unsafe.Pointer(&end)))
return
}
func (cb *ComboBox) SetTextSelection(start, end int) {
cb.SendMessage(win.CB_SETEDITSEL, 0, uintptr(win.MAKELONG(uint16(start), uint16(end))))
}
func (cb *ComboBox) TextChanged() *Event {
return cb.textChangedPublisher.Event()
}
func (cb *ComboBox) EditingFinished() *Event {
return cb.editingFinishedPublisher.Event()
}
func (cb *ComboBox) Persistent() bool {
return cb.persistent
}
func (cb *ComboBox) SetPersistent(value bool) {
cb.persistent = value
}
func (cb *ComboBox) SaveState() error {
cb.WriteState(strconv.Itoa(cb.CurrentIndex()))
return nil
}
func (cb *ComboBox) RestoreState() error {
state, err := cb.ReadState()
if err != nil {
return err
}
if state == "" {
return nil
}
if i, err := strconv.Atoi(state); err == nil {
cb.SetCurrentIndex(i)
}
return nil
}
func (cb *ComboBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_COMMAND:
code := win.HIWORD(uint32(wParam))
selIndex := cb.CurrentIndex()
switch code {
case win.CBN_EDITCHANGE:
cb.editing = true
cb.selChangeIndex = -1
cb.textChangedPublisher.Publish()
case win.CBN_SELCHANGE:
cb.selChangeIndex = selIndex
cb.currentIndexChangedPublisher.Publish()
case win.CBN_SELENDCANCEL:
if cb.selChangeIndex != -1 {
if cb.selChangeIndex < cb.model.ItemCount() {
cb.SetCurrentIndex(cb.selChangeIndex)
}
cb.selChangeIndex = -1
}
case win.CBN_SELENDOK:
if editable := cb.Editable(); editable || selIndex != cb.prevCurIndex {
valueProp := cb.Property("Value")
if editable && selIndex > -1 {
valueProp.Set(cb.model.Value(selIndex))
} else {
cb.currentValue = valueProp.Get()
}
cb.currentIndexChangedPublisher.Publish()
cb.prevCurIndex = selIndex
return 0
}
cb.selChangeIndex = -1
}
case win.WM_MOUSEWHEEL:
if !cb.Enabled() {
return 0
}
case win.WM_WINDOWPOSCHANGED:
wp := (*win.WINDOWPOS)(unsafe.Pointer(lParam))
if wp.Flags&win.SWP_NOSIZE != 0 {
break
}
if cb.Editable() {
result := cb.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
cb.SetTextSelection(0, 0)
return result
}
}
return cb.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
}
func (*ComboBox) NeedsWmSize() bool {
return true
}
func (cb *ComboBox) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
var layoutFlags LayoutFlags
if cb.Editable() {
layoutFlags = GrowableHorz | GreedyHorz
} else {
layoutFlags = GrowableHorz
}
defaultSize := cb.dialogBaseUnitsToPixels(Size{30, 12})
if cb.model != nil && cb.maxItemTextWidth <= 0 {
cb.maxItemTextWidth = cb.calculateMaxItemTextWidth()
}
// FIXME: Use GetThemePartSize instead of guessing
w := maxi(defaultSize.Width, cb.maxItemTextWidth+int(win.GetSystemMetricsForDpi(win.SM_CXVSCROLL, uint32(ctx.dpi)))+8)
h := defaultSize.Height + 1
return &comboBoxLayoutItem{
layoutFlags: layoutFlags,
idealSize: Size{w, h},
}
}
type comboBoxLayoutItem struct {
LayoutItemBase
layoutFlags LayoutFlags
idealSize Size // in native pixels
}
func (li *comboBoxLayoutItem) LayoutFlags() LayoutFlags {
return li.layoutFlags
}
func (li *comboBoxLayoutItem) IdealSize() Size {
return li.idealSize
}
func (li *comboBoxLayoutItem) MinSize() Size {
return li.idealSize
}
================================================
FILE: commondialogs.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"fmt"
"path/filepath"
"syscall"
"unsafe"
)
import (
"github.com/lxn/win"
)
type FileDialog struct {
Title string
FilePath string
FilePaths []string
InitialDirPath string
Filter string
FilterIndex int
Flags uint32
ShowReadOnlyCB bool
}
func (dlg *FileDialog) show(owner Form, fun func(ofn *win.OPENFILENAME) bool, flags uint32) (accepted bool, err error) {
ofn := new(win.OPENFILENAME)
ofn.LStructSize = uint32(unsafe.Sizeof(*ofn))
if owner != nil {
ofn.HwndOwner = owner.Handle()
}
filter := make([]uint16, len(dlg.Filter)+2)
copy(filter, syscall.StringToUTF16(dlg.Filter))
// Replace '|' with the expected '\0'.
for i, c := range filter {
if byte(c) == '|' {
filter[i] = uint16(0)
}
}
ofn.LpstrFilter = &filter[0]
ofn.NFilterIndex = uint32(dlg.FilterIndex)
ofn.LpstrInitialDir = syscall.StringToUTF16Ptr(dlg.InitialDirPath)
ofn.LpstrTitle = syscall.StringToUTF16Ptr(dlg.Title)
ofn.Flags = win.OFN_FILEMUSTEXIST | flags | dlg.Flags
if !dlg.ShowReadOnlyCB {
ofn.Flags |= win.OFN_HIDEREADONLY
}
var fileBuf []uint16
if flags&win.OFN_ALLOWMULTISELECT > 0 {
fileBuf = make([]uint16, 65536)
} else {
fileBuf = make([]uint16, 1024)
copy(fileBuf, syscall.StringToUTF16(dlg.FilePath))
}
ofn.LpstrFile = &fileBuf[0]
ofn.NMaxFile = uint32(len(fileBuf))
if !fun(ofn) {
errno := win.CommDlgExtendedError()
if errno != 0 {
err = newError(fmt.Sprintf("Error %d", errno))
}
return
}
dlg.FilterIndex = int(ofn.NFilterIndex)
if flags&win.OFN_ALLOWMULTISELECT > 0 {
split := func() [][]uint16 {
var parts [][]uint16
from := 0
for i, c := range fileBuf {
if c == 0 {
if i == from {
return parts
}
parts = append(parts, fileBuf[from:i])
from = i + 1
}
}
return parts
}
parts := split()
if len(parts) == 1 {
dlg.FilePaths = []string{syscall.UTF16ToString(parts[0])}
} else {
dirPath := syscall.UTF16ToString(parts[0])
dlg.FilePaths = make([]string, len(parts)-1)
for i, fp := range parts[1:] {
dlg.FilePaths[i] = filepath.Join(dirPath, syscall.UTF16ToString(fp))
}
}
} else {
dlg.FilePath = syscall.UTF16ToString(fileBuf)
}
accepted = true
return
}
func (dlg *FileDialog) ShowOpen(owner Form) (accepted bool, err error) {
return dlg.show(owner, win.GetOpenFileName, win.OFN_NOCHANGEDIR)
}
func (dlg *FileDialog) ShowOpenMultiple(owner Form) (accepted bool, err error) {
return dlg.show(owner, win.GetOpenFileName, win.OFN_ALLOWMULTISELECT|win.OFN_EXPLORER|win.OFN_NOCHANGEDIR)
}
func (dlg *FileDialog) ShowSave(owner Form) (accepted bool, err error) {
return dlg.show(owner, win.GetSaveFileName, win.OFN_NOCHANGEDIR)
}
func pathFromPIDL(pidl uintptr) (string, error) {
var path [win.MAX_PATH]uint16
if !win.SHGetPathFromIDList(pidl, &path[0]) {
return "", newError("SHGetPathFromIDList failed")
}
return syscall.UTF16ToString(path[:]), nil
}
// We use this callback to disable the OK button in case of "invalid" selections.
func browseFolderCallback(hwnd win.HWND, msg uint32, lp, wp uintptr) uintptr {
const BFFM_SELCHANGED = 2
if msg == BFFM_SELCHANGED {
_, err := pathFromPIDL(lp)
var enabled uintptr
if err == nil {
enabled = 1
}
const BFFM_ENABLEOK = win.WM_USER + 101
win.SendMessage(hwnd, BFFM_ENABLEOK, 0, enabled)
}
return 0
}
var browseFolderCallbackPtr uintptr
func init() {
AppendToWalkInit(func() {
browseFolderCallbackPtr = syscall.NewCallback(browseFolderCallback)
})
}
func (dlg *FileDialog) ShowBrowseFolder(owner Form) (accepted bool, err error) {
// Calling OleInitialize (or similar) is required for BIF_NEWDIALOGSTYLE.
if hr := win.OleInitialize(); hr != win.S_OK && hr != win.S_FALSE {
return false, newError(fmt.Sprint("OleInitialize Error: ", hr))
}
defer win.OleUninitialize()
var ownerHwnd win.HWND
if owner != nil {
ownerHwnd = owner.Handle()
}
// We need to put the initial path into a buffer of at least MAX_LENGTH
// length, or we may get random crashes.
var buf [win.MAX_PATH]uint16
copy(buf[:], syscall.StringToUTF16(dlg.InitialDirPath))
const BIF_NEWDIALOGSTYLE = 0x00000040
bi := win.BROWSEINFO{
HwndOwner: ownerHwnd,
LpszTitle: syscall.StringToUTF16Ptr(dlg.Title),
UlFlags: BIF_NEWDIALOGSTYLE,
Lpfn: browseFolderCallbackPtr,
}
win.SHParseDisplayName(&buf[0], 0, &bi.PidlRoot, 0, nil)
pidl := win.SHBrowseForFolder(&bi)
if pidl == 0 {
return false, nil
}
defer win.CoTaskMemFree(pidl)
dlg.FilePath, err = pathFromPIDL(pidl)
accepted = dlg.FilePath != ""
return
}
================================================
FILE: composite.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"github.com/lxn/win"
)
const compositeWindowClass = `\o/ Walk_Composite_Class \o/`
func init() {
AppendToWalkInit(func() {
MustRegisterWindowClass(compositeWindowClass)
})
}
type Composite struct {
ContainerBase
}
func NewCompositeWithStyle(parent Window, style uint32) (*Composite, error) {
c := new(Composite)
c.children = newWidgetList(c)
c.SetPersistent(true)
if err := InitWidget(
c,
parent,
compositeWindowClass,
win.WS_CHILD|win.WS_VISIBLE|style,
win.WS_EX_CONTROLPARENT); err != nil {
return nil, err
}
c.SetBackground(NullBrush())
return c, nil
}
func NewComposite(parent Container) (*Composite, error) {
return NewCompositeWithStyle(parent, 0)
}
================================================
FILE: condition.go
================================================
// Copyright 2013 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
type Condition interface {
Expression
Satisfied() bool
}
type MutableCondition struct {
satisfied bool
changedPublisher EventPublisher
}
func NewMutableCondition() *MutableCondition {
return new(MutableCondition)
}
func (mc *MutableCondition) Value() interface{} {
return mc.satisfied
}
func (mc *MutableCondition) Satisfied() bool {
return mc.satisfied
}
func (mc *MutableCondition) SetSatisfied(satisfied bool) error {
if satisfied == mc.satisfied {
return nil
}
mc.satisfied = satisfied
mc.changedPublisher.Publish()
return nil
}
func (mc *MutableCondition) Changed() *Event {
return mc.changedPublisher.Event()
}
type DelegateCondition struct {
satisfied func() bool
changed *Event
}
func NewDelegateCondition(satisfied func() bool, changed *Event) *DelegateCondition {
return &DelegateCondition{satisfied, changed}
}
func (dc *DelegateCondition) Value() interface{} {
return dc.satisfied()
}
func (dc *DelegateCondition) Satisfied() bool {
return dc.satisfied()
}
func (dc *DelegateCondition) Changed() *Event {
return dc.changed
}
type compositeCondition struct {
items []Condition
itemsChangedHandles []int
changedPublisher EventPublisher
}
func (cc *compositeCondition) init(items []Condition) {
cc.items = append(cc.items, items...)
for _, item := range items {
handle := item.Changed().Attach(func() {
cc.changedPublisher.Publish()
})
cc.itemsChangedHandles = append(cc.itemsChangedHandles, handle)
}
}
func (cc *compositeCondition) satisfied(all bool) bool {
for _, item := range cc.items {
if all != item.Satisfied() {
return !all
}
}
return all
}
func (cc *compositeCondition) Changed() *Event {
return cc.changedPublisher.Event()
}
func (cc *compositeCondition) Dispose() {
for i, item := range cc.items {
item.Changed().Detach(cc.itemsChangedHandles[i])
}
}
type allCondition struct {
compositeCondition
}
func NewAllCondition(items ...Condition) Condition {
ac := new(allCondition)
ac.init(items)
return ac
}
func (ac *allCondition) Value() interface{} {
return ac.Satisfied()
}
func (ac *allCondition) Satisfied() bool {
return ac.satisfied(true)
}
type anyCondition struct {
compositeCondition
}
func NewAnyCondition(items ...Condition) Condition {
ac := new(anyCondition)
ac.init(items)
return ac
}
func (ac *anyCondition) Value() interface{} {
return ac.Satisfied()
}
func (ac *anyCondition) Satisfied() bool {
return ac.satisfied(false)
}
type negatedCondition struct {
other Condition
}
func NewNegatedCondition(other Condition) Condition {
return &negatedCondition{other}
}
func (nc *negatedCondition) Value() interface{} {
return nc.Satisfied()
}
func (nc *negatedCondition) Satisfied() bool {
return !nc.other.Satisfied()
}
func (nc *negatedCondition) Changed() *Event {
return nc.other.Changed()
}
================================================
FILE: container.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"syscall"
"time"
"unsafe"
"github.com/lxn/win"
)
type Container interface {
Window
AsContainerBase() *ContainerBase
Children() *WidgetList
Layout() Layout
SetLayout(value Layout) error
DataBinder() *DataBinder
SetDataBinder(dbm *DataBinder)
}
type ContainerBase struct {
WidgetBase
layout Layout
children *WidgetList
dataBinder *DataBinder
nextChildID int32
persistent bool
}
func (cb *ContainerBase) AsWidgetBase() *WidgetBase {
return &cb.WidgetBase
}
func (cb *ContainerBase) AsContainerBase() *ContainerBase {
return cb
}
func (cb *ContainerBase) NextChildID() int32 {
cb.nextChildID++
return cb.nextChildID
}
func (cb *ContainerBase) applyEnabled(enabled bool) {
cb.WidgetBase.applyEnabled(enabled)
applyEnabledToDescendants(cb.window.(Widget), enabled)
if InteractionEffect != nil {
for _, wb := range cb.children.items {
if wb.GraphicsEffects().Contains(InteractionEffect) {
wb.invalidateBorderInParent()
}
}
}
}
func (cb *ContainerBase) applyFont(font *Font) {
cb.WidgetBase.applyFont(font)
applyFontToDescendants(cb.window.(Widget), font)
}
func (cb *ContainerBase) ApplySysColors() {
cb.WidgetBase.ApplySysColors()
applySysColorsToDescendants(cb.window.(Widget))
}
func (cb *ContainerBase) ApplyDPI(dpi int) {
cb.WidgetBase.ApplyDPI(dpi)
applyDPIToDescendants(cb.window.(Widget), dpi)
if cb.layout != nil {
if ums, ok := cb.layout.(interface {
updateMargins()
updateSpacing()
}); ok {
ums.updateMargins()
ums.updateSpacing()
}
cb.RequestLayout()
}
}
func (cb *ContainerBase) Children() *WidgetList {
return cb.children
}
func (cb *ContainerBase) Layout() Layout {
return cb.layout
}
func (cb *ContainerBase) SetLayout(value Layout) error {
if cb.layout != value {
if cb.layout != nil {
cb.layout.SetContainer(nil)
}
cb.layout = value
if value != nil && value.Container() != Container(cb) {
value.SetContainer(cb)
}
}
return nil
}
func (cb *ContainerBase) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
return cb.layout.CreateLayoutItem(ctx)
}
func (cb *ContainerBase) DataBinder() *DataBinder {
return cb.dataBinder
}
func (cb *ContainerBase) SetDataBinder(db *DataBinder) {
if db == cb.dataBinder {
return
}
if cb.dataBinder != nil {
cb.dataBinder.SetBoundWidgets(nil)
}
cb.dataBinder = db
if db != nil {
var boundWidgets []Widget
walkDescendants(cb.window, func(w Window) bool {
if w.Handle() == cb.hWnd {
return true
}
if c, ok := w.(Container); ok && c.DataBinder() != nil {
return false
}
for _, prop := range w.AsWindowBase().name2Property {
if _, ok := prop.Source().(string); ok {
boundWidgets = append(boundWidgets, w.(Widget))
break
}
}
return true
})
db.SetBoundWidgets(boundWidgets)
}
}
func (cb *ContainerBase) forEachPersistableChild(f func(p Persistable) error) error {
if cb.children == nil {
return nil
}
for _, wb := range cb.children.items {
if persistable, ok := wb.window.(Persistable); ok && persistable.Persistent() {
if err := f(persistable); err != nil {
return err
}
}
}
return nil
}
func (cb *ContainerBase) Persistent() bool {
return cb.persistent
}
func (cb *ContainerBase) SetPersistent(value bool) {
cb.persistent = value
}
func (cb *ContainerBase) SaveState() error {
return cb.forEachPersistableChild(func(p Persistable) error {
return p.SaveState()
})
}
func (cb *ContainerBase) RestoreState() error {
return cb.forEachPersistableChild(func(p Persistable) error {
return p.RestoreState()
})
}
func (cb *ContainerBase) doPaint() error {
var ps win.PAINTSTRUCT
hdc := win.BeginPaint(cb.hWnd, &ps)
defer win.EndPaint(cb.hWnd, &ps)
canvas, err := newCanvasFromHDC(hdc)
if err != nil {
return err
}
defer canvas.Dispose()
for _, wb := range cb.children.items {
widget := wb.window.(Widget)
for _, effect := range widget.GraphicsEffects().items {
switch effect {
case InteractionEffect:
type ReadOnlyer interface {
ReadOnly() bool
}
if ro, ok := widget.(ReadOnlyer); ok {
if ro.ReadOnly() {
continue
}
}
if hwnd := widget.Handle(); !win.IsWindowEnabled(hwnd) || !win.IsWindowVisible(hwnd) {
continue
}
case FocusEffect:
continue
}
b := widget.BoundsPixels().toRECT()
win.ExcludeClipRect(hdc, b.Left, b.Top, b.Right, b.Bottom)
if err := effect.Draw(widget, canvas); err != nil {
return err
}
}
}
if FocusEffect != nil {
hwndFocused := win.GetFocus()
var widget Widget
if wnd := windowFromHandle(hwndFocused); wnd != nil {
widget, _ = wnd.(Widget)
}
for hwndFocused != 0 && (widget == nil || widget.Parent() == nil) {
hwndFocused = win.GetParent(hwndFocused)
if wnd := windowFromHandle(hwndFocused); wnd != nil {
widget, _ = wnd.(Widget)
}
}
if widget != nil && widget.Parent() != nil && widget.Parent().Handle() == cb.hWnd {
for _, effect := range widget.GraphicsEffects().items {
if effect == FocusEffect {
b := widget.BoundsPixels().toRECT()
win.ExcludeClipRect(hdc, b.Left, b.Top, b.Right, b.Bottom)
if err := FocusEffect.Draw(widget, canvas); err != nil {
return err
}
}
}
}
}
return nil
}
func (cb *ContainerBase) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_CTLCOLOREDIT, win.WM_CTLCOLORSTATIC:
if hBrush := cb.handleWMCTLCOLOR(wParam, lParam); hBrush != 0 {
return hBrush
}
case win.WM_PAINT:
if FocusEffect == nil && InteractionEffect == nil && ValidationErrorEffect == nil {
break
}
// If it fails, what can we do about it? Panic? That's extreme. So just ignore it.
_ = cb.doPaint()
return 0
case win.WM_COMMAND:
if lParam == 0 {
switch win.HIWORD(uint32(wParam)) {
case 0:
cmdId := win.LOWORD(uint32(wParam))
switch cmdId {
case win.IDOK, win.IDCANCEL:
form := ancestor(cb)
if form == nil {
break
}
dlg, ok := form.(dialogish)
if !ok {
break
}
var button *PushButton
if cmdId == win.IDOK {
button = dlg.DefaultButton()
} else {
button = dlg.CancelButton()
}
if button != nil && button.Visible() && button.Enabled() {
button.raiseClicked()
}
break
}
// Menu
actionId := uint16(win.LOWORD(uint32(wParam)))
if action, ok := actionsById[actionId]; ok {
action.raiseTriggered()
return 0
}
case 1:
// Accelerator
}
} else {
// The window that sent the notification shall handle it itself.
hwndSrc := win.GetDlgItem(cb.hWnd, int32(win.LOWORD(uint32(wParam))))
var toolBarOnly bool
if hwndSrc == 0 {
toolBarOnly = true
hwndSrc = win.HWND(lParam)
}
if window := windowFromHandle(hwndSrc); window != nil {
if _, ok := window.(*ToolBar); toolBarOnly && !ok {
break
}
window.WndProc(hwnd, msg, wParam, lParam)
return 0
}
}
case win.WM_MEASUREITEM:
mis := (*win.MEASUREITEMSTRUCT)(unsafe.Pointer(lParam))
if window := windowFromHandle(win.GetDlgItem(hwnd, int32(mis.CtlID))); window != nil {
// The window that sent the notification shall handle it itself.
return window.WndProc(hwnd, msg, wParam, lParam)
}
case win.WM_DRAWITEM:
dis := (*win.DRAWITEMSTRUCT)(unsafe.Pointer(lParam))
if window := windowFromHandle(dis.HwndItem); window != nil {
// The window that sent the notification shall handle it itself.
return window.WndProc(hwnd, msg, wParam, lParam)
}
case win.WM_NOTIFY:
nmh := (*win.NMHDR)(unsafe.Pointer(lParam))
if window := windowFromHandle(nmh.HwndFrom); window != nil {
// The window that sent the notification shall handle it itself.
return window.WndProc(hwnd, msg, wParam, lParam)
}
case win.WM_HSCROLL, win.WM_VSCROLL:
if window := windowFromHandle(win.HWND(lParam)); window != nil {
// The window that sent the notification shall handle it itself.
return window.WndProc(hwnd, msg, wParam, lParam)
}
case win.WM_WINDOWPOSCHANGED:
wp := (*win.WINDOWPOS)(unsafe.Pointer(lParam))
if wp.Flags&win.SWP_NOSIZE != 0 || cb.Layout() == nil {
break
}
if cb.background == nullBrushSingleton {
cb.Invalidate()
}
}
return cb.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
}
func (cb *ContainerBase) onInsertingWidget(index int, widget Widget) (err error) {
return nil
}
func (cb *ContainerBase) onInsertedWidget(index int, widget Widget) (err error) {
if parent := widget.Parent(); parent == nil || parent.Handle() != cb.hWnd {
if err = widget.SetParent(cb.window.(Container)); err != nil {
return
}
}
cb.RequestLayout()
widget.(applyFonter).applyFont(cb.Font())
return
}
func (cb *ContainerBase) onRemovingWidget(index int, widget Widget) (err error) {
if widget.Parent() == nil {
return
}
if widget.Parent().Handle() == cb.hWnd {
err = widget.SetParent(nil)
}
return
}
func (cb *ContainerBase) onRemovedWidget(index int, widget Widget) (err error) {
cb.RequestLayout()
return
}
func (cb *ContainerBase) onClearingWidgets() (err error) {
for i := cb.children.Len() - 1; i >= 0; i-- {
widget := cb.children.At(i)
if parent := widget.Parent(); parent != nil && parent.Handle() == cb.hWnd {
if err = widget.SetParent(nil); err != nil {
return
}
}
}
return
}
func (cb *ContainerBase) onClearedWidgets() (err error) {
cb.RequestLayout()
return
}
func (cb *ContainerBase) focusFirstCandidateDescendant() {
window := firstFocusableDescendant(cb)
if window == nil {
return
}
if err := window.SetFocus(); err != nil {
return
}
if textSel, ok := window.(textSelectable); ok {
time.AfterFunc(time.Millisecond, func() {
window.Synchronize(func() {
if window.Focused() {
textSel.SetTextSelection(0, -1)
}
})
})
}
}
func firstFocusableDescendantCallback(hwnd win.HWND, lParam uintptr) uintptr {
if !win.IsWindowVisible(hwnd) || !win.IsWindowEnabled(hwnd) {
return 1
}
if win.GetWindowLong(hwnd, win.GWL_STYLE)&win.WS_TABSTOP > 0 {
if rb, ok := windowFromHandle(hwnd).(radioButtonish); ok {
if !rb.radioButton().Checked() {
return 1
}
}
hwndPtr := (*win.HWND)(unsafe.Pointer(lParam))
*hwndPtr = hwnd
return 0
}
return 1
}
var firstFocusableDescendantCallbackPtr uintptr
func init() {
AppendToWalkInit(func() {
firstFocusableDescendantCallbackPtr = syscall.NewCallback(firstFocusableDescendantCallback)
})
}
func firstFocusableDescendant(container Container) Window {
var hwnd win.HWND
win.EnumChildWindows(container.Handle(), firstFocusableDescendantCallbackPtr, uintptr(unsafe.Pointer(&hwnd)))
window := windowFromHandle(hwnd)
for hwnd != 0 && window == nil {
hwnd = win.GetParent(hwnd)
window = windowFromHandle(hwnd)
}
return window
}
type textSelectable interface {
SetTextSelection(start, end int)
}
func DescendantByName(container Container, name string) Widget {
var widget Widget
walkDescendants(container.AsContainerBase(), func(w Window) bool {
if w.Name() == name {
widget = w.(Widget)
return false
}
return true
})
if widget == nil {
return nil
}
return widget
}
================================================
FILE: cursor.go
================================================
// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"image"
)
import (
"github.com/lxn/win"
)
type Cursor interface {
Dispose()
handle() win.HCURSOR
}
type stockCursor struct {
hCursor win.HCURSOR
}
func (sc stockCursor) Dispose() {
// nop
}
func (sc stockCursor) handle() win.HCURSOR {
return sc.hCursor
}
func CursorArrow() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_ARROW))}
}
func CursorIBeam() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_IBEAM))}
}
func CursorWait() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_WAIT))}
}
func CursorCross() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_CROSS))}
}
func CursorUpArrow() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_UPARROW))}
}
func CursorSizeNWSE() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZENWSE))}
}
func CursorSizeNESW() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZENESW))}
}
func CursorSizeWE() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZEWE))}
}
func CursorSizeNS() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZENS))}
}
func CursorSizeAll() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZEALL))}
}
func CursorNo() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_NO))}
}
func CursorHand() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_HAND))}
}
func CursorAppStarting() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_APPSTARTING))}
}
func CursorHelp() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_HELP))}
}
func CursorIcon() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_ICON))}
}
func CursorSize() Cursor {
return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZE))}
}
type customCursor struct {
hCursor win.HCURSOR
}
func NewCursorFromImage(im image.Image, hotspot image.Point) (Cursor, error) {
i, err := createAlphaCursorOrIconFromImage(im, hotspot, false)
if err != nil {
return nil, err
}
return customCursor{win.HCURSOR(i)}, nil
}
func (cc customCursor) Dispose() {
win.DestroyIcon(win.HICON(cc.hCursor))
}
func (cc customCursor) handle() win.HCURSOR {
return cc.hCursor
}
================================================
FILE: customwidget.go
================================================
// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"unsafe"
"github.com/lxn/win"
)
const customWidgetWindowClass = `\o/ Walk_CustomWidget_Class \o/`
func init() {
AppendToWalkInit(func() {
MustRegisterWindowClass(customWidgetWindowClass)
})
}
// PaintFunc paints custom widget content. updateBounds is specified in 1/96" or native pixels.
type PaintFunc func(canvas *Canvas, updateBounds Rectangle) error
type PaintMode int
const (
PaintNormal PaintMode = iota // erase background before PaintFunc
PaintNoErase // PaintFunc clears background, single buffered
PaintBuffered // PaintFunc clears background, double buffered
)
type CustomWidget struct {
WidgetBase
paint PaintFunc // in 1/96" units
paintPixels PaintFunc // in native pixels
invalidatesOnResize bool
paintMode PaintMode
}
// NewCustomWidget creates and initializes a new custom draw widget.
//
// Deprecated: PaintFunc is taking updateBounds parameter at 96dpi for backward compatibility with
// clients. On high-DPI displays this is too sparse and may incur a thin unpainted edge around
// control due to rounding errors. Newer applications should use NewCustomWidgetPixels.
func NewCustomWidget(parent Container, style uint, paint PaintFunc) (*CustomWidget, error) {
cw := &CustomWidget{paint: paint}
err := cw.init(parent, style)
if err != nil {
return nil, err
}
return cw, nil
}
// NewCustomWidgetPixels creates and initializes a new custom draw widget.
func NewCustomWidgetPixels(parent Container, style uint, paintPixels PaintFunc) (*CustomWidget, error) {
cw := &CustomWidget{paintPixels: paintPixels}
err := cw.init(parent, style)
if err != nil {
return nil, err
}
return cw, nil
}
func (cw *CustomWidget) init(parent Container, style uint) error {
if err := InitWidget(
cw,
parent,
customWidgetWindowClass,
win.WS_VISIBLE|uint32(style),
0); err != nil {
return err
}
return nil
}
// deprecated, use PaintMode
func (cw *CustomWidget) ClearsBackground() bool {
return cw.paintMode != PaintNormal
}
// deprecated, use SetPaintMode
func (cw *CustomWidget) SetClearsBackground(value bool) {
if value != cw.ClearsBackground() {
if value {
cw.paintMode = PaintNormal
} else {
cw.paintMode = PaintNoErase
}
}
}
func (cw *CustomWidget) InvalidatesOnResize() bool {
return cw.invalidatesOnResize
}
func (cw *CustomWidget) SetInvalidatesOnResize(value bool) {
cw.invalidatesOnResize = value
}
func (cw *CustomWidget) PaintMode() PaintMode {
return cw.paintMode
}
func (cw *CustomWidget) SetPaintMode(value PaintMode) {
cw.paintMode = value
}
func (cw *CustomWidget) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_PAINT:
if cw.paint == nil && cw.paintPixels == nil {
newError("paint(Pixels) func is nil")
break
}
var ps win.PAINTSTRUCT
var hdc win.HDC
if wParam == 0 {
hdc = win.BeginPaint(cw.hWnd, &ps)
} else {
hdc = win.HDC(wParam)
}
if hdc == 0 {
newError("BeginPaint failed")
break
}
defer func() {
if wParam == 0 {
win.EndPaint(cw.hWnd, &ps)
}
}()
canvas, err := newCanvasFromHDC(hdc)
if err != nil {
newError("newCanvasFromHDC failed")
break
}
defer canvas.Dispose()
bounds := rectangleFromRECT(ps.RcPaint)
if cw.paintMode == PaintBuffered {
err = cw.bufferedPaint(canvas, bounds)
} else if cw.paintPixels != nil {
err = cw.paintPixels(canvas, bounds)
} else {
err = cw.paint(canvas, RectangleTo96DPI(bounds, cw.DPI()))
}
if err != nil {
newError("paint failed")
break
}
return 0
case win.WM_ERASEBKGND:
if cw.paintMode != PaintNormal {
return 1
}
case win.WM_PRINTCLIENT:
win.SendMessage(hwnd, win.WM_PAINT, wParam, lParam)
case win.WM_WINDOWPOSCHANGED:
wp := (*win.WINDOWPOS)(unsafe.Pointer(lParam))
if wp.Flags&win.SWP_NOSIZE != 0 {
break
}
if cw.invalidatesOnResize {
cw.Invalidate()
}
}
return cw.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
}
// bufferedPaint draws widget on a memory buffer. updateBounds are in native pixels.
func (cw *CustomWidget) bufferedPaint(canvas *Canvas, updateBounds Rectangle) error {
hdc := win.CreateCompatibleDC(canvas.hdc)
if hdc == 0 {
return newError("CreateCompatibleDC failed")
}
defer win.DeleteDC(hdc)
buffered := Canvas{hdc: hdc, doNotDispose: true}
if _, err := buffered.init(); err != nil {
return err
}
w, h := int32(updateBounds.Width), int32(updateBounds.Height)
if w < 1 {
w = 1
}
if h < 1 {
h = 1
}
hbmp := win.CreateCompatibleBitmap(canvas.hdc, w, h)
if hbmp == 0 {
return lastError("CreateCompatibleBitmap failed")
}
defer win.DeleteObject(win.HGDIOBJ(hbmp))
oldbmp := win.SelectObject(buffered.hdc, win.HGDIOBJ(hbmp))
if oldbmp == 0 {
return newError("SelectObject failed")
}
defer win.SelectObject(buffered.hdc, oldbmp)
win.SetViewportOrgEx(buffered.hdc, -int32(updateBounds.X), -int32(updateBounds.Y), nil)
win.SetBrushOrgEx(buffered.hdc, -int32(updateBounds.X), -int32(updateBounds.Y), nil)
var err error
if cw.paintPixels != nil {
err = cw.paintPixels(&buffered, updateBounds)
} else {
err = cw.paint(&buffered, RectangleTo96DPI(updateBounds, cw.DPI()))
}
if !win.BitBlt(canvas.hdc,
int32(updateBounds.X), int32(updateBounds.Y), w, h,
buffered.hdc,
int32(updateBounds.X), int32(updateBounds.Y), win.SRCCOPY) {
return lastError("buffered BitBlt failed")
}
return err
}
func (*CustomWidget) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
return NewGreedyLayoutItem()
}
================================================
FILE: databinding.go
================================================
// Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"errors"
"fmt"
"reflect"
"strings"
"time"
)
var (
errValidationFailed = errors.New("validation failed")
)
type ErrorPresenter interface {
PresentError(err error, widget Widget)
}
type DataBinder struct {
dataSource interface{}
boundWidgets []Widget
properties []Property
property2Widget map[Property]Widget
property2ChangedHandle map[Property]int
rootExpression Expression
path2Expression map[string]Expression
errorPresenter ErrorPresenter
dataSourceChangedPublisher EventPublisher
canSubmitChangedPublisher EventPublisher
submittedPublisher EventPublisher
resetPublisher EventPublisher
autoSubmitDelay time.Duration
autoSubmitTimer *time.Timer
autoSubmit bool
autoSubmitSuspended bool
canSubmit bool
inReset bool
dirty bool
}
func NewDataBinder() *DataBinder {
db := new(DataBinder)
db.rootExpression = &dataBinderRootExpression{db}
return db
}
func (db *DataBinder) AutoSubmit() bool {
return db.autoSubmit
}
func (db *DataBinder) SetAutoSubmit(autoSubmit bool) {
db.autoSubmit = autoSubmit
if autoSubmit {
db.canSubmit = true
}
}
func (db *DataBinder) AutoSubmitDelay() time.Duration {
return db.autoSubmitDelay
}
func (db *DataBinder) SetAutoSubmitDelay(delay time.Duration) {
db.autoSubmitDelay = delay
}
func (db *DataBinder) AutoSubmitSuspended() bool {
return db.autoSubmitSuspended
}
func (db *DataBinder) SetAutoSubmitSuspended(suspended bool) {
if suspended == db.autoSubmitSuspended {
return
}
db.autoSubmitSuspended = suspended
if suspended {
if db.autoSubmitTimer != nil {
db.autoSubmitTimer.Stop()
}
} else {
db.Submit()
}
}
func (db *DataBinder) Submitted() *Event {
return db.submittedPublisher.Event()
}
func (db *DataBinder) DataSource() interface{} {
return db.dataSource
}
func (db *DataBinder) SetDataSource(dataSource interface{}) error {
if kind := reflect.ValueOf(dataSource).Kind(); kind != reflect.Func && kind != reflect.Map && kind != reflect.Slice &&
kind == reflect.ValueOf(db.dataSource).Kind() && dataSource == db.dataSource {
return nil
}
if dataSource != nil {
if t := reflect.TypeOf(dataSource); t.Kind() != reflect.Map && (t.Kind() != reflect.Ptr || t.Elem().Kind() != reflect.Struct) {
return newError("dataSource must be pointer to struct or map[string]interface{}")
}
}
db.dataSource = dataSource
db.dataSourceChangedPublisher.Publish()
return nil
}
type dataBinderRootExpression struct {
db *DataBinder
}
func (dbre *dataBinderRootExpression) Value() interface{} {
return dbre.db.dataSource
}
func (dbre *dataBinderRootExpression) Changed() *Event {
return dbre.db.resetPublisher.Event()
}
func (db *DataBinder) DataSourceChanged() *Event {
return db.dataSourceChangedPublisher.Event()
}
func (db *DataBinder) BoundWidgets() []Widget {
return db.boundWidgets
}
func (db *DataBinder) SetBoundWidgets(boundWidgets []Widget) {
for prop, handle := range db.property2ChangedHandle {
prop.Changed().Detach(handle)
}
db.boundWidgets = boundWidgets
db.property2Widget = make(map[Property]Widget)
db.property2ChangedHandle = make(map[Property]int)
for _, widget := range boundWidgets {
widget := widget
for _, prop := range widget.AsWindowBase().name2Property {
prop := prop
if _, ok := prop.Source().(string); !ok {
continue
}
db.properties = append(db.properties, prop)
db.property2Widget[prop] = widget
db.property2ChangedHandle[prop] = prop.Changed().Attach(func() {
db.dirty = true
if db.autoSubmit && !db.autoSubmitSuspended {
if db.autoSubmitDelay > 0 {
if db.autoSubmitTimer == nil {
db.autoSubmitTimer = time.AfterFunc(db.autoSubmitDelay, func() {
widget.Synchronize(func() {
db.Submit()
})
})
} else {
db.autoSubmitTimer.Reset(db.autoSubmitDelay)
}
} else {
v := reflect.ValueOf(db.dataSource)
field := db.fieldBoundToProperty(v, prop)
if field == nil {
return
}
if err := db.submitProperty(prop, field); err != nil {
return
}
db.submittedPublisher.Publish()
}
} else {
if !db.inReset {
db.validateProperties()
}
}
})
}
}
}
func (db *DataBinder) Expression(path string) Expression {
if db.path2Expression == nil {
db.path2Expression = make(map[string]Expression)
}
if prop, ok := db.path2Expression[path]; ok {
return prop
}
expr := NewReflectExpression(db.rootExpression, path)
db.path2Expression[path] = expr
return expr
}
func (db *DataBinder) validateProperties() {
var hasError bool
for _, prop := range db.properties {
validator := prop.Validator()
if validator == nil {
continue
}
err := validator.Validate(prop.Get())
if err != nil {
hasError = true
}
if db.errorPresenter != nil {
widget := db.property2Widget[prop]
db.errorPresenter.PresentError(err, widget)
}
}
if hasError == db.canSubmit {
db.canSubmit = !hasError
db.canSubmitChangedPublisher.Publish()
}
}
func (db *DataBinder) ErrorPresenter() ErrorPresenter {
return db.errorPresenter
}
func (db *DataBinder) SetErrorPresenter(ep ErrorPresenter) {
db.errorPresenter = ep
}
func (db *DataBinder) CanSubmit() bool {
return db.canSubmit
}
func (db *DataBinder) CanSubmitChanged() *Event {
return db.canSubmitChangedPublisher.Event()
}
func (db *DataBinder) Reset() error {
db.inReset = true
defer func() {
db.inReset = false
}()
if err := db.forEach(func(prop Property, field DataField) error {
if f64, ok := prop.Get().(float64); ok {
switch v := field.Get().(type) {
case float32:
f64 = float64(v)
case float64:
f64 = v
case int:
f64 = float64(v)
case int8:
f64 = float64(v)
case int16:
f64 = float64(v)
case int32:
f64 = float64(v)
case int64:
f64 = float64(v)
case uint:
f64 = float64(v)
case uint8:
f64 = float64(v)
case uint16:
f64 = float64(v)
case uint32:
f64 = float64(v)
case uint64:
f64 = float64(v)
case uintptr:
f64 = float64(v)
default:
return newError(fmt.Sprintf("Field '%s': Can't convert %T to float64.", prop.Source().(string), field.Get()))
}
if err := prop.Set(f64); err != nil {
return err
}
} else {
if err := prop.Set(field.Get()); err != nil {
return err
}
}
return nil
}); err != nil {
return err
}
db.validateProperties()
db.dirty = false
db.resetPublisher.Publish()
return nil
}
func (db *DataBinder) ResetFinished() *Event {
return db.resetPublisher.Event()
}
func (db *DataBinder) Submit() error {
if !db.CanSubmit() {
return errValidationFailed
}
if err := db.forEach(func(prop Property, field DataField) error {
return db.submitProperty(prop, field)
}); err != nil {
return err
}
db.dirty = false
db.submittedPublisher.Publish()
return nil
}
func (db *DataBinder) Dirty() bool {
return db.dirty
}
func (db *DataBinder) submitProperty(prop Property, field DataField) error {
if !field.CanSet() {
// FIXME: handle properly
return nil
}
value := prop.Get()
if value == nil {
if _, ok := db.property2Widget[prop].(*RadioButton); ok {
return nil
}
return field.Set(field.Zero())
}
if err, ok := value.(error); ok {
return err
}
return field.Set(value)
}
func (db *DataBinder) forEach(f func(prop Property, field DataField) error) error {
dsv := reflect.ValueOf(db.dataSource)
if dsv.Kind() == reflect.Ptr && dsv.IsNil() {
return nil
}
for _, prop := range db.properties {
// if widget := db.property2Widget[prop]; !widget.Visible() {
// continue
// }
field := db.fieldBoundToProperty(dsv, prop)
if field == nil {
continue
}
if err := f(prop, field); err != nil {
return err
}
}
return nil
}
func (db *DataBinder) fieldBoundToProperty(v reflect.Value, prop Property) DataField {
if db.dataSource == nil {
return nilField{prop: prop}
}
source, ok := prop.Source().(string)
if !ok || source == "" {
return nil
}
f, err := dataFieldFromPath(v, source)
if err != nil {
panic(fmt.Sprintf("invalid source '%s'", source))
}
return f
}
func validateBindingMemberSyntax(member string) error {
// FIXME
return nil
}
type DataField interface {
CanSet() bool
Get() interface{}
Set(interface{}) error
Zero() interface{}
}
func dataFieldFromPath(root reflect.Value, path string) (DataField, error) {
parent, value, err := reflectValueFromPath(root, path)
if err != nil {
return nil, err
}
// convert to DataField
if i, ok := value.Interface().(DataField); ok {
return i, nil
}
return &reflectField{parent: parent, value: value, key: path[strings.LastIndexByte(path, '.')+1:]}, nil
}
func reflectValueFromPath(root reflect.Value, path string) (parent, value reflect.Value, err error) {
fullPath := path
value = root
for path != "" {
var name string
name, path = nextPathPart(path)
var p reflect.Value
for value.Kind() == reflect.Interface || value.Kind() == reflect.Ptr {
p = value
value = value.Elem()
}
switch value.Kind() {
case reflect.Map:
parent = value
value = value.MapIndex(reflect.ValueOf(name))
case reflect.Struct:
parent = value
var fun reflect.Value
// Try as field first.
if f := value.FieldByName(name); f.IsValid() {
switch f.Kind() {
case reflect.Func:
fun = f
case reflect.Interface:
if fn := f.Elem(); fn.Kind() == reflect.Func {
fun = fn
} else {
value = f
}
default:
value = f
}
} else {
// No field, so let's see if we got a method.
if p.IsValid() {
// Try pointer receiver first.
fun = p.MethodByName(name)
}
if !fun.IsValid() {
// No pointer, try directly.
fun = value.MethodByName(name)
}
if !fun.IsValid() {
return parent, value, fmt.Errorf("bad member: '%s', path: '%s'", path, fullPath)
}
}
if fun.IsValid() {
// We assume it takes no args and returns one mandatory value plus
// maybe an error.
rvs := fun.Call(nil)
switch len(rvs) {
case 1:
value = rvs[0]
case 2:
rv2 := rvs[1].Interface()
if err, ok := rv2.(error); ok {
return parent, value, err
} else if rv2 != nil {
return parent, value, fmt.Errorf("Second method return value must implement error.")
}
value = rvs[0]
default:
return parent, value, fmt.Errorf("Method must return a value plus optionally an error: %s", name)
}
}
}
}
return parent, value, nil
}
func nextPathPart(p string) (next, remaining string) {
for i, r := range p {
if r == '.' {
return p[:i], p[i+1:]
}
}
return p, ""
}
type nilField struct {
prop Property
}
func (nilField) CanSet() bool {
return false
}
func (f nilField) Get() interface{} {
return f.Zero()
}
func (nilField) Set(interface{}) error {
return nil
}
func (f nilField) Zero() interface{} {
return reflect.Zero(reflect.TypeOf(f.prop.Get())).Interface()
}
type reflectField struct {
parent reflect.Value
value reflect.Value
key string
}
func (f *reflectField) CanSet() bool {
if f.parent.IsValid() && f.parent.Kind() == reflect.Map {
return true
}
return f.value.CanSet()
}
func (f *reflectField) Get() interface{} {
return f.value.Interface()
}
func (f *reflectField) Set(value interface{}) error {
if f.parent.IsValid() && f.parent.Kind() == reflect.Map {
f.parent.SetMapIndex(reflect.ValueOf(f.key), reflect.ValueOf(value))
return nil
}
if f64, ok := value.(float64); ok {
switch f.value.Kind() {
case reflect.Float32, reflect.Float64:
f.value.SetFloat(f64)
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
f.value.SetInt(int64(f64))
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
f.value.SetUint(uint64(f64))
default:
return newError(fmt.Sprintf("Can't convert float64 to %s.", f.value.Type().Name()))
}
return nil
}
f.value.Set(reflect.ValueOf(value))
return nil
}
func (f *reflectField) Zero() interface{} {
return reflect.Zero(f.value.Type()).Interface()
}
================================================
FILE: dateedit.go
================================================
// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"strings"
"syscall"
"time"
"unsafe"
"github.com/lxn/win"
)
type DateEdit struct {
WidgetBase
dateChangedPublisher EventPublisher
format string
}
func newDateEdit(parent Container, style uint32) (*DateEdit, error) {
de := new(DateEdit)
if err := InitWidget(
de,
parent,
"SysDateTimePick32",
win.WS_TABSTOP|win.WS_VISIBLE|win.DTS_SHORTDATEFORMAT|style,
0); err != nil {
return nil, err
}
if style&win.DTS_SHOWNONE != 0 {
de.setSystemTime(nil)
}
de.GraphicsEffects().Add(InteractionEffect)
de.GraphicsEffects().Add(FocusEffect)
de.MustRegisterProperty("Date", NewProperty(
func() interface{} {
return de.Date()
},
func(v interface{}) error {
return de.SetDate(assertTimeOr(v, time.Time{}))
},
de.dateChangedPublisher.Event()))
return de, nil
}
func NewDateEdit(parent Container) (*DateEdit, error) {
return newDateEdit(parent, 0)
}
func NewDateEditWithNoneOption(parent Container) (*DateEdit, error) {
return newDateEdit(parent, win.DTS_SHOWNONE)
}
func (de *DateEdit) systemTimeToTime(st *win.SYSTEMTIME) time.Time {
if st == nil || !de.hasStyleBits(win.DTS_SHOWNONE) && st.WYear == 1601 && st.WMonth == 1 && st.WDay == 1 {
return time.Time{}
}
var hour, minute, second int
if de.timeOfDayDisplayed() {
hour = int(st.WHour)
minute = int(st.WMinute)
second = int(st.WSecond)
}
return time.Date(int(st.WYear), time.Month(st.WMonth), int(st.WDay), hour, minute, second, 0, time.Local)
}
func (de *DateEdit) timeToSystemTime(t time.Time) *win.SYSTEMTIME {
if t.Year() < 1601 {
if de.hasStyleBits(win.DTS_SHOWNONE) {
return nil
} else {
return &win.SYSTEMTIME{
WYear: uint16(1601),
WMonth: uint16(1),
WDay: uint16(1),
}
}
}
st := &win.SYSTEMTIME{
WYear: uint16(t.Year()),
WMonth: uint16(t.Month()),
WDay: uint16(t.Day()),
}
if de.timeOfDayDisplayed() {
st.WHour = uint16(t.Hour())
st.WMinute = uint16(t.Minute())
st.WSecond = uint16(t.Second())
}
return st
}
func (de *DateEdit) systemTime() (*win.SYSTEMTIME, error) {
var st win.SYSTEMTIME
switch de.SendMessage(win.DTM_GETSYSTEMTIME, 0, uintptr(unsafe.Pointer(&st))) {
case win.GDT_VALID:
return &st, nil
case win.GDT_NONE:
return nil, nil
}
return nil, newError("SendMessage(DTM_GETSYSTEMTIME)")
}
func (de *DateEdit) setSystemTime(st *win.SYSTEMTIME) error {
var wParam uintptr
if st != nil {
wParam = win.GDT_VALID
} else {
// Ensure today's date is displayed.
de.setSystemTime(de.timeToSystemTime(time.Now()))
wParam = win.GDT_NONE
}
if 0 == de.SendMessage(win.DTM_SETSYSTEMTIME, wParam, uintptr(unsafe.Pointer(st))) {
return newError("SendMessage(DTM_SETSYSTEMTIME)")
}
return nil
}
func (de *DateEdit) timeOfDayDisplayed() bool {
return strings.ContainsAny(de.format, "Hhms")
}
func (de *DateEdit) Format() string {
return de.format
}
func (de *DateEdit) SetFormat(format string) error {
lp := uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(format)))
if 0 == de.SendMessage(win.DTM_SETFORMAT, 0, lp) {
return newError("DTM_SETFORMAT failed")
}
de.format = format
return nil
}
func (de *DateEdit) Range() (min, max time.Time) {
var st [2]win.SYSTEMTIME
ret := de.SendMessage(win.DTM_GETRANGE, 0, uintptr(unsafe.Pointer(&st[0])))
if ret&win.GDTR_MIN > 0 {
min = de.systemTimeToTime(&st[0])
}
if ret&win.GDTR_MAX > 0 {
max = de.systemTimeToTime(&st[1])
}
return
}
func (de *DateEdit) SetRange(min, max time.Time) error {
if !min.IsZero() && !max.IsZero() {
if min.Year() > max.Year() ||
min.Year() == max.Year() && min.Month() > max.Month() ||
min.Year() == max.Year() && min.Month() == max.Month() && min.Day() > max.Day() {
return newError("invalid range")
}
}
var st [2]win.SYSTEMTIME
var wParam uintptr
if !min.IsZero() {
wParam |= win.GDTR_MIN
st[0] = *de.timeToSystemTime(min)
}
if !max.IsZero() {
wParam |= win.GDTR_MAX
st[1] = *de.timeToSystemTime(max)
}
if 0 == de.SendMessage(win.DTM_SETRANGE, wParam, uintptr(unsafe.Pointer(&st[0]))) {
return newError("SendMessage(DTM_SETRANGE)")
}
return nil
}
func (de *DateEdit) Date() time.Time {
st, err := de.systemTime()
if err != nil || st == nil {
return time.Time{}
}
return de.systemTimeToTime(st)
}
func (de *DateEdit) SetDate(date time.Time) error {
stNew := de.timeToSystemTime(date)
stOld, err := de.systemTime()
if err != nil {
return err
} else if stNew == stOld || stNew != nil && stOld != nil && *stNew == *stOld {
return nil
}
if err := de.setSystemTime(stNew); err != nil {
return err
}
de.dateChangedPublisher.Publish()
return nil
}
func (de *DateEdit) DateChanged() *Event {
return de.dateChangedPublisher.Event()
}
func (de *DateEdit) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) uintptr {
switch msg {
case win.WM_NOTIFY:
switch uint32(((*win.NMHDR)(unsafe.Pointer(lParam))).Code) {
case win.DTN_DATETIMECHANGE:
de.dateChangedPublisher.Publish()
}
}
return de.WidgetBase.WndProc(hwnd, msg, wParam, lParam)
}
func (*DateEdit) NeedsWmSize() bool {
return true
}
func (de *DateEdit) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
return &dateEditLayoutItem{
idealSize: de.dialogBaseUnitsToPixels(Size{80, 12}),
}
}
type dateEditLayoutItem struct {
LayoutItemBase
idealSize Size // in native pixels
}
func (*dateEditLayoutItem) LayoutFlags() LayoutFlags {
return GrowableHorz
}
func (li *dateEditLayoutItem) IdealSize() Size {
return li.idealSize
}
func (li *dateEditLayoutItem) MinSize() Size {
return li.idealSize
}
================================================
FILE: datelabel.go
================================================
// Copyright 2018 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package walk
import (
"time"
)
type DateLabel struct {
static
date time.Time
dateChangedPublisher EventPublisher
format string
formatChangedPublisher EventPublisher
}
func NewDateLabel(parent Container) (*DateLabel, error) {
dl := new(DateLabel)
if err := dl.init(dl, parent, 0); err != nil {
return nil, err
}
dl.SetTextAlignment(AlignFar)
if _, err := dl.updateText(); err != nil {
return nil, err
}
dl.MustRegisterProperty("Date", NewProperty(
func() interface{} {
return dl.Date()
},
func(v interface{}) error {
return dl.SetDate(assertTimeOr(v, time.Time{}))
},
dl.dateChangedPublisher.Event()))
dl.MustRegisterProperty("Format", NewProperty(
func() interface{} {
return dl.Format()
},
func(v interface{}) error {
return dl.SetFormat(assertStringOr(v, ""))
},
dl.formatChangedPublisher.Event()))
return dl, nil
}
func (dl *DateLabel) asStatic() *static {
return &dl.static
}
func (dl *DateLabel) TextAlignment() Alignment1D {
return dl.textAlignment1D()
}
func (dl *DateLabel) SetTextAlignment(alignment Alignment1D) error {
if alignment == AlignDefault {
alignment = AlignNear
}
return dl.setTextAlignment1D(alignment)
}
func (dl *DateLabel) Date() time.Time {
return dl.date
}
func (dl *DateLabel) SetDate(date time.Time) error {
if date == dl.date {
return nil
}
old := dl.date
dl.date = date
if _, err := dl.updateText(); err != nil {
dl.date = old
return err
}
dl.dateChangedPublisher.Publish()
return nil
}
func (dl *DateLabel) Format() string {
return dl.format
}
func (dl *DateLabel) SetFormat(format string) error {
if format == dl.format {
return nil
}
old := dl.format
dl.format = format
if _, err := dl.updateText(); err != nil {
dl.format = old
return err
}
dl.formatChangedPublisher.Publish()
return nil
}
func (dl *DateLabel) updateText() (changed bool, err error) {
return dl.setText(dl.date.Format(dl.format))
}
================================================
FILE: declarative/accessibility.go
================================================
// Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package declarative
import (
"github.com/lxn/walk"
)
// AccState enum defines the state of the window/control
type AccState int32
// Window/control states
const (
AccStateNormal = AccState(walk.AccStateNormal)
AccStateUnavailable = AccState(walk.AccStateUnavailable)
AccStateSelected = AccState(walk.AccStateSelected)
AccStateFocused = AccState(walk.AccStateFocused)
AccStatePressed = AccState(walk.AccStatePressed)
AccStateChecked = AccState(walk.AccStateChecked)
AccStateMixed = AccState(walk.AccStateMixed)
AccStateIndeterminate = AccState(walk.AccStateIndeterminate)
AccStateReadonly = AccState(walk.AccStateReadonly)
AccStateHotTracked = AccState(walk.AccStateHotTracked)
AccStateDefault = AccState(walk.AccStateDefault)
AccStateExpanded = AccState(walk.AccStateExpanded)
AccStateCollapsed = AccState(walk.AccStateCollapsed)
AccStateBusy = AccState(walk.AccStateBusy)
AccStateFloating = AccState(walk.AccStateFloating)
AccStateMarqueed = AccState(walk.AccStateMarqueed)
AccStateAnimated = AccState(walk.AccStateAnimated)
AccStateInvisible = AccState(walk.AccStateInvisible)
AccStateOffscreen = AccState(walk.AccStateOffscreen)
AccStateSizeable = AccState(walk.AccStateSizeable)
AccStateMoveable = AccState(walk.AccStateMoveable)
AccStateSelfVoicing = AccState(walk.AccStateSelfVoicing)
AccStateFocusable = AccState(walk.AccStateFocusable)
AccStateSelectable = AccState(walk.AccStateSelectable)
AccStateLinked = AccState(walk.AccStateLinked)
AccStateTraversed = AccState(walk.AccStateTraversed)
AccStateMultiselectable = AccState(walk.AccStateMultiselectable)
AccStateExtselectable = AccState(walk.AccStateExtselectable)
AccStateAlertLow = AccState(walk.AccStateAlertLow)
AccStateAlertMedium = AccState(walk.AccStateAlertMedium)
AccStateAlertHigh = AccState(walk.AccStateAlertHigh)
AccStateProtected = AccState(walk.AccStateProtected)
AccStateHasPopup = AccState(walk.AccStateHasPopup)
AccStateValid = AccState(walk.AccStateValid)
)
// AccRole enum defines the role of the window/control in UI.
type AccRole int32
// Window/control system roles
const (
AccRoleTitlebar = AccRole(walk.AccRoleTitlebar)
AccRoleMenubar = AccRole(walk.AccRoleMenubar)
AccRoleScrollbar = AccRole(walk.AccRoleScrollbar)
AccRoleGrip = AccRole(walk.AccRoleGrip)
AccRoleSound = AccRole(walk.AccRoleSound)
AccRoleCursor = AccRole(walk.AccRoleCursor)
AccRoleCaret = AccRole(walk.AccRoleCaret)
AccRoleAlert = AccRole(walk.AccRoleAlert)
AccRoleWindow = AccRole(walk.AccRoleWindow)
AccRoleClient = AccRole(walk.AccRoleClient)
AccRoleMenuPopup = AccRole(walk.AccRoleMenuPopup)
AccRoleMenuItem = AccRole(walk.AccRoleMenuItem)
AccRoleTooltip = AccRole(walk.AccRoleTooltip)
AccRoleApplication = AccRole(walk.AccRoleApplication)
AccRoleDocument = AccRole(walk.AccRoleDocument)
AccRolePane = AccRole(walk.AccRolePane)
AccRoleChart = AccRole(walk.AccRoleChart)
AccRoleDialog = AccRole(walk.AccRoleDialog)
AccRoleBorder = AccRole(walk.AccRoleBorder)
AccRoleGrouping = AccRole(walk.AccRoleGrouping)
AccRoleSeparator = AccRole(walk.AccRoleSeparator)
AccRoleToolbar = AccRole(walk.AccRoleToolbar)
AccRoleStatusbar = AccRole(walk.AccRoleStatusbar)
AccRoleTable = AccRole(walk.AccRoleTable)
AccRoleColumnHeader = AccRole(walk.AccRoleColumnHeader)
AccRoleRowHeader = AccRole(walk.AccRoleRowHeader)
AccRoleColumn = AccRole(walk.AccRoleColumn)
AccRoleRow = AccRole(walk.AccRoleRow)
AccRoleCell = AccRole(walk.AccRoleCell)
AccRoleLink = AccRole(walk.AccRoleLink)
AccRoleHelpBalloon = AccRole(walk.AccRoleHelpBalloon)
AccRoleCharacter = AccRole(walk.AccRoleCharacter)
AccRoleList = AccRole(walk.AccRoleList)
AccRoleListItem = AccRole(walk.AccRoleListItem)
AccRoleOutline = AccRole(walk.AccRoleOutline)
AccRoleOutlineItem = AccRole(walk.AccRoleOutlineItem)
AccRolePagetab = AccRole(walk.AccRolePagetab)
AccRolePropertyPage = AccRole(walk.AccRolePropertyPage)
AccRoleIndicator = AccRole(walk.AccRoleIndicator)
AccRoleGraphic = AccRole(walk.AccRoleGraphic)
AccRoleStatictext = AccRole(walk.AccRoleStatictext)
AccRoleText = AccRole(walk.AccRoleText)
AccRolePushbutton = AccRole(walk.AccRolePushbutton)
AccRoleCheckbutton = AccRole(walk.AccRoleCheckbutton)
AccRoleRadiobutton = AccRole(walk.AccRoleRadiobutton)
AccRoleCombobox = AccRole(walk.AccRoleCombobox)
AccRoleDroplist = AccRole(walk.AccRoleDroplist)
AccRoleProgressbar = AccRole(walk.AccRoleProgressbar)
AccRoleDial = AccRole(walk.AccRoleDial)
AccRoleHotkeyfield = AccRole(walk.AccRoleHotkeyfield)
AccRoleSlider = AccRole(walk.AccRoleSlider)
AccRoleSpinbutton = AccRole(walk.AccRoleSpinbutton)
AccRoleDiagram = AccRole(walk.AccRoleDiagram)
AccRoleAnimation = AccRole(walk.AccRoleAnimation)
AccRoleEquation = AccRole(walk.AccRoleEquation)
AccRoleButtonDropdown = AccRole(walk.AccRoleButtonDropdown)
AccRoleButtonMenu = AccRole(walk.AccRoleButtonMenu)
AccRoleButtonDropdownGrid = AccRole(walk.AccRoleButtonDropdownGrid)
AccRoleWhitespace = AccRole(walk.AccRoleWhitespace)
AccRolePageTabList = AccRole(walk.AccRolePageTabList)
AccRoleClock = AccRole(walk.AccRoleClock)
AccRoleSplitButton = AccRole(walk.AccRoleSplitButton)
AccRoleIPAddress = AccRole(walk.AccRoleIPAddress)
AccRoleOutlineButton = AccRole(walk.AccRoleOutlineButton)
)
// Accessibility properties
type Accessibility struct {
Accelerator string
DefaultAction string
Description string
Help string
Name string
Role AccRole
RoleMap string
State AccState
StateMap string
ValueMap string
}
================================================
FILE: declarative/action.go
================================================
// Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package declarative
import (
"fmt"
"github.com/lxn/walk"
)
type Shortcut struct {
Modifiers walk.Modifiers
Key walk.Key
}
type Action struct {
AssignTo **walk.Action
Text string
Image interface{}
Checked Property
Enabled Property
Visible Property
Shortcut Shortcut
OnTriggered walk.EventHandler
Checkable bool
}
func (a Action) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
action := walk.NewAction()
if a.AssignTo != nil {
*a.AssignTo = action
}
if err := action.SetText(a.Text); err != nil {
return nil, err
}
if err := setActionImage(action, a.Image, builder.dpi); err != nil {
return nil, err
}
if err := setActionBoolOrCondition(action.SetChecked, action.SetCheckedCondition, a.Checked, "Action.Checked", builder); err != nil {
return nil, err
}
if err := setActionBoolOrCondition(action.SetEnabled, action.SetEnabledCondition, a.Enabled, "Action.Enabled", builder); err != nil {
return nil, err
}
if err := setActionBoolOrCondition(action.SetVisible, action.SetVisibleCondition, a.Visible, "Action.Visible", builder); err != nil {
return nil, err
}
if err := action.SetCheckable(a.Checkable || action.CheckedCondition() != nil); err != nil {
return nil, err
}
s := a.Shortcut
if err := action.SetShortcut(walk.Shortcut{s.Modifiers, s.Key}); err != nil {
return nil, err
}
if a.OnTriggered != nil {
action.Triggered().Attach(a.OnTriggered)
}
if menu != nil {
if err := menu.Actions().Add(action); err != nil {
return nil, err
}
}
return action, nil
}
type ActionRef struct {
Action **walk.Action
}
func (ar ActionRef) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
if menu != nil {
if err := menu.Actions().Add(*ar.Action); err != nil {
return nil, err
}
}
return *ar.Action, nil
}
type Menu struct {
AssignTo **walk.Menu
AssignActionTo **walk.Action
Text string
Image interface{}
Enabled Property
Visible Property
Items []MenuItem
OnTriggered walk.EventHandler
}
func (m Menu) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
subMenu, err := walk.NewMenu()
if err != nil {
return nil, err
}
var action *walk.Action
if menu == nil {
action = walk.NewMenuAction(subMenu)
} else if action, err = menu.Actions().AddMenu(subMenu); err != nil {
return nil, err
}
if err := action.SetText(m.Text); err != nil {
return nil, err
}
if err := setActionImage(action, m.Image, builder.dpi); err != nil {
return nil, err
}
if err := setActionBoolOrCondition(action.SetEnabled, action.SetEnabledCondition, m.Enabled, "Menu.Enabled", builder); err != nil {
return nil, err
}
if err := setActionBoolOrCondition(action.SetVisible, action.SetVisibleCondition, m.Visible, "Menu.Visible", builder); err != nil {
return nil, err
}
for _, item := range m.Items {
if _, err := item.createAction(builder, subMenu); err != nil {
return nil, err
}
}
if m.OnTriggered != nil {
action.Triggered().Attach(m.OnTriggered)
}
if m.AssignActionTo != nil {
*m.AssignActionTo = action
}
if m.AssignTo != nil {
*m.AssignTo = subMenu
}
return action, nil
}
type Separator struct {
}
func (s Separator) createAction(builder *Builder, menu *walk.Menu) (*walk.Action, error) {
action := walk.NewSeparatorAction()
if menu != nil {
if err := menu.Actions().Add(action); err != nil {
return nil, err
}
}
return action, nil
}
func addToActionList(list *walk.ActionList, actions []*walk.Action) error {
for _, a := range actions {
if err := list.Add(a); err != nil {
return err
}
}
return nil
}
func setActionImage(action *walk.Action, image interface{}, dpi int) (err error) {
var img walk.Image
switch image.(type) {
case *walk.Bitmap:
if img, err = walk.BitmapFrom(image, dpi); err != nil {
return
}
case walk.ExtractableIcon, *walk.Icon:
if img, err = walk.IconFrom(image, dpi); err != nil {
return
}
default:
if img, err = walk.ImageFrom(image); err != nil {
return
}
}
return action.SetImage(img)
}
func setActionBoolOrCondition(setBool func(bool) error, setCond func(walk.Condition), value Property, path string, builder *Builder) error {
if value != nil {
if b, ok := value.(bool); ok {
if err := setBool(b); err != nil {
return err
}
} else if s := builder.conditionOrProperty(value); s != nil {
if c, ok := s.(walk.Condition); ok {
setCond(c)
} else {
return fmt.Errorf("value of invalid type bound to %s: %T", path, s)
}
}
}
return nil
}
================================================
FILE: declarative/brush.go
================================================
// Copyright 2017 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package declarative
import (
"strconv"
"github.com/lxn/walk"
)
type TransparentBrush struct {
}
func (TransparentBrush) Create() (walk.Brush, error) {
return walk.NullBrush(), nil
}
type SolidColorBrush struct {
Color walk.Color
}
func (scb SolidColorBrush) Create() (walk.Brush, error) {
return walk.NewSolidColorBrush(scb.Color)
}
type SystemColorBrush struct {
Color walk.SystemColor
}
func (scb SystemColorBrush) Create() (walk.Brush, error) {
return walk.NewSystemColorBrush(scb.Color)
}
type BitmapBrush struct {
Image interface{}
}
func (bb BitmapBrush) Create() (walk.Brush, error) {
var bmp *walk.Bitmap
var err error
switch img := bb.Image.(type) {
case *walk.Bitmap:
bmp = img
case string:
if bmp, err = walk.Resources.Bitmap(img); err != nil {
return nil, err
}
case int:
if bmp, err = walk.Resources.Bitmap(strconv.Itoa(img)); err != nil {
return nil, err
}
default:
return nil, walk.ErrInvalidType
}
return walk.NewBitmapBrush(bmp)
}
type GradientBrush struct {
Vertexes []walk.GradientVertex
Triangles []walk.GradientTriangle
}
func (gb GradientBrush) Create() (walk.Brush, error) {
return walk.NewGradientBrush(gb.Vertexes, gb.Triangles)
}
type HorizontalGradientBrush struct {
Stops []walk.GradientStop
}
func (hgb HorizontalGradientBrush) Create() (walk.Brush, error) {
return walk.NewHorizontalGradientBrush(hgb.Stops)
}
type VerticalGradientBrush struct {
Stops []walk.GradientStop
}
func (vgb VerticalGradientBrush) Create() (walk.Brush, error) {
return walk.NewVerticalGradientBrush(vgb.Stops)
}
================================================
FILE: declarative/builder.go
================================================
// Copyright 2012 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package declarative
import (
"fmt"
"log"
"reflect"
"regexp"
"strings"
"github.com/lxn/walk"
"gopkg.in/Knetic/govaluate.v3"
)
var (
conditionsByName = make(map[string]walk.Condition)
propertyRE *regexp.Regexp
)
func init() {
walk.AppendToWalkInit(func() {
propertyRE = regexp.MustCompile("[A-Za-z]+[0-9A-Za-z]*(\\.[A-Za-z]+[0-9A-Za-z]*)+")
})
}
func MustRegisterCondition(name string, condition walk.Condition) {
if name == "" {
panic(`name == ""`)
}
if condition == nil {
panic("condition == nil")
}
if _, ok := conditionsByName[name]; ok {
panic("name already registered")
}
conditionsByName[name] = condition
}
type declWidget struct {
d Widget
w walk.Window
}
type Builder struct {
dpi int
level int
rows int
columns int
row int
col int
widgetValue reflect.Value
parent walk.Container
declWidgets []declWidget
name2Window map[string]walk.Window
name2DataBinder map[string]*walk.DataBinder
deferredFuncs []func() error
knownCompositeConditions map[string]walk.Condition
expressions map[string]walk.Expression
functions map[string]govaluate.ExpressionFunction
}
func NewBuilder(parent walk.Container) *Builder {
var dpi int
if parent != nil {
dpi = parent.DPI()
}
return &Builder{
dpi: dpi,
parent: parent,
name2Window: make(map[string]walk.Window),
name2DataBinder: make(map[string]*walk.DataBinder),
knownCompositeConditions: make(map[string]walk.Condition),
expressions: make(map[string]walk.Expression),
functions: make(map[string]govaluate.ExpressionFunction),
}
}
func (b *Builder) Parent() walk.Container {
return b.parent
}
func (b *Builder) Defer(f func() error) {
b.deferredFuncs = append(b.deferredFuncs, f)
}
func (b *Builder) deferBuildMenuActions(menu *walk.Menu, items []MenuItem) {
if len(items) > 0 {
b.Defer(func() error {
for _, item := range items {
if _, err := item.createAction(b, menu); err != nil {
return err
}
}
return nil
})
}
}
func (b *Builder) deferBuildActions(actionList *walk.ActionList, items []MenuItem) {
if len(items) > 0 {
b.Defer(func() error {
for _, item := range items {
action, err := item.createAction(b, nil)
if err != nil {
return err
}
if err := actionList.Add(action); err != nil {
return err
}
}
return nil
})
}
}
func (b *Builder) InitWidget(d Widget, w walk.Window, customInit func() error) error {
if b.dpi == 0 {
b.dpi =
gitextract_aroynwxm/ ├── AUTHORS ├── LICENSE ├── README.mdown ├── accessibility.go ├── action.go ├── actionlist.go ├── application.go ├── bitmap.go ├── boxlayout.go ├── brush.go ├── button.go ├── cancelevent.go ├── canvas.go ├── checkbox.go ├── clipboard.go ├── closeevent.go ├── color.go ├── combobox.go ├── commondialogs.go ├── composite.go ├── condition.go ├── container.go ├── cursor.go ├── customwidget.go ├── databinding.go ├── dateedit.go ├── datelabel.go ├── declarative/ │ ├── accessibility.go │ ├── action.go │ ├── brush.go │ ├── builder.go │ ├── checkbox.go │ ├── combobox.go │ ├── composite.go │ ├── customwidget.go │ ├── databinder.go │ ├── dateedit.go │ ├── datelabel.go │ ├── dialog.go │ ├── font.go │ ├── gradientcomposite.go │ ├── groupbox.go │ ├── imageview.go │ ├── interfaces.go │ ├── label.go │ ├── layouts.go │ ├── lineedit.go │ ├── linklabel.go │ ├── listbox.go │ ├── mainwindow.go │ ├── nonwin.go │ ├── numberedit.go │ ├── numberlabel.go │ ├── progressbar.go │ ├── pushbutton.go │ ├── radiobutton.go │ ├── radiobuttongroup.go │ ├── radiobuttongroupbox.go │ ├── scrollview.go │ ├── separator.go │ ├── slider.go │ ├── spacer.go │ ├── splitbutton.go │ ├── splitter.go │ ├── tableview.go │ ├── tableviewcolumn.go │ ├── tabpage.go │ ├── tabwidget.go │ ├── textedit.go │ ├── textlabel.go │ ├── toolbar.go │ ├── toolbutton.go │ ├── treeview.go │ ├── validators.go │ └── webview.go ├── dialog.go ├── dropfilesevent.go ├── error.go ├── errorevent.go ├── event.go ├── examples/ │ ├── actions/ │ │ ├── actions.exe.manifest │ │ ├── actions.go │ │ └── rsrc.syso │ ├── clipboard/ │ │ ├── clipboard.exe.manifest │ │ ├── clipboard.go │ │ └── rsrc.syso │ ├── databinding/ │ │ ├── databinding.exe.manifest │ │ ├── databinding.go │ │ └── rsrc.syso │ ├── drawing/ │ │ ├── drawing.exe.manifest │ │ ├── drawing.go │ │ └── rsrc.syso │ ├── dropfiles/ │ │ ├── dropfiles.exe.manifest │ │ ├── dropfiles.go │ │ └── rsrc.syso │ ├── externalwidgets/ │ │ ├── externalwidgets.exe.manifest │ │ ├── externalwidgets.go │ │ └── rsrc.syso │ ├── filebrowser/ │ │ ├── filebrowser.exe.manifest │ │ ├── filebrowser.go │ │ └── rsrc.syso │ ├── gradientcomposite/ │ │ ├── gradientcomposite.exe.manifest │ │ ├── gradientcomposite.go │ │ └── rsrc.syso │ ├── imageicon/ │ │ ├── imageicon.exe.manifest │ │ ├── main.go │ │ └── rsrc.syso │ ├── imageview/ │ │ ├── imageview.exe.manifest │ │ ├── imageview.go │ │ └── rsrc.syso │ ├── imageviewer/ │ │ ├── imageviewer.exe.manifest │ │ ├── imageviewer.go │ │ └── rsrc.syso │ ├── img/ │ │ └── README │ ├── linklabel/ │ │ ├── linklabel.exe.manifest │ │ ├── linklabel.go │ │ └── rsrc.syso │ ├── listbox/ │ │ ├── listbox.exe.manifest │ │ ├── listbox.go │ │ └── rsrc.syso │ ├── listbox_ownerdrawing/ │ │ ├── listbox_ownerdrawing.exe.manifest │ │ ├── listbox_ownerdrawing.go │ │ └── rsrc.syso │ ├── logview/ │ │ ├── logview.exe.manifest │ │ ├── logview.go │ │ ├── logviewapp.go │ │ └── rsrc.syso │ ├── multiplepages/ │ │ ├── main.go │ │ ├── multipagemainwindow.go │ │ ├── multiplepages.exe.manifest │ │ └── rsrc.syso │ ├── notifyicon/ │ │ ├── notifyicon.exe.manifest │ │ ├── notifyicon.go │ │ └── rsrc.syso │ ├── progressindicator/ │ │ ├── dialog.ui │ │ ├── dialog_ui.go │ │ ├── pi.go │ │ ├── progressindicator.exe.manifest │ │ └── rsrc.syso │ ├── radiobutton/ │ │ ├── radiobutton.exe.manifest │ │ ├── radiobutton.go │ │ └── rsrc.syso │ ├── settings/ │ │ ├── rsrc.syso │ │ ├── settings.exe.manifest │ │ └── settings.go │ ├── slider/ │ │ ├── rsrc.syso │ │ ├── slider.exe.manifest │ │ └── slider.go │ ├── statusbar/ │ │ ├── rsrc.syso │ │ ├── statusbar.exe.manifest │ │ └── statusbar.go │ ├── tableview/ │ │ ├── rsrc.syso │ │ ├── tableview.exe.manifest │ │ └── tableview.go │ ├── webview/ │ │ ├── rsrc.syso │ │ ├── webview.exe.manifest │ │ └── webview.go │ └── webview_events/ │ ├── rsrc.syso │ ├── webview_events.exe.manifest │ └── webview_events.go ├── expression.go ├── flowlayout.go ├── font.go ├── fontresource.go ├── form.go ├── gradientcomposite.go ├── graphicseffects.go ├── gridlayout.go ├── groupbox.go ├── icon.go ├── iconcache.go ├── image.go ├── imagelist.go ├── imageview.go ├── inifilesettings.go ├── intevent.go ├── intrangeevent.go ├── keyboard.go ├── keyevent.go ├── l10n/ │ ├── update.bat │ ├── walk-de.tr │ └── walk-ko.tr ├── label.go ├── layout.go ├── lineedit.go ├── linklabel.go ├── listbox.go ├── mainloop_cgo.go ├── mainloop_default.go ├── mainwindow.go ├── maptablemodel.go ├── menu.go ├── messagebox.go ├── metafile.go ├── models.go ├── mouseevent.go ├── notifyicon.go ├── numberedit.go ├── numberlabel.go ├── path.go ├── pen.go ├── point.go ├── progressbar.go ├── progressindicator.go ├── property.go ├── pushbutton.go ├── radiobutton.go ├── rectangle.go ├── reflectmodels.go ├── registry.go ├── resourcemanager.go ├── scrollview.go ├── separator.go ├── simpletypes.go ├── size.go ├── slider.go ├── spacer.go ├── splitbutton.go ├── splitter.go ├── splitterhandle.go ├── splitterlayout.go ├── static.go ├── statusbar.go ├── stopwatch.go ├── stringevent.go ├── tableview.go ├── tableviewcolumn.go ├── tableviewcolumnlist.go ├── tabpage.go ├── tabpagelist.go ├── tabwidget.go ├── textedit.go ├── textlabel.go ├── toolbar.go ├── toolbutton.go ├── tools/ │ └── ui2walk/ │ └── ui2walk.go ├── tooltip.go ├── tooltiperrorpresenter.go ├── treeitemevent.go ├── treeview.go ├── util.go ├── validators.go ├── walk.go ├── webview.go ├── webview_dwebbrowserevents2.go ├── webview_events.go ├── webview_idochostuihandler.go ├── webview_ioleclientsite.go ├── webview_ioleinplaceframe.go ├── webview_ioleinplacesite.go ├── widget.go ├── widgetlist.go ├── window.go └── windowgroup.go
Showing preview only (328K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3793 symbols across 195 files)
FILE: accessibility.go
type AccState (line 12) | type AccState
constant AccStateNormal (line 16) | AccStateNormal AccState = win.STATE_SYSTEM_NORMAL
constant AccStateUnavailable (line 17) | AccStateUnavailable AccState = win.STATE_SYSTEM_UNAVAILABLE
constant AccStateSelected (line 18) | AccStateSelected AccState = win.STATE_SYSTEM_SELECTED
constant AccStateFocused (line 19) | AccStateFocused AccState = win.STATE_SYSTEM_FOCUSED
constant AccStatePressed (line 20) | AccStatePressed AccState = win.STATE_SYSTEM_PRESSED
constant AccStateChecked (line 21) | AccStateChecked AccState = win.STATE_SYSTEM_CHECKED
constant AccStateMixed (line 22) | AccStateMixed AccState = win.STATE_SYSTEM_MIXED
constant AccStateIndeterminate (line 23) | AccStateIndeterminate AccState = win.STATE_SYSTEM_INDETERMINATE
constant AccStateReadonly (line 24) | AccStateReadonly AccState = win.STATE_SYSTEM_READONLY
constant AccStateHotTracked (line 25) | AccStateHotTracked AccState = win.STATE_SYSTEM_HOTTRACKED
constant AccStateDefault (line 26) | AccStateDefault AccState = win.STATE_SYSTEM_DEFAULT
constant AccStateExpanded (line 27) | AccStateExpanded AccState = win.STATE_SYSTEM_EXPANDED
constant AccStateCollapsed (line 28) | AccStateCollapsed AccState = win.STATE_SYSTEM_COLLAPSED
constant AccStateBusy (line 29) | AccStateBusy AccState = win.STATE_SYSTEM_BUSY
constant AccStateFloating (line 30) | AccStateFloating AccState = win.STATE_SYSTEM_FLOATING
constant AccStateMarqueed (line 31) | AccStateMarqueed AccState = win.STATE_SYSTEM_MARQUEED
constant AccStateAnimated (line 32) | AccStateAnimated AccState = win.STATE_SYSTEM_ANIMATED
constant AccStateInvisible (line 33) | AccStateInvisible AccState = win.STATE_SYSTEM_INVISIBLE
constant AccStateOffscreen (line 34) | AccStateOffscreen AccState = win.STATE_SYSTEM_OFFSCREEN
constant AccStateSizeable (line 35) | AccStateSizeable AccState = win.STATE_SYSTEM_SIZEABLE
constant AccStateMoveable (line 36) | AccStateMoveable AccState = win.STATE_SYSTEM_MOVEABLE
constant AccStateSelfVoicing (line 37) | AccStateSelfVoicing AccState = win.STATE_SYSTEM_SELFVOICING
constant AccStateFocusable (line 38) | AccStateFocusable AccState = win.STATE_SYSTEM_FOCUSABLE
constant AccStateSelectable (line 39) | AccStateSelectable AccState = win.STATE_SYSTEM_SELECTABLE
constant AccStateLinked (line 40) | AccStateLinked AccState = win.STATE_SYSTEM_LINKED
constant AccStateTraversed (line 41) | AccStateTraversed AccState = win.STATE_SYSTEM_TRAVERSED
constant AccStateMultiselectable (line 42) | AccStateMultiselectable AccState = win.STATE_SYSTEM_MULTISELECTABLE
constant AccStateExtselectable (line 43) | AccStateExtselectable AccState = win.STATE_SYSTEM_EXTSELECTABLE
constant AccStateAlertLow (line 44) | AccStateAlertLow AccState = win.STATE_SYSTEM_ALERT_LOW
constant AccStateAlertMedium (line 45) | AccStateAlertMedium AccState = win.STATE_SYSTEM_ALERT_MEDIUM
constant AccStateAlertHigh (line 46) | AccStateAlertHigh AccState = win.STATE_SYSTEM_ALERT_HIGH
constant AccStateProtected (line 47) | AccStateProtected AccState = win.STATE_SYSTEM_PROTECTED
constant AccStateHasPopup (line 48) | AccStateHasPopup AccState = win.STATE_SYSTEM_HASPOPUP
constant AccStateValid (line 49) | AccStateValid AccState = win.STATE_SYSTEM_VALID
type AccRole (line 53) | type AccRole
constant AccRoleTitlebar (line 57) | AccRoleTitlebar AccRole = win.ROLE_SYSTEM_TITLEBAR
constant AccRoleMenubar (line 58) | AccRoleMenubar AccRole = win.ROLE_SYSTEM_MENUBAR
constant AccRoleScrollbar (line 59) | AccRoleScrollbar AccRole = win.ROLE_SYSTEM_SCROLLBAR
constant AccRoleGrip (line 60) | AccRoleGrip AccRole = win.ROLE_SYSTEM_GRIP
constant AccRoleSound (line 61) | AccRoleSound AccRole = win.ROLE_SYSTEM_SOUND
constant AccRoleCursor (line 62) | AccRoleCursor AccRole = win.ROLE_SYSTEM_CURSOR
constant AccRoleCaret (line 63) | AccRoleCaret AccRole = win.ROLE_SYSTEM_CARET
constant AccRoleAlert (line 64) | AccRoleAlert AccRole = win.ROLE_SYSTEM_ALERT
constant AccRoleWindow (line 65) | AccRoleWindow AccRole = win.ROLE_SYSTEM_WINDOW
constant AccRoleClient (line 66) | AccRoleClient AccRole = win.ROLE_SYSTEM_CLIENT
constant AccRoleMenuPopup (line 67) | AccRoleMenuPopup AccRole = win.ROLE_SYSTEM_MENUPOPUP
constant AccRoleMenuItem (line 68) | AccRoleMenuItem AccRole = win.ROLE_SYSTEM_MENUITEM
constant AccRoleTooltip (line 69) | AccRoleTooltip AccRole = win.ROLE_SYSTEM_TOOLTIP
constant AccRoleApplication (line 70) | AccRoleApplication AccRole = win.ROLE_SYSTEM_APPLICATION
constant AccRoleDocument (line 71) | AccRoleDocument AccRole = win.ROLE_SYSTEM_DOCUMENT
constant AccRolePane (line 72) | AccRolePane AccRole = win.ROLE_SYSTEM_PANE
constant AccRoleChart (line 73) | AccRoleChart AccRole = win.ROLE_SYSTEM_CHART
constant AccRoleDialog (line 74) | AccRoleDialog AccRole = win.ROLE_SYSTEM_DIALOG
constant AccRoleBorder (line 75) | AccRoleBorder AccRole = win.ROLE_SYSTEM_BORDER
constant AccRoleGrouping (line 76) | AccRoleGrouping AccRole = win.ROLE_SYSTEM_GROUPING
constant AccRoleSeparator (line 77) | AccRoleSeparator AccRole = win.ROLE_SYSTEM_SEPARATOR
constant AccRoleToolbar (line 78) | AccRoleToolbar AccRole = win.ROLE_SYSTEM_TOOLBAR
constant AccRoleStatusbar (line 79) | AccRoleStatusbar AccRole = win.ROLE_SYSTEM_STATUSBAR
constant AccRoleTable (line 80) | AccRoleTable AccRole = win.ROLE_SYSTEM_TABLE
constant AccRoleColumnHeader (line 81) | AccRoleColumnHeader AccRole = win.ROLE_SYSTEM_COLUMNHEADER
constant AccRoleRowHeader (line 82) | AccRoleRowHeader AccRole = win.ROLE_SYSTEM_ROWHEADER
constant AccRoleColumn (line 83) | AccRoleColumn AccRole = win.ROLE_SYSTEM_COLUMN
constant AccRoleRow (line 84) | AccRoleRow AccRole = win.ROLE_SYSTEM_ROW
constant AccRoleCell (line 85) | AccRoleCell AccRole = win.ROLE_SYSTEM_CELL
constant AccRoleLink (line 86) | AccRoleLink AccRole = win.ROLE_SYSTEM_LINK
constant AccRoleHelpBalloon (line 87) | AccRoleHelpBalloon AccRole = win.ROLE_SYSTEM_HELPBALLOON
constant AccRoleCharacter (line 88) | AccRoleCharacter AccRole = win.ROLE_SYSTEM_CHARACTER
constant AccRoleList (line 89) | AccRoleList AccRole = win.ROLE_SYSTEM_LIST
constant AccRoleListItem (line 90) | AccRoleListItem AccRole = win.ROLE_SYSTEM_LISTITEM
constant AccRoleOutline (line 91) | AccRoleOutline AccRole = win.ROLE_SYSTEM_OUTLINE
constant AccRoleOutlineItem (line 92) | AccRoleOutlineItem AccRole = win.ROLE_SYSTEM_OUTLINEITEM
constant AccRolePagetab (line 93) | AccRolePagetab AccRole = win.ROLE_SYSTEM_PAGETAB
constant AccRolePropertyPage (line 94) | AccRolePropertyPage AccRole = win.ROLE_SYSTEM_PROPERTYPAGE
constant AccRoleIndicator (line 95) | AccRoleIndicator AccRole = win.ROLE_SYSTEM_INDICATOR
constant AccRoleGraphic (line 96) | AccRoleGraphic AccRole = win.ROLE_SYSTEM_GRAPHIC
constant AccRoleStatictext (line 97) | AccRoleStatictext AccRole = win.ROLE_SYSTEM_STATICTEXT
constant AccRoleText (line 98) | AccRoleText AccRole = win.ROLE_SYSTEM_TEXT
constant AccRolePushbutton (line 99) | AccRolePushbutton AccRole = win.ROLE_SYSTEM_PUSHBUTTON
constant AccRoleCheckbutton (line 100) | AccRoleCheckbutton AccRole = win.ROLE_SYSTEM_CHECKBUTTON
constant AccRoleRadiobutton (line 101) | AccRoleRadiobutton AccRole = win.ROLE_SYSTEM_RADIOBUTTON
constant AccRoleCombobox (line 102) | AccRoleCombobox AccRole = win.ROLE_SYSTEM_COMBOBOX
constant AccRoleDroplist (line 103) | AccRoleDroplist AccRole = win.ROLE_SYSTEM_DROPLIST
constant AccRoleProgressbar (line 104) | AccRoleProgressbar AccRole = win.ROLE_SYSTEM_PROGRESSBAR
constant AccRoleDial (line 105) | AccRoleDial AccRole = win.ROLE_SYSTEM_DIAL
constant AccRoleHotkeyfield (line 106) | AccRoleHotkeyfield AccRole = win.ROLE_SYSTEM_HOTKEYFIELD
constant AccRoleSlider (line 107) | AccRoleSlider AccRole = win.ROLE_SYSTEM_SLIDER
constant AccRoleSpinbutton (line 108) | AccRoleSpinbutton AccRole = win.ROLE_SYSTEM_SPINBUTTON
constant AccRoleDiagram (line 109) | AccRoleDiagram AccRole = win.ROLE_SYSTEM_DIAGRAM
constant AccRoleAnimation (line 110) | AccRoleAnimation AccRole = win.ROLE_SYSTEM_ANIMATION
constant AccRoleEquation (line 111) | AccRoleEquation AccRole = win.ROLE_SYSTEM_EQUATION
constant AccRoleButtonDropdown (line 112) | AccRoleButtonDropdown AccRole = win.ROLE_SYSTEM_BUTTONDROPDOWN
constant AccRoleButtonMenu (line 113) | AccRoleButtonMenu AccRole = win.ROLE_SYSTEM_BUTTONMENU
constant AccRoleButtonDropdownGrid (line 114) | AccRoleButtonDropdownGrid AccRole = win.ROLE_SYSTEM_BUTTONDROPDOWNGRID
constant AccRoleWhitespace (line 115) | AccRoleWhitespace AccRole = win.ROLE_SYSTEM_WHITESPACE
constant AccRolePageTabList (line 116) | AccRolePageTabList AccRole = win.ROLE_SYSTEM_PAGETABLIST
constant AccRoleClock (line 117) | AccRoleClock AccRole = win.ROLE_SYSTEM_CLOCK
constant AccRoleSplitButton (line 118) | AccRoleSplitButton AccRole = win.ROLE_SYSTEM_SPLITBUTTON
constant AccRoleIPAddress (line 119) | AccRoleIPAddress AccRole = win.ROLE_SYSTEM_IPADDRESS
constant AccRoleOutlineButton (line 120) | AccRoleOutlineButton AccRole = win.ROLE_SYSTEM_OUTLINEBUTTON
type Accessibility (line 124) | type Accessibility struct
method SetAccelerator (line 129) | func (a *Accessibility) SetAccelerator(acc string) error {
method SetDefaultAction (line 134) | func (a *Accessibility) SetDefaultAction(defAction string) error {
method SetDescription (line 139) | func (a *Accessibility) SetDescription(acc string) error {
method SetHelp (line 144) | func (a *Accessibility) SetHelp(help string) error {
method SetName (line 149) | func (a *Accessibility) SetName(name string) error {
method SetRole (line 155) | func (a *Accessibility) SetRole(role AccRole) error {
method SetRoleMap (line 161) | func (a *Accessibility) SetRoleMap(roleMap string) error {
method SetState (line 166) | func (a *Accessibility) SetState(state AccState) error {
method SetStateMap (line 172) | func (a *Accessibility) SetStateMap(stateMap string) error {
method SetValueMap (line 178) | func (a *Accessibility) SetValueMap(valueMap string) error {
method accSetPropertyInt (line 183) | func (a *Accessibility) accSetPropertyInt(hwnd win.HWND, idProp *win.M...
method accSetPropertyStr (line 201) | func (a *Accessibility) accSetPropertyStr(hwnd win.HWND, idProp *win.M...
FILE: action.go
type actionChangedHandler (line 9) | type actionChangedHandler interface
type Action (line 23) | type Action struct
method addRef (line 77) | func (a *Action) addRef() {
method release (line 81) | func (a *Action) release() {
method Menu (line 98) | func (a *Action) Menu() *Menu {
method Checkable (line 102) | func (a *Action) Checkable() bool {
method SetCheckable (line 106) | func (a *Action) SetCheckable(value bool) (err error) {
method Checked (line 121) | func (a *Action) Checked() bool {
method SetChecked (line 125) | func (a *Action) SetChecked(value bool) (err error) {
method CheckedCondition (line 150) | func (a *Action) CheckedCondition() Condition {
method SetCheckedCondition (line 154) | func (a *Action) SetCheckedCondition(c Condition) {
method Default (line 176) | func (a *Action) Default() bool {
method SetDefault (line 180) | func (a *Action) SetDefault(value bool) (err error) {
method DefaultCondition (line 205) | func (a *Action) DefaultCondition() Condition {
method SetDefaultCondition (line 209) | func (a *Action) SetDefaultCondition(c Condition) {
method Enabled (line 231) | func (a *Action) Enabled() bool {
method SetEnabled (line 235) | func (a *Action) SetEnabled(value bool) (err error) {
method EnabledCondition (line 254) | func (a *Action) EnabledCondition() Condition {
method SetEnabledCondition (line 258) | func (a *Action) SetEnabledCondition(c Condition) {
method Exclusive (line 280) | func (a *Action) Exclusive() bool {
method SetExclusive (line 284) | func (a *Action) SetExclusive(value bool) (err error) {
method Image (line 299) | func (a *Action) Image() Image {
method SetImage (line 303) | func (a *Action) SetImage(value Image) (err error) {
method Shortcut (line 318) | func (a *Action) Shortcut() Shortcut {
method SetShortcut (line 322) | func (a *Action) SetShortcut(shortcut Shortcut) (err error) {
method Text (line 348) | func (a *Action) Text() string {
method SetText (line 352) | func (a *Action) SetText(value string) (err error) {
method IsSeparator (line 367) | func (a *Action) IsSeparator() bool {
method ToolTip (line 371) | func (a *Action) ToolTip() string {
method SetToolTip (line 375) | func (a *Action) SetToolTip(value string) (err error) {
method Visible (line 390) | func (a *Action) Visible() bool {
method SetVisible (line 394) | func (a *Action) SetVisible(value bool) (err error) {
method VisibleCondition (line 413) | func (a *Action) VisibleCondition() Condition {
method SetVisibleCondition (line 417) | func (a *Action) SetVisibleCondition(c Condition) {
method Triggered (line 439) | func (a *Action) Triggered() *Event {
method raiseTriggered (line 443) | func (a *Action) raiseTriggered() {
method addChangedHandler (line 451) | func (a *Action) addChangedHandler(handler actionChangedHandler) {
method removeChangedHandler (line 455) | func (a *Action) removeChangedHandler(handler actionChangedHandler) {
method raiseChanged (line 464) | func (a *Action) raiseChanged() error {
method raiseVisibleChanged (line 474) | func (a *Action) raiseVisibleChanged() error {
function NewAction (line 49) | func NewAction() *Action {
function NewMenuAction (line 63) | func NewMenuAction(menu *Menu) *Action {
function NewSeparatorAction (line 70) | func NewSeparatorAction() *Action {
FILE: actionlist.go
type actionListObserver (line 9) | type actionListObserver interface
type nopActionListObserver (line 15) | type nopActionListObserver struct
method onInsertedAction (line 17) | func (nopActionListObserver) onInsertedAction(action *Action) error {
method onRemovingAction (line 21) | func (nopActionListObserver) onRemovingAction(action *Action) error {
method onClearingActions (line 25) | func (nopActionListObserver) onClearingActions() error {
type ActionList (line 29) | type ActionList struct
method Add (line 42) | func (l *ActionList) Add(action *Action) error {
method AddMenu (line 46) | func (l *ActionList) AddMenu(menu *Menu) (*Action, error) {
method At (line 50) | func (l *ActionList) At(index int) *Action {
method Clear (line 54) | func (l *ActionList) Clear() error {
method Contains (line 68) | func (l *ActionList) Contains(action *Action) bool {
method Index (line 72) | func (l *ActionList) Index(action *Action) int {
method indexInObserver (line 82) | func (l *ActionList) indexInObserver(action *Action) int {
method Insert (line 97) | func (l *ActionList) Insert(index int, action *Action) error {
method InsertMenu (line 117) | func (l *ActionList) InsertMenu(index int, menu *Menu) (*Action, error) {
method Len (line 128) | func (l *ActionList) Len() int {
method Remove (line 132) | func (l *ActionList) Remove(action *Action) error {
method RemoveAt (line 141) | func (l *ActionList) RemoveAt(index int) error {
method updateSeparatorVisibility (line 160) | func (l *ActionList) updateSeparatorVisibility() error {
function newActionList (line 34) | func newActionList(observer actionListObserver) *ActionList {
FILE: application.go
type Settings (line 17) | type Settings interface
type Persistable (line 29) | type Persistable interface
type Application (line 36) | type Application struct
method OrganizationName (line 52) | func (app *Application) OrganizationName() string {
method SetOrganizationName (line 58) | func (app *Application) SetOrganizationName(value string) {
method ProductName (line 64) | func (app *Application) ProductName() string {
method SetProductName (line 70) | func (app *Application) SetProductName(value string) {
method Settings (line 76) | func (app *Application) Settings() Settings {
method SetSettings (line 82) | func (app *Application) SetSettings(value Settings) {
method Exit (line 88) | func (app *Application) Exit(exitCode int) {
method ExitCode (line 96) | func (app *Application) ExitCode() int {
method Panicking (line 102) | func (app *Application) Panicking() *ErrorEvent {
method ActiveForm (line 112) | func (app *Application) ActiveForm() Form {
function App (line 48) | func App() *Application {
FILE: bitmap.go
constant inchesPerMeter (line 20) | inchesPerMeter float64 = 39.37007874
type Bitmap (line 22) | type Bitmap struct
method ToImage (line 264) | func (bmp *Bitmap) ToImage() (*image.RGBA, error) {
method hasTransparency (line 297) | func (bmp *Bitmap) hasTransparency() (bool, error) {
method postProcess (line 320) | func (bmp *Bitmap) postProcess() error {
method withPixels (line 352) | func (bmp *Bitmap) withPixels(f func(bi *win.BITMAPINFO, hdc win.HDC, ...
method Dispose (line 381) | func (bmp *Bitmap) Dispose() {
method Size (line 394) | func (bmp *Bitmap) Size() Size {
method handle (line 398) | func (bmp *Bitmap) handle() win.HBITMAP {
method draw (line 402) | func (bmp *Bitmap) draw(hdc win.HDC, location Point) error {
method drawStretched (line 406) | func (bmp *Bitmap) drawStretched(hdc win.HDC, bounds Rectangle) error {
method alphaBlend (line 411) | func (bmp *Bitmap) alphaBlend(hdc win.HDC, bounds Rectangle, opacity b...
method alphaBlendPart (line 417) | func (bmp *Bitmap) alphaBlendPart(hdc win.HDC, dst, src Rectangle, opa...
method withSelectedIntoMemDC (line 470) | func (bmp *Bitmap) withSelectedIntoMemDC(f func(hdcMem win.HDC) error)...
type transparencyStatus (line 30) | type transparencyStatus
constant transparencyUnknown (line 33) | transparencyUnknown transparencyStatus = iota
constant transparencyOpaque (line 34) | transparencyOpaque
constant transparencyTransparent (line 35) | transparencyTransparent
function BitmapFrom (line 38) | func BitmapFrom(src interface{}, dpi int) (*Bitmap, error) {
function NewBitmap (line 54) | func NewBitmap(size Size) (*Bitmap, error) {
function NewBitmapForDPI (line 60) | func NewBitmapForDPI(size Size, dpi int) (*Bitmap, error) {
function NewBitmapWithTransparentPixels (line 67) | func NewBitmapWithTransparentPixels(size Size) (*Bitmap, error) {
function NewBitmapWithTransparentPixelsForDPI (line 73) | func NewBitmapWithTransparentPixelsForDPI(size Size, dpi int) (*Bitmap, ...
function newBitmap (line 78) | func newBitmap(size Size, transparent bool, dpi int) (bmp *Bitmap, err e...
function NewBitmapFromFile (line 123) | func NewBitmapFromFile(filePath string) (*Bitmap, error) {
function NewBitmapFromFileForDPI (line 128) | func NewBitmapFromFileForDPI(filePath string, dpi int) (*Bitmap, error) {
function NewBitmapFromImage (line 153) | func NewBitmapFromImage(im image.Image) (*Bitmap, error) {
function NewBitmapFromImageForDPI (line 158) | func NewBitmapFromImageForDPI(im image.Image, dpi int) (*Bitmap, error) {
function NewBitmapFromResource (line 170) | func NewBitmapFromResource(name string) (*Bitmap, error) {
function NewBitmapFromResourceForDPI (line 175) | func NewBitmapFromResourceForDPI(name string, dpi int) (*Bitmap, error) {
function NewBitmapFromResourceId (line 182) | func NewBitmapFromResourceId(id int) (*Bitmap, error) {
function NewBitmapFromResourceIdForDPI (line 187) | func NewBitmapFromResourceIdForDPI(id int, dpi int) (*Bitmap, error) {
function newBitmapFromResource (line 191) | func newBitmapFromResource(res *uint16, dpi int) (bm *Bitmap, err error) {
function NewBitmapFromImageWithSize (line 208) | func NewBitmapFromImageWithSize(image Image, size Size) (*Bitmap, error) {
function NewBitmapFromWindow (line 236) | func NewBitmapFromWindow(window Window) (*Bitmap, error) {
function NewBitmapFromIcon (line 249) | func NewBitmapFromIcon(icon *Icon, size Size) (*Bitmap, error) {
function NewBitmapFromIconForDPI (line 255) | func NewBitmapFromIconForDPI(icon *Icon, size Size, dpi int) (*Bitmap, e...
type bgraPixel (line 343) | type bgraPixel struct
constant maxPixels (line 350) | maxPixels = 2 << 27
function newBitmapFromHBITMAP (line 486) | func newBitmapFromHBITMAP(hBmp win.HBITMAP, dpi int) (bmp *Bitmap, err e...
function hBitmapFromImage (line 523) | func hBitmapFromImage(im image.Image, dpi int) (win.HBITMAP, error) {
function hBitmapFromWindow (line 570) | func hBitmapFromWindow(window Window) (win.HBITMAP, error) {
function hBitmapFromIcon (line 598) | func hBitmapFromIcon(icon *Icon, size Size, dpi int) (win.HBITMAP, error) {
function withCompatibleDC (line 642) | func withCompatibleDC(f func(hdc win.HDC) error) error {
FILE: boxlayout.go
type Orientation (line 17) | type Orientation
constant NoOrientation (line 20) | NoOrientation Orientation = 0
constant Horizontal (line 21) | Horizontal = 1 << 0
constant Vertical (line 22) | Vertical = 1 << 1
type BoxLayout (line 25) | type BoxLayout struct
method Orientation (line 53) | func (l *BoxLayout) Orientation() Orientation {
method SetOrientation (line 57) | func (l *BoxLayout) SetOrientation(value Orientation) error {
method StretchFactor (line 74) | func (l *BoxLayout) StretchFactor(widget Widget) int {
method SetStretchFactor (line 82) | func (l *BoxLayout) SetStretchFactor(widget Widget, factor int) error {
method CreateLayoutItem (line 105) | func (l *BoxLayout) CreateLayoutItem(ctx *LayoutContext) ContainerLayo...
function newBoxLayout (line 31) | func newBoxLayout(orientation Orientation) *BoxLayout {
function NewHBoxLayout (line 45) | func NewHBoxLayout() *BoxLayout {
function NewVBoxLayout (line 49) | func NewVBoxLayout() *BoxLayout {
type boxLayoutItemInfo (line 119) | type boxLayoutItemInfo struct
type boxLayoutItemInfoList (line 129) | type boxLayoutItemInfoList
method Len (line 131) | func (l boxLayoutItemInfoList) Len() int {
method Less (line 135) | func (l boxLayoutItemInfoList) Less(i, j int) bool {
method Swap (line 156) | func (l boxLayoutItemInfoList) Swap(i, j int) {
type boxLayoutItem (line 160) | type boxLayoutItem struct
method LayoutFlags (line 168) | func (li *boxLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 172) | func (li *boxLayoutItem) IdealSize() Size {
method MinSize (line 176) | func (li *boxLayoutItem) MinSize() Size {
method HeightForWidth (line 180) | func (li *boxLayoutItem) HeightForWidth(width int) int {
method MinSizeForSize (line 184) | func (li *boxLayoutItem) MinSizeForSize(size Size) Size {
method PerformLayout (line 237) | func (li *boxLayoutItem) PerformLayout() []LayoutResultItem {
function boxLayoutFlags (line 242) | func boxLayoutFlags(orientation Orientation, children []LayoutItem) Layo...
function boxLayoutItems (line 269) | func boxLayoutItems(container ContainerLayoutItem, items []LayoutItem, o...
FILE: brush.go
type HatchStyle (line 15) | type HatchStyle
constant HatchHorizontal (line 18) | HatchHorizontal HatchStyle = win.HS_HORIZONTAL
constant HatchVertical (line 19) | HatchVertical HatchStyle = win.HS_VERTICAL
constant HatchForwardDiagonal (line 20) | HatchForwardDiagonal HatchStyle = win.HS_FDIAGONAL
constant HatchBackwardDiagonal (line 21) | HatchBackwardDiagonal HatchStyle = win.HS_BDIAGONAL
constant HatchCross (line 22) | HatchCross HatchStyle = win.HS_CROSS
constant HatchDiagonalCross (line 23) | HatchDiagonalCross HatchStyle = win.HS_DIAGCROSS
type SystemColor (line 26) | type SystemColor
constant SysColor3DDkShadow (line 29) | SysColor3DDkShadow SystemColor = win.COLOR_3DDKSHADOW
constant SysColor3DFace (line 30) | SysColor3DFace SystemColor = win.COLOR_3DFACE
constant SysColor3DHighlight (line 31) | SysColor3DHighlight SystemColor = win.COLOR_3DHIGHLIGHT
constant SysColor3DLight (line 32) | SysColor3DLight SystemColor = win.COLOR_3DLIGHT
constant SysColor3DShadow (line 33) | SysColor3DShadow SystemColor = win.COLOR_3DSHADOW
constant SysColorActiveBorder (line 34) | SysColorActiveBorder SystemColor = win.COLOR_ACTIVEBORDER
constant SysColorActiveCaption (line 35) | SysColorActiveCaption SystemColor = win.COLOR_ACTIVECAPTION
constant SysColorAppWorkspace (line 36) | SysColorAppWorkspace SystemColor = win.COLOR_APPWORKSPACE
constant SysColorBackground (line 37) | SysColorBackground SystemColor = win.COLOR_BACKGROUND
constant SysColorDesktop (line 38) | SysColorDesktop SystemColor = win.COLOR_DESKTOP
constant SysColorBtnFace (line 39) | SysColorBtnFace SystemColor = win.COLOR_BTNFACE
constant SysColorBtnHighlight (line 40) | SysColorBtnHighlight SystemColor = win.COLOR_BTNHIGHLIGHT
constant SysColorBtnShadow (line 41) | SysColorBtnShadow SystemColor = win.COLOR_BTNSHADOW
constant SysColorBtnText (line 42) | SysColorBtnText SystemColor = win.COLOR_BTNTEXT
constant SysColorCaptionText (line 43) | SysColorCaptionText SystemColor = win.COLOR_CAPTIONTEXT
constant SysColorGrayText (line 44) | SysColorGrayText SystemColor = win.COLOR_GRAYTEXT
constant SysColorHighlight (line 45) | SysColorHighlight SystemColor = win.COLOR_HIGHLIGHT
constant SysColorHighlightText (line 46) | SysColorHighlightText SystemColor = win.COLOR_HIGHLIGHTTEXT
constant SysColorInactiveBorder (line 47) | SysColorInactiveBorder SystemColor = win.COLOR_INACTIVEBORDER
constant SysColorInactiveCaption (line 48) | SysColorInactiveCaption SystemColor = win.COLOR_INACTIVECAPTION
constant SysColorInactiveCaptionText (line 49) | SysColorInactiveCaptionText SystemColor = win.COLOR_INACTIVECAPTIONTEXT
constant SysColorInfoBk (line 50) | SysColorInfoBk SystemColor = win.COLOR_INFOBK
constant SysColorInfoText (line 51) | SysColorInfoText SystemColor = win.COLOR_INFOTEXT
constant SysColorMenu (line 52) | SysColorMenu SystemColor = win.COLOR_MENU
constant SysColorMenuText (line 53) | SysColorMenuText SystemColor = win.COLOR_MENUTEXT
constant SysColorScrollBar (line 54) | SysColorScrollBar SystemColor = win.COLOR_SCROLLBAR
constant SysColorWindow (line 55) | SysColorWindow SystemColor = win.COLOR_WINDOW
constant SysColorWindowFrame (line 56) | SysColorWindowFrame SystemColor = win.COLOR_WINDOWFRAME
constant SysColorWindowText (line 57) | SysColorWindowText SystemColor = win.COLOR_WINDOWTEXT
constant SysColorHotLight (line 58) | SysColorHotLight SystemColor = win.COLOR_HOTLIGHT
constant SysColorGradientActiveCaption (line 59) | SysColorGradientActiveCaption SystemColor = win.COLOR_GRADIENTACTIVECA...
constant SysColorGradientInactiveCaption (line 60) | SysColorGradientInactiveCaption SystemColor = win.COLOR_GRADIENTINACTIVE...
type Brush (line 63) | type Brush interface
type perWindowBrush (line 72) | type perWindowBrush interface
type windowBrushInfo (line 77) | type windowBrushInfo struct
type brushBase (line 82) | type brushBase struct
method Dispose (line 87) | func (bb *brushBase) Dispose() {
method handle (line 95) | func (bb *brushBase) handle() win.HBRUSH {
method attachWindow (line 99) | func (bb *brushBase) attachWindow(wb *WindowBase) {
method detachWindow (line 111) | func (bb *brushBase) detachWindow(wb *WindowBase) {
type nullBrush (line 123) | type nullBrush struct
method Dispose (line 138) | func (b *nullBrush) Dispose() {
method logbrush (line 146) | func (*nullBrush) logbrush() *win.LOGBRUSH {
method simple (line 150) | func (*nullBrush) simple() bool {
function newNullBrush (line 127) | func newNullBrush() *nullBrush {
function NullBrush (line 159) | func NullBrush() Brush {
type SystemColorBrush (line 163) | type SystemColorBrush struct
method Color (line 184) | func (b *SystemColorBrush) Color() Color {
method SystemColor (line 188) | func (b *SystemColorBrush) SystemColor() SystemColor {
method Dispose (line 192) | func (*SystemColorBrush) Dispose() {
method logbrush (line 196) | func (b *SystemColorBrush) logbrush() *win.LOGBRUSH {
method simple (line 203) | func (*SystemColorBrush) simple() bool {
function init (line 168) | func init() {
function NewSystemColorBrush (line 175) | func NewSystemColorBrush(sysColor SystemColor) (*SystemColorBrush, error) {
type SolidColorBrush (line 207) | type SolidColorBrush struct
method Color (line 223) | func (b *SolidColorBrush) Color() Color {
method logbrush (line 227) | func (b *SolidColorBrush) logbrush() *win.LOGBRUSH {
method simple (line 231) | func (*SolidColorBrush) simple() bool {
function NewSolidColorBrush (line 212) | func NewSolidColorBrush(color Color) (*SolidColorBrush, error) {
type HatchBrush (line 235) | type HatchBrush struct
method Color (line 252) | func (b *HatchBrush) Color() Color {
method logbrush (line 256) | func (b *HatchBrush) logbrush() *win.LOGBRUSH {
method Style (line 260) | func (b *HatchBrush) Style() HatchStyle {
method simple (line 264) | func (b *HatchBrush) simple() bool {
function NewHatchBrush (line 241) | func NewHatchBrush(color Color, style HatchStyle) (*HatchBrush, error) {
type BitmapBrush (line 268) | type BitmapBrush struct
method logbrush (line 286) | func (b *BitmapBrush) logbrush() *win.LOGBRUSH {
method Bitmap (line 290) | func (b *BitmapBrush) Bitmap() *Bitmap {
method simple (line 294) | func (b *BitmapBrush) simple() bool {
function NewBitmapBrush (line 273) | func NewBitmapBrush(bitmap *Bitmap) (*BitmapBrush, error) {
type GradientStop (line 298) | type GradientStop struct
type GradientVertex (line 303) | type GradientVertex struct
type GradientTriangle (line 309) | type GradientTriangle struct
type GradientBrush (line 315) | type GradientBrush struct
method logbrush (line 405) | func (b *GradientBrush) logbrush() *win.LOGBRUSH {
method simple (line 413) | func (*GradientBrush) simple() bool {
method create (line 418) | func (b *GradientBrush) create(size Size) (*BitmapBrush, error) {
method attachWindow (line 478) | func (b *GradientBrush) attachWindow(wb *WindowBase) {
method detachWindow (line 509) | func (b *GradientBrush) detachWindow(wb *WindowBase) {
method delegateForWindow (line 524) | func (b *GradientBrush) delegateForWindow(wb *WindowBase) Brush {
type gradientOrientation (line 324) | type gradientOrientation
constant gradientOrientationNone (line 327) | gradientOrientationNone gradientOrientation = iota
constant gradientOrientationHorizontal (line 328) | gradientOrientationHorizontal
constant gradientOrientationVertical (line 329) | gradientOrientationVertical
function NewHorizontalGradientBrush (line 332) | func NewHorizontalGradientBrush(stops []GradientStop) (*GradientBrush, e...
function NewVerticalGradientBrush (line 336) | func NewVerticalGradientBrush(stops []GradientStop) (*GradientBrush, err...
function newGradientBrushWithOrientation (line 340) | func newGradientBrushWithOrientation(stops []GradientStop, orientation g...
function NewGradientBrush (line 372) | func NewGradientBrush(vertexes []GradientVertex, triangles []GradientTri...
function newGradientBrush (line 384) | func newGradientBrush(vertexes []GradientVertex, triangles []GradientTri...
FILE: button.go
type clickable (line 16) | type clickable interface
type setCheckeder (line 20) | type setCheckeder interface
type Button (line 24) | type Button struct
method init (line 34) | func (b *Button) init() {
method ApplyDPI (line 71) | func (b *Button) ApplyDPI(dpi int) {
method Image (line 77) | func (b *Button) Image() Image {
method SetImage (line 81) | func (b *Button) SetImage(image Image) error {
method ImageChanged (line 115) | func (b *Button) ImageChanged() *Event {
method Text (line 119) | func (b *Button) Text() string {
method SetText (line 123) | func (b *Button) SetText(value string) error {
method Checked (line 137) | func (b *Button) Checked() bool {
method SetChecked (line 141) | func (b *Button) SetChecked(checked bool) {
method setChecked (line 149) | func (b *Button) setChecked(checked bool) {
method CheckedChanged (line 163) | func (b *Button) CheckedChanged() *Event {
method Persistent (line 167) | func (b *Button) Persistent() bool {
method SetPersistent (line 171) | func (b *Button) SetPersistent(value bool) {
method SaveState (line 175) | func (b *Button) SaveState() error {
method RestoreState (line 179) | func (b *Button) RestoreState() error {
method Clicked (line 190) | func (b *Button) Clicked() *Event {
method raiseClicked (line 194) | func (b *Button) raiseClicked() {
method WndProc (line 198) | func (b *Button) WndProc(hwnd win.HWND, msg uint32, wParam, lParam uin...
method idealSize (line 222) | func (b *Button) idealSize() Size {
method CreateLayoutItem (line 235) | func (b *Button) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
type buttonLayoutItem (line 241) | type buttonLayoutItem struct
method LayoutFlags (line 246) | func (li *buttonLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 250) | func (li *buttonLayoutItem) IdealSize() Size {
method MinSize (line 254) | func (li *buttonLayoutItem) MinSize() Size {
FILE: cancelevent.go
type cancelEventHandlerInfo (line 9) | type cancelEventHandlerInfo struct
type CancelEventHandler (line 14) | type CancelEventHandler
type CancelEvent (line 16) | type CancelEvent struct
method Attach (line 20) | func (e *CancelEvent) Attach(handler CancelEventHandler) int {
method Detach (line 35) | func (e *CancelEvent) Detach(handle int) {
method Once (line 39) | func (e *CancelEvent) Once(handler CancelEventHandler) {
type CancelEventPublisher (line 44) | type CancelEventPublisher struct
method Event (line 48) | func (p *CancelEventPublisher) Event() *CancelEvent {
method Publish (line 52) | func (p *CancelEventPublisher) Publish(canceled *bool) {
FILE: canvas.go
type DrawTextFormat (line 19) | type DrawTextFormat
constant TextTop (line 22) | TextTop DrawTextFormat = win.DT_TOP
constant TextLeft (line 23) | TextLeft DrawTextFormat = win.DT_LEFT
constant TextCenter (line 24) | TextCenter DrawTextFormat = win.DT_CENTER
constant TextRight (line 25) | TextRight DrawTextFormat = win.DT_RIGHT
constant TextVCenter (line 26) | TextVCenter DrawTextFormat = win.DT_VCENTER
constant TextBottom (line 27) | TextBottom DrawTextFormat = win.DT_BOTTOM
constant TextWordbreak (line 28) | TextWordbreak DrawTextFormat = win.DT_WORDBREAK
constant TextSingleLine (line 29) | TextSingleLine DrawTextFormat = win.DT_SINGLELINE
constant TextExpandTabs (line 30) | TextExpandTabs DrawTextFormat = win.DT_EXPANDTABS
constant TextTabstop (line 31) | TextTabstop DrawTextFormat = win.DT_TABSTOP
constant TextNoClip (line 32) | TextNoClip DrawTextFormat = win.DT_NOCLIP
constant TextExternalLeading (line 33) | TextExternalLeading DrawTextFormat = win.DT_EXTERNALLEADING
constant TextCalcRect (line 34) | TextCalcRect DrawTextFormat = win.DT_CALCRECT
constant TextNoPrefix (line 35) | TextNoPrefix DrawTextFormat = win.DT_NOPREFIX
constant TextInternal (line 36) | TextInternal DrawTextFormat = win.DT_INTERNAL
constant TextEditControl (line 37) | TextEditControl DrawTextFormat = win.DT_EDITCONTROL
constant TextPathEllipsis (line 38) | TextPathEllipsis DrawTextFormat = win.DT_PATH_ELLIPSIS
constant TextEndEllipsis (line 39) | TextEndEllipsis DrawTextFormat = win.DT_END_ELLIPSIS
constant TextModifyString (line 40) | TextModifyString DrawTextFormat = win.DT_MODIFYSTRING
constant TextRTLReading (line 41) | TextRTLReading DrawTextFormat = win.DT_RTLREADING
constant TextWordEllipsis (line 42) | TextWordEllipsis DrawTextFormat = win.DT_WORD_ELLIPSIS
constant TextNoFullWidthCharBreak (line 43) | TextNoFullWidthCharBreak DrawTextFormat = win.DT_NOFULLWIDTHCHARBREAK
constant TextHidePrefix (line 44) | TextHidePrefix DrawTextFormat = win.DT_HIDEPREFIX
constant TextPrefixOnly (line 45) | TextPrefixOnly DrawTextFormat = win.DT_PREFIXONLY
function init (line 50) | func init() {
type Canvas (line 56) | type Canvas struct
method init (line 122) | func (c *Canvas) init() (*Canvas, error) {
method Dispose (line 143) | func (c *Canvas) Dispose() {
method DPI (line 169) | func (c *Canvas) DPI() int {
method withGdiObj (line 177) | func (c *Canvas) withGdiObj(handle win.HGDIOBJ, f func() error) error {
method withBrush (line 187) | func (c *Canvas) withBrush(brush Brush, f func() error) error {
method withFontAndTextColor (line 191) | func (c *Canvas) withFontAndTextColor(font *Font, color Color, f func(...
method HDC (line 205) | func (c *Canvas) HDC() win.HDC {
method Bounds (line 209) | func (c *Canvas) Bounds() Rectangle {
method BoundsPixels (line 213) | func (c *Canvas) BoundsPixels() Rectangle {
method withPen (line 220) | func (c *Canvas) withPen(pen Pen, f func() error) error {
method withBrushAndPen (line 224) | func (c *Canvas) withBrushAndPen(brush Brush, pen Pen, f func() error)...
method ellipse (line 233) | func (c *Canvas) ellipse(brush Brush, pen Pen, bounds Rectangle, sizeC...
method ellipsePixels (line 238) | func (c *Canvas) ellipsePixels(brush Brush, pen Pen, bounds Rectangle,...
method DrawEllipse (line 257) | func (c *Canvas) DrawEllipse(pen Pen, bounds Rectangle) error {
method DrawEllipsePixels (line 262) | func (c *Canvas) DrawEllipsePixels(pen Pen, bounds Rectangle) error {
method FillEllipse (line 269) | func (c *Canvas) FillEllipse(brush Brush, bounds Rectangle) error {
method FillEllipsePixels (line 274) | func (c *Canvas) FillEllipsePixels(brush Brush, bounds Rectangle) error {
method DrawImage (line 281) | func (c *Canvas) DrawImage(image Image, location Point) error {
method DrawImagePixels (line 286) | func (c *Canvas) DrawImagePixels(image Image, location Point) error {
method DrawImageStretched (line 297) | func (c *Canvas) DrawImageStretched(image Image, bounds Rectangle) err...
method DrawImageStretchedPixels (line 302) | func (c *Canvas) DrawImageStretchedPixels(image Image, bounds Rectangl...
method DrawBitmapWithOpacity (line 319) | func (c *Canvas) DrawBitmapWithOpacity(bmp *Bitmap, bounds Rectangle, ...
method DrawBitmapWithOpacityPixels (line 325) | func (c *Canvas) DrawBitmapWithOpacityPixels(bmp *Bitmap, bounds Recta...
method DrawBitmapPart (line 334) | func (c *Canvas) DrawBitmapPart(bmp *Bitmap, dst, src Rectangle) error {
method DrawBitmapPartWithOpacity (line 341) | func (c *Canvas) DrawBitmapPartWithOpacity(bmp *Bitmap, dst, src Recta...
method DrawBitmapPartWithOpacityPixels (line 347) | func (c *Canvas) DrawBitmapPartWithOpacityPixels(bmp *Bitmap, dst, src...
method DrawLine (line 358) | func (c *Canvas) DrawLine(pen Pen, from, to Point) error {
method DrawLinePixels (line 364) | func (c *Canvas) DrawLinePixels(pen Pen, from, to Point) error {
method DrawPolyline (line 381) | func (c *Canvas) DrawPolyline(pen Pen, points []Point) error {
method DrawPolylinePixels (line 403) | func (c *Canvas) DrawPolylinePixels(pen Pen, points []Point) error {
method rectangle (line 425) | func (c *Canvas) rectangle(brush Brush, pen Pen, bounds Rectangle, siz...
method rectanglePixels (line 430) | func (c *Canvas) rectanglePixels(brush Brush, pen Pen, bounds Rectangl...
method DrawRectangle (line 449) | func (c *Canvas) DrawRectangle(pen Pen, bounds Rectangle) error {
method DrawRectanglePixels (line 454) | func (c *Canvas) DrawRectanglePixels(pen Pen, bounds Rectangle) error {
method FillRectangle (line 461) | func (c *Canvas) FillRectangle(brush Brush, bounds Rectangle) error {
method FillRectanglePixels (line 466) | func (c *Canvas) FillRectanglePixels(brush Brush, bounds Rectangle) er...
method roundedRectangle (line 474) | func (c *Canvas) roundedRectangle(brush Brush, pen Pen, bounds Rectang...
method roundedRectanglePixels (line 480) | func (c *Canvas) roundedRectanglePixels(brush Brush, pen Pen, bounds R...
method DrawRoundedRectangle (line 502) | func (c *Canvas) DrawRoundedRectangle(pen Pen, bounds Rectangle, ellip...
method DrawRoundedRectanglePixels (line 507) | func (c *Canvas) DrawRoundedRectanglePixels(pen Pen, bounds Rectangle,...
method FillRoundedRectangle (line 516) | func (c *Canvas) FillRoundedRectangle(brush Brush, bounds Rectangle, e...
method FillRoundedRectanglePixels (line 521) | func (c *Canvas) FillRoundedRectanglePixels(brush Brush, bounds Rectan...
method GradientFillRectangle (line 528) | func (c *Canvas) GradientFillRectangle(color1, color2 Color, orientati...
method GradientFillRectanglePixels (line 533) | func (c *Canvas) GradientFillRectanglePixels(color1, color2 Color, ori...
method DrawText (line 572) | func (c *Canvas) DrawText(text string, font *Font, color Color, bounds...
method DrawTextPixels (line 577) | func (c *Canvas) DrawTextPixels(text string, font *Font, color Color, ...
method fontHeight (line 596) | func (c *Canvas) fontHeight(font *Font) (height int, err error) {
method measureTextForDPI (line 615) | func (c *Canvas) measureTextForDPI(text string, font *Font, bounds Rec...
method MeasureText (line 656) | func (c *Canvas) MeasureText(text string, font *Font, bounds Rectangle...
method MeasureTextPixels (line 668) | func (c *Canvas) MeasureTextPixels(text string, font *Font, bounds Rec...
method MeasureAndModifyTextPixels (line 677) | func (c *Canvas) MeasureAndModifyTextPixels(text string, font *Font, b...
method measureAndModifyTextPixels (line 697) | func (c *Canvas) measureAndModifyTextPixels(text string, font *Font, b...
function NewCanvasFromImage (line 67) | func NewCanvasFromImage(image Image) (*Canvas, error) {
function newCanvasFromWindow (line 105) | func newCanvasFromWindow(window Window) (*Canvas, error) {
function newCanvasFromHDC (line 114) | func newCanvasFromHDC(hdc win.HDC) (*Canvas, error) {
FILE: checkbox.go
type CheckState (line 15) | type CheckState
constant CheckUnchecked (line 18) | CheckUnchecked CheckState = win.BST_UNCHECKED
constant CheckChecked (line 19) | CheckChecked CheckState = win.BST_CHECKED
constant CheckIndeterminate (line 20) | CheckIndeterminate CheckState = win.BST_INDETERMINATE
type CheckBox (line 25) | type CheckBox struct
method TextOnLeftSide (line 63) | func (cb *CheckBox) TextOnLeftSide() bool {
method SetTextOnLeftSide (line 67) | func (cb *CheckBox) SetTextOnLeftSide(textLeft bool) error {
method setChecked (line 71) | func (cb *CheckBox) setChecked(checked bool) {
method Tristate (line 77) | func (cb *CheckBox) Tristate() bool {
method SetTristate (line 81) | func (cb *CheckBox) SetTristate(tristate bool) error {
method CheckState (line 92) | func (cb *CheckBox) CheckState() CheckState {
method SetCheckState (line 96) | func (cb *CheckBox) SetCheckState(state CheckState) {
method CheckStateChanged (line 107) | func (cb *CheckBox) CheckStateChanged() *Event {
method SaveState (line 111) | func (cb *CheckBox) SaveState() error {
method RestoreState (line 115) | func (cb *CheckBox) RestoreState() error {
method WndProc (line 131) | func (cb *CheckBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam ...
function NewCheckBox (line 30) | func NewCheckBox(parent Container) (*CheckBox, error) {
FILE: clipboard.go
constant clipboardWindowClass (line 16) | clipboardWindowClass = `\o/ Walk_Clipboard_Class \o/`
function init (line 18) | func init() {
function clipboardWndProc (line 48) | func clipboardWndProc(hwnd win.HWND, msg uint32, wp, lp uintptr) uintptr {
function Clipboard (line 61) | func Clipboard() *ClipboardService {
type ClipboardService (line 66) | type ClipboardService struct
method ContentsChanged (line 73) | func (c *ClipboardService) ContentsChanged() *Event {
method Clear (line 78) | func (c *ClipboardService) Clear() error {
method ContainsText (line 89) | func (c *ClipboardService) ContainsText() (available bool, err error) {
method Text (line 100) | func (c *ClipboardService) Text() (text string, err error) {
method SetText (line 122) | func (c *ClipboardService) SetText(s string) error {
method withOpenClipboard (line 156) | func (c *ClipboardService) withOpenClipboard(f func() error) error {
FILE: closeevent.go
type closeEventHandlerInfo (line 9) | type closeEventHandlerInfo struct
type CloseEventHandler (line 14) | type CloseEventHandler
type CloseEvent (line 16) | type CloseEvent struct
method Attach (line 20) | func (e *CloseEvent) Attach(handler CloseEventHandler) int {
method Detach (line 35) | func (e *CloseEvent) Detach(handle int) {
method Once (line 39) | func (e *CloseEvent) Once(handler CloseEventHandler) {
type CloseEventPublisher (line 44) | type CloseEventPublisher struct
method Event (line 48) | func (p *CloseEventPublisher) Event() *CloseEvent {
method Publish (line 52) | func (p *CloseEventPublisher) Publish(canceled *bool, reason CloseReas...
FILE: color.go
type Color (line 9) | type Color
method R (line 15) | func (c Color) R() byte {
method G (line 19) | func (c Color) G() byte {
method B (line 23) | func (c Color) B() byte {
function RGB (line 11) | func RGB(r, g, b byte) Color {
FILE: combobox.go
type ComboBox (line 21) | type ComboBox struct
method applyFont (line 238) | func (cb *ComboBox) applyFont(font *Font) {
method Editable (line 247) | func (cb *ComboBox) Editable() bool {
method itemString (line 251) | func (cb *ComboBox) itemString(index int) string {
method insertItemAt (line 269) | func (cb *ComboBox) insertItemAt(index int) error {
method removeItem (line 280) | func (cb *ComboBox) removeItem(index int) error {
method resetItems (line 288) | func (cb *ComboBox) resetItems() error {
method attachModel (line 326) | func (cb *ComboBox) attachModel() {
method detachModel (line 356) | func (cb *ComboBox) detachModel() {
method Model (line 364) | func (cb *ComboBox) Model() interface{} {
method SetModel (line 372) | func (cb *ComboBox) SetModel(mdl interface{}) error {
method BindingMember (line 422) | func (cb *ComboBox) BindingMember() string {
method SetBindingMember (line 442) | func (cb *ComboBox) SetBindingMember(bindingMember string) error {
method DisplayMember (line 463) | func (cb *ComboBox) DisplayMember() string {
method SetDisplayMember (line 483) | func (cb *ComboBox) SetDisplayMember(displayMember string) error {
method Format (line 499) | func (cb *ComboBox) Format() string {
method SetFormat (line 503) | func (cb *ComboBox) SetFormat(value string) {
method Precision (line 507) | func (cb *ComboBox) Precision() int {
method SetPrecision (line 511) | func (cb *ComboBox) SetPrecision(value int) {
method MaxLength (line 515) | func (cb *ComboBox) MaxLength() int {
method SetMaxLength (line 519) | func (cb *ComboBox) SetMaxLength(value int) {
method calculateMaxItemTextWidth (line 526) | func (cb *ComboBox) calculateMaxItemTextWidth() int {
method CurrentIndex (line 555) | func (cb *ComboBox) CurrentIndex() int {
method SetCurrentIndex (line 559) | func (cb *ComboBox) SetCurrentIndex(value int) error {
method CurrentIndexChanged (line 580) | func (cb *ComboBox) CurrentIndexChanged() *Event {
method Text (line 584) | func (cb *ComboBox) Text() string {
method SetText (line 588) | func (cb *ComboBox) SetText(value string) error {
method TextSelection (line 609) | func (cb *ComboBox) TextSelection() (start, end int) {
method SetTextSelection (line 614) | func (cb *ComboBox) SetTextSelection(start, end int) {
method TextChanged (line 618) | func (cb *ComboBox) TextChanged() *Event {
method EditingFinished (line 622) | func (cb *ComboBox) EditingFinished() *Event {
method Persistent (line 626) | func (cb *ComboBox) Persistent() bool {
method SetPersistent (line 630) | func (cb *ComboBox) SetPersistent(value bool) {
method SaveState (line 634) | func (cb *ComboBox) SaveState() error {
method RestoreState (line 640) | func (cb *ComboBox) RestoreState() error {
method WndProc (line 656) | func (cb *ComboBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam ...
method NeedsWmSize (line 721) | func (*ComboBox) NeedsWmSize() bool {
method CreateLayoutItem (line 725) | func (cb *ComboBox) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function init (line 49) | func init() {
function comboBoxEditWndProc (line 55) | func comboBoxEditWndProc(hwnd win.HWND, msg uint32, wParam, lParam uintp...
function NewComboBox (line 103) | func NewComboBox(parent Container) (*ComboBox, error) {
function NewDropDownBox (line 117) | func NewDropDownBox(parent Container) (*ComboBox, error) {
function newComboBoxWithStyle (line 121) | func newComboBoxWithStyle(parent Container, style uint32) (*ComboBox, er...
type comboBoxLayoutItem (line 749) | type comboBoxLayoutItem struct
method LayoutFlags (line 755) | func (li *comboBoxLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 759) | func (li *comboBoxLayoutItem) IdealSize() Size {
method MinSize (line 763) | func (li *comboBoxLayoutItem) MinSize() Size {
FILE: commondialogs.go
type FileDialog (line 20) | type FileDialog struct
method show (line 31) | func (dlg *FileDialog) show(owner Form, fun func(ofn *win.OPENFILENAME...
method ShowOpen (line 118) | func (dlg *FileDialog) ShowOpen(owner Form) (accepted bool, err error) {
method ShowOpenMultiple (line 122) | func (dlg *FileDialog) ShowOpenMultiple(owner Form) (accepted bool, er...
method ShowSave (line 126) | func (dlg *FileDialog) ShowSave(owner Form) (accepted bool, err error) {
method ShowBrowseFolder (line 165) | func (dlg *FileDialog) ShowBrowseFolder(owner Form) (accepted bool, er...
function pathFromPIDL (line 130) | func pathFromPIDL(pidl uintptr) (string, error) {
function browseFolderCallback (line 140) | func browseFolderCallback(hwnd win.HWND, msg uint32, lp, wp uintptr) uin...
function init (line 159) | func init() {
FILE: composite.go
constant compositeWindowClass (line 13) | compositeWindowClass = `\o/ Walk_Composite_Class \o/`
function init (line 15) | func init() {
type Composite (line 21) | type Composite struct
function NewCompositeWithStyle (line 25) | func NewCompositeWithStyle(parent Window, style uint32) (*Composite, err...
function NewComposite (line 44) | func NewComposite(parent Container) (*Composite, error) {
FILE: condition.go
type Condition (line 9) | type Condition interface
type MutableCondition (line 14) | type MutableCondition struct
method Value (line 23) | func (mc *MutableCondition) Value() interface{} {
method Satisfied (line 27) | func (mc *MutableCondition) Satisfied() bool {
method SetSatisfied (line 31) | func (mc *MutableCondition) SetSatisfied(satisfied bool) error {
method Changed (line 43) | func (mc *MutableCondition) Changed() *Event {
function NewMutableCondition (line 19) | func NewMutableCondition() *MutableCondition {
type DelegateCondition (line 47) | type DelegateCondition struct
method Value (line 56) | func (dc *DelegateCondition) Value() interface{} {
method Satisfied (line 60) | func (dc *DelegateCondition) Satisfied() bool {
method Changed (line 64) | func (dc *DelegateCondition) Changed() *Event {
function NewDelegateCondition (line 52) | func NewDelegateCondition(satisfied func() bool, changed *Event) *Delega...
type compositeCondition (line 68) | type compositeCondition struct
method init (line 74) | func (cc *compositeCondition) init(items []Condition) {
method satisfied (line 85) | func (cc *compositeCondition) satisfied(all bool) bool {
method Changed (line 95) | func (cc *compositeCondition) Changed() *Event {
method Dispose (line 99) | func (cc *compositeCondition) Dispose() {
type allCondition (line 105) | type allCondition struct
method Value (line 117) | func (ac *allCondition) Value() interface{} {
method Satisfied (line 121) | func (ac *allCondition) Satisfied() bool {
function NewAllCondition (line 109) | func NewAllCondition(items ...Condition) Condition {
type anyCondition (line 125) | type anyCondition struct
method Value (line 137) | func (ac *anyCondition) Value() interface{} {
method Satisfied (line 141) | func (ac *anyCondition) Satisfied() bool {
function NewAnyCondition (line 129) | func NewAnyCondition(items ...Condition) Condition {
type negatedCondition (line 145) | type negatedCondition struct
method Value (line 153) | func (nc *negatedCondition) Value() interface{} {
method Satisfied (line 157) | func (nc *negatedCondition) Satisfied() bool {
method Changed (line 161) | func (nc *negatedCondition) Changed() *Event {
function NewNegatedCondition (line 149) | func NewNegatedCondition(other Condition) Condition {
FILE: container.go
type Container (line 17) | type Container interface
type ContainerBase (line 27) | type ContainerBase struct
method AsWidgetBase (line 36) | func (cb *ContainerBase) AsWidgetBase() *WidgetBase {
method AsContainerBase (line 40) | func (cb *ContainerBase) AsContainerBase() *ContainerBase {
method NextChildID (line 44) | func (cb *ContainerBase) NextChildID() int32 {
method applyEnabled (line 49) | func (cb *ContainerBase) applyEnabled(enabled bool) {
method applyFont (line 63) | func (cb *ContainerBase) applyFont(font *Font) {
method ApplySysColors (line 69) | func (cb *ContainerBase) ApplySysColors() {
method ApplyDPI (line 75) | func (cb *ContainerBase) ApplyDPI(dpi int) {
method Children (line 93) | func (cb *ContainerBase) Children() *WidgetList {
method Layout (line 97) | func (cb *ContainerBase) Layout() Layout {
method SetLayout (line 101) | func (cb *ContainerBase) SetLayout(value Layout) error {
method CreateLayoutItem (line 117) | func (cb *ContainerBase) CreateLayoutItem(ctx *LayoutContext) LayoutIt...
method DataBinder (line 121) | func (cb *ContainerBase) DataBinder() *DataBinder {
method SetDataBinder (line 125) | func (cb *ContainerBase) SetDataBinder(db *DataBinder) {
method forEachPersistableChild (line 162) | func (cb *ContainerBase) forEachPersistableChild(f func(p Persistable)...
method Persistent (line 178) | func (cb *ContainerBase) Persistent() bool {
method SetPersistent (line 182) | func (cb *ContainerBase) SetPersistent(value bool) {
method SaveState (line 186) | func (cb *ContainerBase) SaveState() error {
method RestoreState (line 192) | func (cb *ContainerBase) RestoreState() error {
method doPaint (line 198) | func (cb *ContainerBase) doPaint() error {
method WndProc (line 272) | func (cb *ContainerBase) WndProc(hwnd win.HWND, msg uint32, wParam, lP...
method onInsertingWidget (line 392) | func (cb *ContainerBase) onInsertingWidget(index int, widget Widget) (...
method onInsertedWidget (line 396) | func (cb *ContainerBase) onInsertedWidget(index int, widget Widget) (e...
method onRemovingWidget (line 410) | func (cb *ContainerBase) onRemovingWidget(index int, widget Widget) (e...
method onRemovedWidget (line 422) | func (cb *ContainerBase) onRemovedWidget(index int, widget Widget) (er...
method onClearingWidgets (line 428) | func (cb *ContainerBase) onClearingWidgets() (err error) {
method onClearedWidgets (line 442) | func (cb *ContainerBase) onClearedWidgets() (err error) {
method focusFirstCandidateDescendant (line 448) | func (cb *ContainerBase) focusFirstCandidateDescendant() {
function firstFocusableDescendantCallback (line 469) | func firstFocusableDescendantCallback(hwnd win.HWND, lParam uintptr) uin...
function init (line 491) | func init() {
function firstFocusableDescendant (line 497) | func firstFocusableDescendant(container Container) Window {
type textSelectable (line 512) | type textSelectable interface
function DescendantByName (line 516) | func DescendantByName(container Container, name string) Widget {
FILE: cursor.go
type Cursor (line 17) | type Cursor interface
type stockCursor (line 22) | type stockCursor struct
method Dispose (line 26) | func (sc stockCursor) Dispose() {
method handle (line 30) | func (sc stockCursor) handle() win.HCURSOR {
function CursorArrow (line 34) | func CursorArrow() Cursor {
function CursorIBeam (line 38) | func CursorIBeam() Cursor {
function CursorWait (line 42) | func CursorWait() Cursor {
function CursorCross (line 46) | func CursorCross() Cursor {
function CursorUpArrow (line 50) | func CursorUpArrow() Cursor {
function CursorSizeNWSE (line 54) | func CursorSizeNWSE() Cursor {
function CursorSizeNESW (line 58) | func CursorSizeNESW() Cursor {
function CursorSizeWE (line 62) | func CursorSizeWE() Cursor {
function CursorSizeNS (line 66) | func CursorSizeNS() Cursor {
function CursorSizeAll (line 70) | func CursorSizeAll() Cursor {
function CursorNo (line 74) | func CursorNo() Cursor {
function CursorHand (line 78) | func CursorHand() Cursor {
function CursorAppStarting (line 82) | func CursorAppStarting() Cursor {
function CursorHelp (line 86) | func CursorHelp() Cursor {
function CursorIcon (line 90) | func CursorIcon() Cursor {
function CursorSize (line 94) | func CursorSize() Cursor {
type customCursor (line 98) | type customCursor struct
method Dispose (line 110) | func (cc customCursor) Dispose() {
method handle (line 114) | func (cc customCursor) handle() win.HCURSOR {
function NewCursorFromImage (line 102) | func NewCursorFromImage(im image.Image, hotspot image.Point) (Cursor, er...
FILE: customwidget.go
constant customWidgetWindowClass (line 15) | customWidgetWindowClass = `\o/ Walk_CustomWidget_Class \o/`
function init (line 17) | func init() {
type PaintFunc (line 24) | type PaintFunc
type PaintMode (line 26) | type PaintMode
constant PaintNormal (line 29) | PaintNormal PaintMode = iota
constant PaintNoErase (line 30) | PaintNoErase
constant PaintBuffered (line 31) | PaintBuffered
type CustomWidget (line 34) | type CustomWidget struct
method init (line 68) | func (cw *CustomWidget) init(parent Container, style uint) error {
method ClearsBackground (line 82) | func (cw *CustomWidget) ClearsBackground() bool {
method SetClearsBackground (line 87) | func (cw *CustomWidget) SetClearsBackground(value bool) {
method InvalidatesOnResize (line 97) | func (cw *CustomWidget) InvalidatesOnResize() bool {
method SetInvalidatesOnResize (line 101) | func (cw *CustomWidget) SetInvalidatesOnResize(value bool) {
method PaintMode (line 105) | func (cw *CustomWidget) PaintMode() PaintMode {
method SetPaintMode (line 109) | func (cw *CustomWidget) SetPaintMode(value PaintMode) {
method WndProc (line 113) | func (cw *CustomWidget) WndProc(hwnd win.HWND, msg uint32, wParam, lPa...
method bufferedPaint (line 186) | func (cw *CustomWidget) bufferedPaint(canvas *Canvas, updateBounds Rec...
method CreateLayoutItem (line 237) | func (*CustomWidget) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function NewCustomWidget (line 47) | func NewCustomWidget(parent Container, style uint, paint PaintFunc) (*Cu...
function NewCustomWidgetPixels (line 58) | func NewCustomWidgetPixels(parent Container, style uint, paintPixels Pai...
FILE: databinding.go
type ErrorPresenter (line 21) | type ErrorPresenter interface
type DataBinder (line 25) | type DataBinder struct
method AutoSubmit (line 55) | func (db *DataBinder) AutoSubmit() bool {
method SetAutoSubmit (line 59) | func (db *DataBinder) SetAutoSubmit(autoSubmit bool) {
method AutoSubmitDelay (line 66) | func (db *DataBinder) AutoSubmitDelay() time.Duration {
method SetAutoSubmitDelay (line 70) | func (db *DataBinder) SetAutoSubmitDelay(delay time.Duration) {
method AutoSubmitSuspended (line 74) | func (db *DataBinder) AutoSubmitSuspended() bool {
method SetAutoSubmitSuspended (line 78) | func (db *DataBinder) SetAutoSubmitSuspended(suspended bool) {
method Submitted (line 94) | func (db *DataBinder) Submitted() *Event {
method DataSource (line 98) | func (db *DataBinder) DataSource() interface{} {
method SetDataSource (line 102) | func (db *DataBinder) SetDataSource(dataSource interface{}) error {
method DataSourceChanged (line 133) | func (db *DataBinder) DataSourceChanged() *Event {
method BoundWidgets (line 137) | func (db *DataBinder) BoundWidgets() []Widget {
method SetBoundWidgets (line 141) | func (db *DataBinder) SetBoundWidgets(boundWidgets []Widget) {
method Expression (line 200) | func (db *DataBinder) Expression(path string) Expression {
method validateProperties (line 216) | func (db *DataBinder) validateProperties() {
method ErrorPresenter (line 243) | func (db *DataBinder) ErrorPresenter() ErrorPresenter {
method SetErrorPresenter (line 247) | func (db *DataBinder) SetErrorPresenter(ep ErrorPresenter) {
method CanSubmit (line 251) | func (db *DataBinder) CanSubmit() bool {
method CanSubmitChanged (line 255) | func (db *DataBinder) CanSubmitChanged() *Event {
method Reset (line 259) | func (db *DataBinder) Reset() error {
method ResetFinished (line 334) | func (db *DataBinder) ResetFinished() *Event {
method Submit (line 338) | func (db *DataBinder) Submit() error {
method Dirty (line 356) | func (db *DataBinder) Dirty() bool {
method submitProperty (line 360) | func (db *DataBinder) submitProperty(prop Property, field DataField) e...
method forEach (line 381) | func (db *DataBinder) forEach(f func(prop Property, field DataField) e...
method fieldBoundToProperty (line 405) | func (db *DataBinder) fieldBoundToProperty(v reflect.Value, prop Prope...
function NewDataBinder (line 47) | func NewDataBinder() *DataBinder {
type dataBinderRootExpression (line 121) | type dataBinderRootExpression struct
method Value (line 125) | func (dbre *dataBinderRootExpression) Value() interface{} {
method Changed (line 129) | func (dbre *dataBinderRootExpression) Changed() *Event {
function validateBindingMemberSyntax (line 423) | func validateBindingMemberSyntax(member string) error {
type DataField (line 428) | type DataField interface
function dataFieldFromPath (line 435) | func dataFieldFromPath(root reflect.Value, path string) (DataField, erro...
function reflectValueFromPath (line 449) | func reflectValueFromPath(root reflect.Value, path string) (parent, valu...
function nextPathPart (line 533) | func nextPathPart(p string) (next, remaining string) {
type nilField (line 542) | type nilField struct
method CanSet (line 546) | func (nilField) CanSet() bool {
method Get (line 550) | func (f nilField) Get() interface{} {
method Set (line 554) | func (nilField) Set(interface{}) error {
method Zero (line 558) | func (f nilField) Zero() interface{} {
type reflectField (line 562) | type reflectField struct
method CanSet (line 568) | func (f *reflectField) CanSet() bool {
method Get (line 576) | func (f *reflectField) Get() interface{} {
method Set (line 580) | func (f *reflectField) Set(value interface{}) error {
method Zero (line 609) | func (f *reflectField) Zero() interface{} {
FILE: dateedit.go
type DateEdit (line 18) | type DateEdit struct
method systemTimeToTime (line 63) | func (de *DateEdit) systemTimeToTime(st *win.SYSTEMTIME) time.Time {
method timeToSystemTime (line 78) | func (de *DateEdit) timeToSystemTime(t time.Time) *win.SYSTEMTIME {
method systemTime (line 106) | func (de *DateEdit) systemTime() (*win.SYSTEMTIME, error) {
method setSystemTime (line 120) | func (de *DateEdit) setSystemTime(st *win.SYSTEMTIME) error {
method timeOfDayDisplayed (line 139) | func (de *DateEdit) timeOfDayDisplayed() bool {
method Format (line 143) | func (de *DateEdit) Format() string {
method SetFormat (line 147) | func (de *DateEdit) SetFormat(format string) error {
method Range (line 159) | func (de *DateEdit) Range() (min, max time.Time) {
method SetRange (line 175) | func (de *DateEdit) SetRange(min, max time.Time) error {
method Date (line 204) | func (de *DateEdit) Date() time.Time {
method SetDate (line 213) | func (de *DateEdit) SetDate(date time.Time) error {
method DateChanged (line 231) | func (de *DateEdit) DateChanged() *Event {
method WndProc (line 235) | func (de *DateEdit) WndProc(hwnd win.HWND, msg uint32, wParam, lParam ...
method NeedsWmSize (line 247) | func (*DateEdit) NeedsWmSize() bool {
method CreateLayoutItem (line 251) | func (de *DateEdit) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function newDateEdit (line 24) | func newDateEdit(parent Container, style uint32) (*DateEdit, error) {
function NewDateEdit (line 55) | func NewDateEdit(parent Container) (*DateEdit, error) {
function NewDateEditWithNoneOption (line 59) | func NewDateEditWithNoneOption(parent Container) (*DateEdit, error) {
type dateEditLayoutItem (line 257) | type dateEditLayoutItem struct
method LayoutFlags (line 262) | func (*dateEditLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 266) | func (li *dateEditLayoutItem) IdealSize() Size {
method MinSize (line 270) | func (li *dateEditLayoutItem) MinSize() Size {
FILE: datelabel.go
type DateLabel (line 13) | type DateLabel struct
method asStatic (line 54) | func (dl *DateLabel) asStatic() *static {
method TextAlignment (line 58) | func (dl *DateLabel) TextAlignment() Alignment1D {
method SetTextAlignment (line 62) | func (dl *DateLabel) SetTextAlignment(alignment Alignment1D) error {
method Date (line 70) | func (dl *DateLabel) Date() time.Time {
method SetDate (line 74) | func (dl *DateLabel) SetDate(date time.Time) error {
method Format (line 93) | func (dl *DateLabel) Format() string {
method SetFormat (line 97) | func (dl *DateLabel) SetFormat(format string) error {
method updateText (line 116) | func (dl *DateLabel) updateText() (changed bool, err error) {
function NewDateLabel (line 21) | func NewDateLabel(parent Container) (*DateLabel, error) {
FILE: declarative/accessibility.go
type AccState (line 14) | type AccState
constant AccStateNormal (line 18) | AccStateNormal = AccState(walk.AccStateNormal)
constant AccStateUnavailable (line 19) | AccStateUnavailable = AccState(walk.AccStateUnavailable)
constant AccStateSelected (line 20) | AccStateSelected = AccState(walk.AccStateSelected)
constant AccStateFocused (line 21) | AccStateFocused = AccState(walk.AccStateFocused)
constant AccStatePressed (line 22) | AccStatePressed = AccState(walk.AccStatePressed)
constant AccStateChecked (line 23) | AccStateChecked = AccState(walk.AccStateChecked)
constant AccStateMixed (line 24) | AccStateMixed = AccState(walk.AccStateMixed)
constant AccStateIndeterminate (line 25) | AccStateIndeterminate = AccState(walk.AccStateIndeterminate)
constant AccStateReadonly (line 26) | AccStateReadonly = AccState(walk.AccStateReadonly)
constant AccStateHotTracked (line 27) | AccStateHotTracked = AccState(walk.AccStateHotTracked)
constant AccStateDefault (line 28) | AccStateDefault = AccState(walk.AccStateDefault)
constant AccStateExpanded (line 29) | AccStateExpanded = AccState(walk.AccStateExpanded)
constant AccStateCollapsed (line 30) | AccStateCollapsed = AccState(walk.AccStateCollapsed)
constant AccStateBusy (line 31) | AccStateBusy = AccState(walk.AccStateBusy)
constant AccStateFloating (line 32) | AccStateFloating = AccState(walk.AccStateFloating)
constant AccStateMarqueed (line 33) | AccStateMarqueed = AccState(walk.AccStateMarqueed)
constant AccStateAnimated (line 34) | AccStateAnimated = AccState(walk.AccStateAnimated)
constant AccStateInvisible (line 35) | AccStateInvisible = AccState(walk.AccStateInvisible)
constant AccStateOffscreen (line 36) | AccStateOffscreen = AccState(walk.AccStateOffscreen)
constant AccStateSizeable (line 37) | AccStateSizeable = AccState(walk.AccStateSizeable)
constant AccStateMoveable (line 38) | AccStateMoveable = AccState(walk.AccStateMoveable)
constant AccStateSelfVoicing (line 39) | AccStateSelfVoicing = AccState(walk.AccStateSelfVoicing)
constant AccStateFocusable (line 40) | AccStateFocusable = AccState(walk.AccStateFocusable)
constant AccStateSelectable (line 41) | AccStateSelectable = AccState(walk.AccStateSelectable)
constant AccStateLinked (line 42) | AccStateLinked = AccState(walk.AccStateLinked)
constant AccStateTraversed (line 43) | AccStateTraversed = AccState(walk.AccStateTraversed)
constant AccStateMultiselectable (line 44) | AccStateMultiselectable = AccState(walk.AccStateMultiselectable)
constant AccStateExtselectable (line 45) | AccStateExtselectable = AccState(walk.AccStateExtselectable)
constant AccStateAlertLow (line 46) | AccStateAlertLow = AccState(walk.AccStateAlertLow)
constant AccStateAlertMedium (line 47) | AccStateAlertMedium = AccState(walk.AccStateAlertMedium)
constant AccStateAlertHigh (line 48) | AccStateAlertHigh = AccState(walk.AccStateAlertHigh)
constant AccStateProtected (line 49) | AccStateProtected = AccState(walk.AccStateProtected)
constant AccStateHasPopup (line 50) | AccStateHasPopup = AccState(walk.AccStateHasPopup)
constant AccStateValid (line 51) | AccStateValid = AccState(walk.AccStateValid)
type AccRole (line 55) | type AccRole
constant AccRoleTitlebar (line 59) | AccRoleTitlebar = AccRole(walk.AccRoleTitlebar)
constant AccRoleMenubar (line 60) | AccRoleMenubar = AccRole(walk.AccRoleMenubar)
constant AccRoleScrollbar (line 61) | AccRoleScrollbar = AccRole(walk.AccRoleScrollbar)
constant AccRoleGrip (line 62) | AccRoleGrip = AccRole(walk.AccRoleGrip)
constant AccRoleSound (line 63) | AccRoleSound = AccRole(walk.AccRoleSound)
constant AccRoleCursor (line 64) | AccRoleCursor = AccRole(walk.AccRoleCursor)
constant AccRoleCaret (line 65) | AccRoleCaret = AccRole(walk.AccRoleCaret)
constant AccRoleAlert (line 66) | AccRoleAlert = AccRole(walk.AccRoleAlert)
constant AccRoleWindow (line 67) | AccRoleWindow = AccRole(walk.AccRoleWindow)
constant AccRoleClient (line 68) | AccRoleClient = AccRole(walk.AccRoleClient)
constant AccRoleMenuPopup (line 69) | AccRoleMenuPopup = AccRole(walk.AccRoleMenuPopup)
constant AccRoleMenuItem (line 70) | AccRoleMenuItem = AccRole(walk.AccRoleMenuItem)
constant AccRoleTooltip (line 71) | AccRoleTooltip = AccRole(walk.AccRoleTooltip)
constant AccRoleApplication (line 72) | AccRoleApplication = AccRole(walk.AccRoleApplication)
constant AccRoleDocument (line 73) | AccRoleDocument = AccRole(walk.AccRoleDocument)
constant AccRolePane (line 74) | AccRolePane = AccRole(walk.AccRolePane)
constant AccRoleChart (line 75) | AccRoleChart = AccRole(walk.AccRoleChart)
constant AccRoleDialog (line 76) | AccRoleDialog = AccRole(walk.AccRoleDialog)
constant AccRoleBorder (line 77) | AccRoleBorder = AccRole(walk.AccRoleBorder)
constant AccRoleGrouping (line 78) | AccRoleGrouping = AccRole(walk.AccRoleGrouping)
constant AccRoleSeparator (line 79) | AccRoleSeparator = AccRole(walk.AccRoleSeparator)
constant AccRoleToolbar (line 80) | AccRoleToolbar = AccRole(walk.AccRoleToolbar)
constant AccRoleStatusbar (line 81) | AccRoleStatusbar = AccRole(walk.AccRoleStatusbar)
constant AccRoleTable (line 82) | AccRoleTable = AccRole(walk.AccRoleTable)
constant AccRoleColumnHeader (line 83) | AccRoleColumnHeader = AccRole(walk.AccRoleColumnHeader)
constant AccRoleRowHeader (line 84) | AccRoleRowHeader = AccRole(walk.AccRoleRowHeader)
constant AccRoleColumn (line 85) | AccRoleColumn = AccRole(walk.AccRoleColumn)
constant AccRoleRow (line 86) | AccRoleRow = AccRole(walk.AccRoleRow)
constant AccRoleCell (line 87) | AccRoleCell = AccRole(walk.AccRoleCell)
constant AccRoleLink (line 88) | AccRoleLink = AccRole(walk.AccRoleLink)
constant AccRoleHelpBalloon (line 89) | AccRoleHelpBalloon = AccRole(walk.AccRoleHelpBalloon)
constant AccRoleCharacter (line 90) | AccRoleCharacter = AccRole(walk.AccRoleCharacter)
constant AccRoleList (line 91) | AccRoleList = AccRole(walk.AccRoleList)
constant AccRoleListItem (line 92) | AccRoleListItem = AccRole(walk.AccRoleListItem)
constant AccRoleOutline (line 93) | AccRoleOutline = AccRole(walk.AccRoleOutline)
constant AccRoleOutlineItem (line 94) | AccRoleOutlineItem = AccRole(walk.AccRoleOutlineItem)
constant AccRolePagetab (line 95) | AccRolePagetab = AccRole(walk.AccRolePagetab)
constant AccRolePropertyPage (line 96) | AccRolePropertyPage = AccRole(walk.AccRolePropertyPage)
constant AccRoleIndicator (line 97) | AccRoleIndicator = AccRole(walk.AccRoleIndicator)
constant AccRoleGraphic (line 98) | AccRoleGraphic = AccRole(walk.AccRoleGraphic)
constant AccRoleStatictext (line 99) | AccRoleStatictext = AccRole(walk.AccRoleStatictext)
constant AccRoleText (line 100) | AccRoleText = AccRole(walk.AccRoleText)
constant AccRolePushbutton (line 101) | AccRolePushbutton = AccRole(walk.AccRolePushbutton)
constant AccRoleCheckbutton (line 102) | AccRoleCheckbutton = AccRole(walk.AccRoleCheckbutton)
constant AccRoleRadiobutton (line 103) | AccRoleRadiobutton = AccRole(walk.AccRoleRadiobutton)
constant AccRoleCombobox (line 104) | AccRoleCombobox = AccRole(walk.AccRoleCombobox)
constant AccRoleDroplist (line 105) | AccRoleDroplist = AccRole(walk.AccRoleDroplist)
constant AccRoleProgressbar (line 106) | AccRoleProgressbar = AccRole(walk.AccRoleProgressbar)
constant AccRoleDial (line 107) | AccRoleDial = AccRole(walk.AccRoleDial)
constant AccRoleHotkeyfield (line 108) | AccRoleHotkeyfield = AccRole(walk.AccRoleHotkeyfield)
constant AccRoleSlider (line 109) | AccRoleSlider = AccRole(walk.AccRoleSlider)
constant AccRoleSpinbutton (line 110) | AccRoleSpinbutton = AccRole(walk.AccRoleSpinbutton)
constant AccRoleDiagram (line 111) | AccRoleDiagram = AccRole(walk.AccRoleDiagram)
constant AccRoleAnimation (line 112) | AccRoleAnimation = AccRole(walk.AccRoleAnimation)
constant AccRoleEquation (line 113) | AccRoleEquation = AccRole(walk.AccRoleEquation)
constant AccRoleButtonDropdown (line 114) | AccRoleButtonDropdown = AccRole(walk.AccRoleButtonDropdown)
constant AccRoleButtonMenu (line 115) | AccRoleButtonMenu = AccRole(walk.AccRoleButtonMenu)
constant AccRoleButtonDropdownGrid (line 116) | AccRoleButtonDropdownGrid = AccRole(walk.AccRoleButtonDropdownGrid)
constant AccRoleWhitespace (line 117) | AccRoleWhitespace = AccRole(walk.AccRoleWhitespace)
constant AccRolePageTabList (line 118) | AccRolePageTabList = AccRole(walk.AccRolePageTabList)
constant AccRoleClock (line 119) | AccRoleClock = AccRole(walk.AccRoleClock)
constant AccRoleSplitButton (line 120) | AccRoleSplitButton = AccRole(walk.AccRoleSplitButton)
constant AccRoleIPAddress (line 121) | AccRoleIPAddress = AccRole(walk.AccRoleIPAddress)
constant AccRoleOutlineButton (line 122) | AccRoleOutlineButton = AccRole(walk.AccRoleOutlineButton)
type Accessibility (line 126) | type Accessibility struct
FILE: declarative/action.go
type Shortcut (line 15) | type Shortcut struct
type Action (line 20) | type Action struct
method createAction (line 32) | func (a Action) createAction(builder *Builder, menu *walk.Menu) (*walk...
type ActionRef (line 78) | type ActionRef struct
method createAction (line 82) | func (ar ActionRef) createAction(builder *Builder, menu *walk.Menu) (*...
type Menu (line 92) | type Menu struct
method createAction (line 103) | func (m Menu) createAction(builder *Builder, menu *walk.Menu) (*walk.A...
type Separator (line 150) | type Separator struct
method createAction (line 153) | func (s Separator) createAction(builder *Builder, menu *walk.Menu) (*w...
function addToActionList (line 165) | func addToActionList(list *walk.ActionList, actions []*walk.Action) error {
function setActionImage (line 175) | func setActionImage(action *walk.Action, image interface{}, dpi int) (er...
function setActionBoolOrCondition (line 198) | func setActionBoolOrCondition(setBool func(bool) error, setCond func(wal...
FILE: declarative/brush.go
type TransparentBrush (line 15) | type TransparentBrush struct
method Create (line 18) | func (TransparentBrush) Create() (walk.Brush, error) {
type SolidColorBrush (line 22) | type SolidColorBrush struct
method Create (line 26) | func (scb SolidColorBrush) Create() (walk.Brush, error) {
type SystemColorBrush (line 30) | type SystemColorBrush struct
method Create (line 34) | func (scb SystemColorBrush) Create() (walk.Brush, error) {
type BitmapBrush (line 38) | type BitmapBrush struct
method Create (line 42) | func (bb BitmapBrush) Create() (walk.Brush, error) {
type GradientBrush (line 67) | type GradientBrush struct
method Create (line 72) | func (gb GradientBrush) Create() (walk.Brush, error) {
type HorizontalGradientBrush (line 76) | type HorizontalGradientBrush struct
method Create (line 80) | func (hgb HorizontalGradientBrush) Create() (walk.Brush, error) {
type VerticalGradientBrush (line 84) | type VerticalGradientBrush struct
method Create (line 88) | func (vgb VerticalGradientBrush) Create() (walk.Brush, error) {
FILE: declarative/builder.go
function init (line 25) | func init() {
function MustRegisterCondition (line 31) | func MustRegisterCondition(name string, condition walk.Condition) {
type declWidget (line 45) | type declWidget struct
type Builder (line 50) | type Builder struct
method Parent (line 86) | func (b *Builder) Parent() walk.Container {
method Defer (line 90) | func (b *Builder) Defer(f func() error) {
method deferBuildMenuActions (line 94) | func (b *Builder) deferBuildMenuActions(menu *walk.Menu, items []MenuI...
method deferBuildActions (line 108) | func (b *Builder) deferBuildActions(actionList *walk.ActionList, items...
method InitWidget (line 126) | func (b *Builder) InitWidget(d Widget, w walk.Window, customInit func(...
method initAccessibility (line 453) | func (b *Builder) initAccessibility(d Widget, w walk.Window) error {
method alignment (line 503) | func (b *Builder) alignment() Alignment2D {
method bool (line 513) | func (b *Builder) bool(fieldName string) bool {
method eventHandler (line 523) | func (b *Builder) eventHandler(fieldName string) walk.EventHandler {
method float64 (line 533) | func (b *Builder) float64(fieldName string) float64 {
method int (line 543) | func (b *Builder) int(fieldName string) int {
method keyEventHandler (line 553) | func (b *Builder) keyEventHandler(fieldName string) walk.KeyEventHandl...
method menuItems (line 563) | func (b *Builder) menuItems(fieldName string) []MenuItem {
method mouseEventHandler (line 573) | func (b *Builder) mouseEventHandler(fieldName string) walk.MouseEventH...
method size (line 583) | func (b *Builder) size(fieldName string) Size {
method string (line 593) | func (b *Builder) string(fieldName string) string {
method initProperties (line 603) | func (b *Builder) initProperties() error {
method conditionOrProperty (line 676) | func (b *Builder) conditionOrProperty(data Property) interface{} {
function NewBuilder (line 68) | func NewBuilder(parent walk.Container) *Builder {
type expression (line 760) | type expression struct
method String (line 779) | func (e *expression) String() string {
method Value (line 783) | func (e *expression) Value() interface{} {
method Changed (line 794) | func (e *expression) Changed() *walk.Event {
method addSubExpression (line 798) | func (e *expression) addSubExpression(path string, subExpr walk.Expres...
type subExpressions (line 769) | type subExpressions
method Get (line 771) | func (se subExpressions) Get(name string) (interface{}, error) {
type boolExpression (line 810) | type boolExpression struct
method Satisfied (line 814) | func (be *boolExpression) Satisfied() bool {
FILE: declarative/checkbox.go
type CheckBox (line 13) | type CheckBox struct
method Create (line 65) | func (cb CheckBox) Create(builder *Builder) error {
FILE: declarative/combobox.go
type ComboBox (line 17) | type ComboBox struct
method Create (line 70) | func (cb ComboBox) Create(builder *Builder) error {
FILE: declarative/composite.go
type Composite (line 14) | type Composite struct
method Create (line 64) | func (c Composite) Create(builder *Builder) error {
FILE: declarative/customwidget.go
type PaintMode (line 13) | type PaintMode
constant PaintNormal (line 16) | PaintNormal PaintMode = iota
constant PaintNoErase (line 17) | PaintNoErase
constant PaintBuffered (line 18) | PaintBuffered
type CustomWidget (line 21) | type CustomWidget struct
method Create (line 68) | func (cw CustomWidget) Create(builder *Builder) error {
FILE: declarative/databinder.go
type DataBinder (line 15) | type DataBinder struct
method create (line 28) | func (db DataBinder) create() (*walk.DataBinder, error) {
FILE: declarative/dateedit.go
type DateEdit (line 17) | type DateEdit struct
method Create (line 65) | func (de DateEdit) Create(builder *Builder) error {
FILE: declarative/datelabel.go
type DateLabel (line 13) | type DateLabel struct
method Create (line 61) | func (dl DateLabel) Create(builder *Builder) error {
FILE: declarative/dialog.go
type Dialog (line 13) | type Dialog struct
method Create (line 61) | func (d Dialog) Create(owner walk.Form) error {
method Run (line 171) | func (d Dialog) Run(owner walk.Form) (int, error) {
FILE: declarative/font.go
type Font (line 13) | type Font struct
method Create (line 22) | func (f Font) Create() (*walk.Font, error) {
FILE: declarative/gradientcomposite.go
type GradientComposite (line 14) | type GradientComposite struct
method Create (line 67) | func (gc GradientComposite) Create(builder *Builder) error {
FILE: declarative/groupbox.go
type GroupBox (line 13) | type GroupBox struct
method Create (line 63) | func (gb GroupBox) Create(builder *Builder) error {
FILE: declarative/imageview.go
type ImageViewMode (line 13) | type ImageViewMode
constant ImageViewModeIdeal (line 16) | ImageViewModeIdeal = ImageViewMode(walk.ImageViewModeIdeal)
constant ImageViewModeCorner (line 17) | ImageViewModeCorner = ImageViewMode(walk.ImageViewModeCorner)
constant ImageViewModeCenter (line 18) | ImageViewModeCenter = ImageViewMode(walk.ImageViewModeCenter)
constant ImageViewModeShrink (line 19) | ImageViewModeShrink = ImageViewMode(walk.ImageViewModeShrink)
constant ImageViewModeZoom (line 20) | ImageViewModeZoom = ImageViewMode(walk.ImageViewModeZoom)
constant ImageViewModeStretch (line 21) | ImageViewModeStretch = ImageViewMode(walk.ImageViewModeStretch)
type ImageView (line 24) | type ImageView struct
method Create (line 68) | func (iv ImageView) Create(builder *Builder) error {
FILE: declarative/interfaces.go
function tr (line 15) | func tr(source string, context ...string) string {
type Property (line 23) | type Property interface
type bindData (line 25) | type bindData struct
function Bind (line 30) | func Bind(expression string, validators ...Validator) Property {
type SysDLLIcon (line 46) | type SysDLLIcon struct
method FilePath_ (line 52) | func (sdi SysDLLIcon) FilePath_() string {
method Index_ (line 63) | func (sdi SysDLLIcon) Index_() int {
method Size_ (line 67) | func (sdi SysDLLIcon) Size_() int {
type Brush (line 75) | type Brush interface
type Layout (line 79) | type Layout interface
type Widget (line 83) | type Widget interface
type MenuItem (line 87) | type MenuItem interface
type Validator (line 91) | type Validator interface
type ErrorPresenter (line 95) | type ErrorPresenter interface
type ErrorPresenterRef (line 99) | type ErrorPresenterRef struct
method Create (line 103) | func (epr ErrorPresenterRef) Create() (walk.ErrorPresenter, error) {
type ToolTipErrorPresenter (line 111) | type ToolTipErrorPresenter struct
method Create (line 114) | func (ToolTipErrorPresenter) Create() (walk.ErrorPresenter, error) {
type formInfo (line 118) | type formInfo struct
method Create (line 154) | func (formInfo) Create(builder *Builder) error {
FILE: declarative/label.go
type EllipsisMode (line 14) | type EllipsisMode
constant EllipsisNone (line 17) | EllipsisNone = EllipsisMode(walk.EllipsisNone)
constant EllipsisEnd (line 18) | EllipsisEnd = EllipsisMode(walk.EllipsisEnd)
constant EllipsisPath (line 19) | EllipsisPath = EllipsisMode(walk.EllipsisPath)
type Label (line 22) | type Label struct
method Create (line 68) | func (l Label) Create(builder *Builder) error {
FILE: declarative/layouts.go
type Orientation (line 15) | type Orientation
constant Horizontal (line 18) | Horizontal Orientation = Orientation(walk.Horizontal)
constant Vertical (line 19) | Vertical Orientation = Orientation(walk.Vertical)
type Margins (line 22) | type Margins struct
method isZero (line 29) | func (m Margins) isZero() bool {
method toW (line 33) | func (m Margins) toW() walk.Margins {
type Rectangle (line 37) | type Rectangle struct
method toW (line 44) | func (r Rectangle) toW() walk.Rectangle {
type Size (line 48) | type Size struct
method toW (line 53) | func (s Size) toW() walk.Size {
function setLayoutMargins (line 57) | func setLayoutMargins(layout walk.Layout, margins Margins, marginsZero b...
function setLayoutSpacing (line 65) | func setLayoutSpacing(layout walk.Layout, spacing int, spacingZero bool)...
type HBox (line 73) | type HBox struct
method Create (line 81) | func (hb HBox) Create() (walk.Layout, error) {
type VBox (line 99) | type VBox struct
method Create (line 107) | func (vb VBox) Create() (walk.Layout, error) {
type Grid (line 125) | type Grid struct
method Create (line 135) | func (g Grid) Create() (walk.Layout, error) {
type Flow (line 157) | type Flow struct
method Create (line 165) | func (f Flow) Create() (walk.Layout, error) {
FILE: declarative/lineedit.go
type CaseMode (line 13) | type CaseMode
constant CaseModeMixed (line 16) | CaseModeMixed CaseMode = CaseMode(walk.CaseModeMixed)
constant CaseModeUpper (line 17) | CaseModeUpper CaseMode = CaseMode(walk.CaseModeUpper)
constant CaseModeLower (line 18) | CaseModeLower CaseMode = CaseMode(walk.CaseModeLower)
type LineEdit (line 21) | type LineEdit struct
method Create (line 72) | func (le LineEdit) Create(builder *Builder) error {
FILE: declarative/linklabel.go
type LinkLabel (line 13) | type LinkLabel struct
method Create (line 56) | func (ll LinkLabel) Create(builder *Builder) error {
FILE: declarative/listbox.go
type ListBox (line 16) | type ListBox struct
method Create (line 69) | func (lb ListBox) Create(builder *Builder) error {
FILE: declarative/mainwindow.go
type MainWindow (line 11) | type MainWindow struct
method Create (line 63) | func (mw MainWindow) Create() error {
method Run (line 202) | func (mw MainWindow) Run() (int, error) {
type StatusBarItem (line 216) | type StatusBarItem struct
FILE: declarative/numberedit.go
type NumberEdit (line 13) | type NumberEdit struct
method Create (line 65) | func (ne NumberEdit) Create(builder *Builder) error {
FILE: declarative/numberlabel.go
type NumberLabel (line 13) | type NumberLabel struct
method Create (line 62) | func (nl NumberLabel) Create(builder *Builder) error {
FILE: declarative/progressbar.go
type ProgressBar (line 13) | type ProgressBar struct
method Create (line 58) | func (pb ProgressBar) Create(builder *Builder) error {
FILE: declarative/pushbutton.go
type PushButton (line 13) | type PushButton struct
method Create (line 61) | func (pb PushButton) Create(builder *Builder) error {
FILE: declarative/radiobutton.go
type RadioButton (line 13) | type RadioButton struct
method Create (line 61) | func (rb RadioButton) Create(builder *Builder) error {
FILE: declarative/radiobuttongroup.go
type RadioButtonGroup (line 18) | type RadioButtonGroup struct
method Create (line 24) | func (rbg RadioButtonGroup) Create(builder *Builder) error {
type radioButtonGroupValidator (line 71) | type radioButtonGroupValidator struct
method Validate (line 98) | func (rbgv *radioButtonGroupValidator) Validate(v interface{}) error {
function newRadioButtonGroupValidator (line 76) | func newRadioButtonGroupValidator(group *walk.RadioButtonGroup, parent w...
FILE: declarative/radiobuttongroupbox.go
type RadioButtonGroupBox (line 13) | type RadioButtonGroupBox struct
method Create (line 69) | func (rbgb RadioButtonGroupBox) Create(builder *Builder) error {
FILE: declarative/scrollview.go
type ScrollView (line 13) | type ScrollView struct
method Create (line 62) | func (sv ScrollView) Create(builder *Builder) error {
FILE: declarative/separator.go
type HSeparator (line 13) | type HSeparator struct
method Create (line 54) | func (s HSeparator) Create(builder *Builder) error {
type VSeparator (line 69) | type VSeparator struct
method Create (line 105) | func (s VSeparator) Create(builder *Builder) error {
FILE: declarative/slider.go
type Slider (line 13) | type Slider struct
method Create (line 63) | func (sl Slider) Create(builder *Builder) error {
FILE: declarative/spacer.go
type HSpacer (line 13) | type HSpacer struct
method Create (line 34) | func (hs HSpacer) Create(builder *Builder) (err error) {
type VSpacer (line 52) | type VSpacer struct
method Create (line 73) | func (vs VSpacer) Create(builder *Builder) (err error) {
FILE: declarative/splitbutton.go
type SplitButton (line 13) | type SplitButton struct
method Create (line 62) | func (sb SplitButton) Create(builder *Builder) error {
FILE: declarative/splitter.go
type HSplitter (line 13) | type HSplitter struct
method Create (line 60) | func (s HSplitter) Create(builder *Builder) error {
type VSplitter (line 87) | type VSplitter struct
method Create (line 131) | func (s VSplitter) Create(builder *Builder) error {
FILE: declarative/tableview.go
type TableView (line 14) | type TableView struct
method Create (line 97) | func (tv TableView) Create(builder *Builder) error {
type tvStyler (line 74) | type tvStyler struct
method StyleCell (line 79) | func (tvs *tvStyler) StyleCell(style *walk.CellStyle) {
type styleCellFunc (line 91) | type styleCellFunc
method StyleCell (line 93) | func (scf styleCellFunc) StyleCell(style *walk.CellStyle) {
FILE: declarative/tableviewcolumn.go
type Alignment1D (line 13) | type Alignment1D
constant AlignDefault (line 16) | AlignDefault = Alignment1D(walk.AlignDefault)
constant AlignNear (line 17) | AlignNear = Alignment1D(walk.AlignNear)
constant AlignCenter (line 18) | AlignCenter = Alignment1D(walk.AlignCenter)
constant AlignFar (line 19) | AlignFar = Alignment1D(walk.AlignFar)
type TableViewColumn (line 22) | type TableViewColumn struct
method Create (line 37) | func (tvc TableViewColumn) Create(tv *walk.TableView) error {
FILE: declarative/tabpage.go
type TabPage (line 13) | type TabPage struct
method Create (line 62) | func (tp TabPage) Create(builder *Builder) error {
FILE: declarative/tabwidget.go
type TabWidget (line 13) | type TabWidget struct
method Create (line 58) | func (tw TabWidget) Create(builder *Builder) error {
FILE: declarative/textedit.go
type TextEdit (line 14) | type TextEdit struct
method Create (line 64) | func (te TextEdit) Create(builder *Builder) error {
FILE: declarative/textlabel.go
type Alignment2D (line 14) | type Alignment2D
constant AlignHVDefault (line 17) | AlignHVDefault = Alignment2D(walk.AlignHVDefault)
constant AlignHNearVNear (line 18) | AlignHNearVNear = Alignment2D(walk.AlignHNearVNear)
constant AlignHCenterVNear (line 19) | AlignHCenterVNear = Alignment2D(walk.AlignHCenterVNear)
constant AlignHFarVNear (line 20) | AlignHFarVNear = Alignment2D(walk.AlignHFarVNear)
constant AlignHNearVCenter (line 21) | AlignHNearVCenter = Alignment2D(walk.AlignHNearVCenter)
constant AlignHCenterVCenter (line 22) | AlignHCenterVCenter = Alignment2D(walk.AlignHCenterVCenter)
constant AlignHFarVCenter (line 23) | AlignHFarVCenter = Alignment2D(walk.AlignHFarVCenter)
constant AlignHNearVFar (line 24) | AlignHNearVFar = Alignment2D(walk.AlignHNearVFar)
constant AlignHCenterVFar (line 25) | AlignHCenterVFar = Alignment2D(walk.AlignHCenterVFar)
constant AlignHFarVFar (line 26) | AlignHFarVFar = Alignment2D(walk.AlignHFarVFar)
type TextLabel (line 29) | type TextLabel struct
method Create (line 77) | func (tl TextLabel) Create(builder *Builder) error {
FILE: declarative/toolbar.go
type ToolBarButtonStyle (line 13) | type ToolBarButtonStyle
constant ToolBarButtonImageOnly (line 16) | ToolBarButtonImageOnly ToolBarButtonStyle = iota
constant ToolBarButtonTextOnly (line 17) | ToolBarButtonTextOnly
constant ToolBarButtonImageBeforeText (line 18) | ToolBarButtonImageBeforeText
constant ToolBarButtonImageAboveText (line 19) | ToolBarButtonImageAboveText
type ToolBar (line 22) | type ToolBar struct
method Create (line 68) | func (tb ToolBar) Create(builder *Builder) error {
FILE: declarative/toolbutton.go
type ToolButton (line 13) | type ToolButton struct
method Create (line 60) | func (tb ToolButton) Create(builder *Builder) error {
FILE: declarative/treeview.go
type TreeView (line 13) | type TreeView struct
method Create (line 59) | func (tv TreeView) Create(builder *Builder) error {
FILE: declarative/validators.go
type ValidatorRef (line 13) | type ValidatorRef struct
method Create (line 17) | func (vr ValidatorRef) Create() (walk.Validator, error) {
type Range (line 21) | type Range struct
method Create (line 26) | func (r Range) Create() (walk.Validator, error) {
type Regexp (line 30) | type Regexp struct
method Create (line 34) | func (re Regexp) Create() (walk.Validator, error) {
type SelRequired (line 38) | type SelRequired struct
method Create (line 41) | func (SelRequired) Create() (walk.Validator, error) {
type dMultiValidator (line 45) | type dMultiValidator struct
method Create (line 49) | func (av dMultiValidator) Create() (walk.Validator, error) {
type wMultiValidator (line 63) | type wMultiValidator struct
method Validate (line 67) | func (av *wMultiValidator) Validate(v interface{}) error {
FILE: declarative/webview.go
type WebView (line 13) | type WebView struct
method Create (line 79) | func (wv WebView) Create(builder *Builder) error {
FILE: dialog.go
constant DlgCmdNone (line 16) | DlgCmdNone = 0
constant DlgCmdOK (line 17) | DlgCmdOK = win.IDOK
constant DlgCmdCancel (line 18) | DlgCmdCancel = win.IDCANCEL
constant DlgCmdAbort (line 19) | DlgCmdAbort = win.IDABORT
constant DlgCmdRetry (line 20) | DlgCmdRetry = win.IDRETRY
constant DlgCmdIgnore (line 21) | DlgCmdIgnore = win.IDIGNORE
constant DlgCmdYes (line 22) | DlgCmdYes = win.IDYES
constant DlgCmdNo (line 23) | DlgCmdNo = win.IDNO
constant DlgCmdClose (line 24) | DlgCmdClose = win.IDCLOSE
constant DlgCmdHelp (line 25) | DlgCmdHelp = win.IDHELP
constant DlgCmdTryAgain (line 26) | DlgCmdTryAgain = win.IDTRYAGAIN
constant DlgCmdContinue (line 27) | DlgCmdContinue = win.IDCONTINUE
constant DlgCmdTimeout (line 28) | DlgCmdTimeout = win.IDTIMEOUT
constant dialogWindowClass (line 31) | dialogWindowClass = `\o/ Walk_Dialog_Class \o/`
function init (line 33) | func init() {
type dialogish (line 39) | type dialogish interface
type Dialog (line 44) | type Dialog struct
method DefaultButton (line 92) | func (dlg *Dialog) DefaultButton() *PushButton {
method SetDefaultButton (line 96) | func (dlg *Dialog) SetDefaultButton(button *PushButton) error {
method CancelButton (line 126) | func (dlg *Dialog) CancelButton() *PushButton {
method SetCancelButton (line 130) | func (dlg *Dialog) SetCancelButton(button *PushButton) error {
method Result (line 140) | func (dlg *Dialog) Result() int {
method Accept (line 144) | func (dlg *Dialog) Accept() {
method Cancel (line 148) | func (dlg *Dialog) Cancel() {
method Close (line 152) | func (dlg *Dialog) Close(result int) {
method Show (line 158) | func (dlg *Dialog) Show() {
method Run (line 233) | func (dlg *Dialog) Run() int {
method WndProc (line 241) | func (dlg *Dialog) WndProc(hwnd win.HWND, msg uint32, wParam, lParam u...
function NewDialog (line 52) | func NewDialog(owner Form) (*Dialog, error) {
function NewDialogWithFixedSize (line 56) | func NewDialogWithFixedSize(owner Form) (*Dialog, error) {
function newDialogWithStyle (line 60) | func newDialogWithStyle(owner Form, style uint32) (*Dialog, error) {
function fitRectToScreen (line 197) | func fitRectToScreen(hWnd win.HWND, r Rectangle) Rectangle {
FILE: dropfilesevent.go
type dropFilesEventHandlerInfo (line 15) | type dropFilesEventHandlerInfo struct
type DropFilesEventHandler (line 20) | type DropFilesEventHandler
type DropFilesEvent (line 22) | type DropFilesEvent struct
method Attach (line 27) | func (e *DropFilesEvent) Attach(handler DropFilesEventHandler) int {
method Detach (line 46) | func (e *DropFilesEvent) Detach(handle int) {
method Once (line 58) | func (e *DropFilesEvent) Once(handler DropFilesEventHandler) {
type DropFilesEventPublisher (line 63) | type DropFilesEventPublisher struct
method Event (line 67) | func (p *DropFilesEventPublisher) Event(hWnd win.HWND) *DropFilesEvent {
method Publish (line 72) | func (p *DropFilesEventPublisher) Publish(hDrop win.HDROP) {
FILE: error.go
type Error (line 24) | type Error struct
method Inner (line 30) | func (err *Error) Inner() error {
method Message (line 34) | func (err *Error) Message() string {
method Stack (line 50) | func (err *Error) Stack() []byte {
method Error (line 54) | func (err *Error) Error() string {
function processErrorNoPanic (line 58) | func processErrorNoPanic(err error) error {
function processError (line 70) | func processError(err error) error {
function newErr (line 80) | func newErr(message string) error {
function newError (line 84) | func newError(message string) error {
function newErrorNoPanic (line 88) | func newErrorNoPanic(message string) error {
function lastError (line 92) | func lastError(win32FuncName string) error {
function errorFromHRESULT (line 100) | func errorFromHRESULT(funcName string, hr win.HRESULT) error {
function wrapErr (line 104) | func wrapErr(err error) error {
function wrapErrorNoPanic (line 112) | func wrapErrorNoPanic(err error) error {
function wrapError (line 116) | func wrapError(err error) error {
function toErrorNoPanic (line 120) | func toErrorNoPanic(x interface{}) error {
function toError (line 135) | func toError(x interface{}) error {
FILE: errorevent.go
type errorEventHandlerInfo (line 9) | type errorEventHandlerInfo struct
type ErrorEventHandler (line 14) | type ErrorEventHandler
type ErrorEvent (line 16) | type ErrorEvent struct
method Attach (line 20) | func (e *ErrorEvent) Attach(handler ErrorEventHandler) int {
method Detach (line 35) | func (e *ErrorEvent) Detach(handle int) {
method Once (line 39) | func (e *ErrorEvent) Once(handler ErrorEventHandler) {
type ErrorEventPublisher (line 44) | type ErrorEventPublisher struct
method Event (line 48) | func (p *ErrorEventPublisher) Event() *ErrorEvent {
method Publish (line 52) | func (p *ErrorEventPublisher) Publish(err error) {
FILE: event.go
type eventHandlerInfo (line 9) | type eventHandlerInfo struct
type EventHandler (line 14) | type EventHandler
type Event (line 16) | type Event struct
method Attach (line 20) | func (e *Event) Attach(handler EventHandler) int {
method Detach (line 35) | func (e *Event) Detach(handle int) {
method Once (line 39) | func (e *Event) Once(handler EventHandler) {
type EventPublisher (line 44) | type EventPublisher struct
method Event (line 48) | func (p *EventPublisher) Event() *Event {
method Publish (line 52) | func (p *EventPublisher) Publish() {
FILE: examples/actions/actions.go
type MyMainWindow (line 18) | type MyMainWindow struct
method openAction_Triggered (line 187) | func (mw *MyMainWindow) openAction_Triggered() {
method newAction_Triggered (line 191) | func (mw *MyMainWindow) newAction_Triggered() {
method changeViewAction_Triggered (line 195) | func (mw *MyMainWindow) changeViewAction_Triggered() {
method showAboutBoxAction_Triggered (line 199) | func (mw *MyMainWindow) showAboutBoxAction_Triggered() {
method specialAction_Triggered (line 203) | func (mw *MyMainWindow) specialAction_Triggered() {
function main (line 22) | func main() {
FILE: examples/clipboard/clipboard.go
function main (line 16) | func main() {
FILE: examples/databinding/databinding.go
function main (line 17) | func main() {
type Animal (line 59) | type Animal struct
method PatienceField (line 72) | func (a *Animal) PatienceField() *DurationField {
type Species (line 76) | type Species struct
function KnownSpecies (line 81) | func KnownSpecies() []*Species {
type DurationField (line 91) | type DurationField struct
method CanSet (line 95) | func (*DurationField) CanSet() bool { return true }
method Get (line 96) | func (f *DurationField) Get() interface{} { return f.p.String() }
method Set (line 97) | func (f *DurationField) Set(v interface{}) error {
method Zero (line 104) | func (f *DurationField) Zero() interface{} { return "" }
type Sex (line 106) | type Sex
constant SexMale (line 109) | SexMale Sex = 1 + iota
constant SexFemale (line 110) | SexFemale
constant SexHermaphrodite (line 111) | SexHermaphrodite
function RunAnimalDialog (line 114) | func RunAnimalDialog(owner walk.Form, animal *Animal) (int, error) {
FILE: examples/drawing/drawing.go
function main (line 17) | func main() {
type MyMainWindow (line 39) | type MyMainWindow struct
method drawStuff (line 44) | func (mw *MyMainWindow) drawStuff(canvas *walk.Canvas, updateBounds wa...
function createBitmap (line 110) | func createBitmap() (*walk.Bitmap, error) {
FILE: examples/dropfiles/dropfiles.go
function main (line 14) | func main() {
FILE: examples/externalwidgets/externalwidgets.go
constant myWidgetWindowClass (line 16) | myWidgetWindowClass = "MyWidget Class"
function init (line 18) | func init() {
function main (line 24) | func main() {
type MyWidget (line 53) | type MyWidget struct
method CreateLayoutItem (line 79) | func (*MyWidget) CreateLayoutItem(ctx *walk.LayoutContext) walk.Layout...
method WndProc (line 96) | func (w *MyWidget) WndProc(hwnd win.HWND, msg uint32, wParam, lParam u...
function NewMyWidget (line 57) | func NewMyWidget(parent walk.Container) (*MyWidget, error) {
type myWidgetLayoutItem (line 83) | type myWidgetLayoutItem struct
method LayoutFlags (line 88) | func (li *myWidgetLayoutItem) LayoutFlags() walk.LayoutFlags {
method IdealSize (line 92) | func (li *myWidgetLayoutItem) IdealSize() walk.Size {
type MyPushButton (line 105) | type MyPushButton struct
method WndProc (line 124) | func (mpb *MyPushButton) WndProc(hwnd win.HWND, msg uint32, wParam, lP...
function NewMyPushButton (line 109) | func NewMyPushButton(parent walk.Container) (*MyPushButton, error) {
FILE: examples/filebrowser/filebrowser.go
type Directory (line 19) | type Directory struct
method Text (line 31) | func (d *Directory) Text() string {
method Parent (line 35) | func (d *Directory) Parent() walk.TreeItem {
method ChildCount (line 45) | func (d *Directory) ChildCount() int {
method ChildAt (line 57) | func (d *Directory) ChildAt(index int) walk.TreeItem {
method Image (line 61) | func (d *Directory) Image() interface{} {
method ResetChildren (line 65) | func (d *Directory) ResetChildren() error {
method Path (line 93) | func (d *Directory) Path() string {
function NewDirectory (line 25) | func NewDirectory(name string, parent *Directory) *Directory {
type DirectoryTreeModel (line 106) | type DirectoryTreeModel struct
method LazyPopulation (line 133) | func (*DirectoryTreeModel) LazyPopulation() bool {
method RootCount (line 138) | func (m *DirectoryTreeModel) RootCount() int {
method RootAt (line 142) | func (m *DirectoryTreeModel) RootAt(index int) walk.TreeItem {
function NewDirectoryTreeModel (line 113) | func NewDirectoryTreeModel() (*DirectoryTreeModel, error) {
type FileInfo (line 146) | type FileInfo struct
type FileInfoModel (line 152) | type FileInfoModel struct
method Items (line 164) | func (m *FileInfoModel) Items() interface{} {
method SetDirPath (line 168) | func (m *FileInfoModel) SetDirPath(dirPath string) error {
method Image (line 207) | func (m *FileInfoModel) Image(row int) interface{} {
function NewFileInfoModel (line 160) | func NewFileInfoModel() *FileInfoModel {
function shouldExclude (line 211) | func shouldExclude(name string) bool {
function main (line 220) | func main() {
FILE: examples/gradientcomposite/gradientcomposite.go
function main (line 12) | func main() {
FILE: examples/imageicon/main.go
function main (line 19) | func main() {
type seg (line 61) | type seg struct
function digit (line 76) | func digit(im draw.Image, col color.Color, x, y, size, digit int) {
function makeDigitImage (line 91) | func makeDigitImage(n int) image.Image {
FILE: examples/imageview/imageview.go
function main (line 12) | func main() {
FILE: examples/imageviewer/imageviewer.go
function main (line 18) | func main() {
type MyMainWindow (line 68) | type MyMainWindow struct
method openAction_Triggered (line 74) | func (mw *MyMainWindow) openAction_Triggered() {
method openImage (line 80) | func (mw *MyMainWindow) openImage() error {
method aboutAction_Triggered (line 153) | func (mw *MyMainWindow) aboutAction_Triggered() {
FILE: examples/linklabel/linklabel.go
function main (line 16) | func main() {
FILE: examples/listbox/listbox.go
function main (line 19) | func main() {
type MyMainWindow (line 49) | type MyMainWindow struct
method lb_CurrentIndexChanged (line 56) | func (mw *MyMainWindow) lb_CurrentIndexChanged() {
method lb_ItemActivated (line 66) | func (mw *MyMainWindow) lb_ItemActivated() {
type EnvItem (line 72) | type EnvItem struct
type EnvModel (line 77) | type EnvModel struct
method ItemCount (line 102) | func (m *EnvModel) ItemCount() int {
method Value (line 106) | func (m *EnvModel) Value(index int) interface{} {
function NewEnvModel (line 82) | func NewEnvModel() *EnvModel {
FILE: examples/listbox_ownerdrawing/listbox_ownerdrawing.go
function main (line 18) | func main() {
type logModel (line 92) | type logModel struct
method Items (line 97) | func (m *logModel) Items() interface{} {
type logEntry (line 101) | type logEntry struct
type widthDPI (line 106) | type widthDPI struct
type textWidthDPI (line 111) | type textWidthDPI struct
type Styler (line 117) | type Styler struct
method ItemHeightDependsOnWidth (line 127) | func (s *Styler) ItemHeightDependsOnWidth() bool {
method DefaultItemHeight (line 131) | func (s *Styler) DefaultItemHeight() int {
method ItemHeight (line 144) | func (s *Styler) ItemHeight(index, width int) int {
method StyleItem (line 191) | func (s *Styler) StyleItem(style *walk.ListItemStyle) {
method StampSize (line 231) | func (s *Styler) StampSize() walk.Size {
method Canvas (line 253) | func (s *Styler) Canvas() (*walk.Canvas, error) {
constant marginH96dpi (line 139) | marginH96dpi int = 6
constant marginV96dpi (line 140) | marginV96dpi int = 2
constant lineW96dpi (line 141) | lineW96dpi int = 1
FILE: examples/logview/logview.go
type LogView (line 17) | type LogView struct
method CreateLayoutItem (line 43) | func (*LogView) CreateLayoutItem(ctx *walk.LayoutContext) walk.LayoutI...
method setTextSelection (line 47) | func (lv *LogView) setTextSelection(start, end int) {
method textLength (line 51) | func (lv *LogView) textLength() int {
method AppendText (line 55) | func (lv *LogView) AppendText(value string) {
method setReadOnly (line 61) | func (lv *LogView) setReadOnly(readOnly bool) error {
method PostAppendText (line 69) | func (lv *LogView) PostAppendText(value string) {
method Write (line 74) | func (lv *LogView) Write(p []byte) (int, error) {
method WndProc (line 79) | func (lv *LogView) WndProc(hwnd win.HWND, msg uint32, wParam, lParam u...
constant TEM_APPENDTEXT (line 23) | TEM_APPENDTEXT = win.WM_USER + 6
function NewLogView (line 26) | func NewLogView(parent walk.Container) (*LogView, error) {
FILE: examples/logview/logviewapp.go
function main (line 17) | func main() {
FILE: examples/multiplepages/main.go
function main (line 16) | func main() {
type AppMainWindow (line 57) | type AppMainWindow struct
method updateTitle (line 61) | func (mw *AppMainWindow) updateTitle(prefix string) {
method aboutAction_Triggered (line 74) | func (mw *AppMainWindow) aboutAction_Triggered() {
type FooPage (line 81) | type FooPage struct
function newFooPage (line 85) | func newFooPage(parent walk.Container) (Page, error) {
type BarPage (line 108) | type BarPage struct
function newBarPage (line 112) | func newBarPage(parent walk.Container) (Page, error) {
type BazPage (line 135) | type BazPage struct
function newBazPage (line 139) | func newBazPage(parent walk.Container) (Page, error) {
FILE: examples/multiplepages/multipagemainwindow.go
type MultiPageMainWindowConfig (line 12) | type MultiPageMainWindowConfig struct
type PageConfig (line 35) | type PageConfig struct
type PageFactoryFunc (line 41) | type PageFactoryFunc
type Page (line 43) | type Page interface
type MultiPageMainWindow (line 50) | type MultiPageMainWindow struct
method CurrentPage (line 149) | func (mpmw *MultiPageMainWindow) CurrentPage() Page {
method CurrentPageTitle (line 153) | func (mpmw *MultiPageMainWindow) CurrentPageTitle() string {
method CurrentPageChanged (line 161) | func (mpmw *MultiPageMainWindow) CurrentPageChanged() *walk.Event {
method newPageAction (line 165) | func (mpmw *MultiPageMainWindow) newPageAction(title, image string, ne...
method setCurrentAction (line 186) | func (mpmw *MultiPageMainWindow) setCurrentAction(action *walk.Action)...
method updateNavigationToolBar (line 219) | func (mpmw *MultiPageMainWindow) updateNavigationToolBar() error {
function NewMultiPageMainWindow (line 61) | func NewMultiPageMainWindow(cfg *MultiPageMainWindowConfig) (*MultiPageM...
FILE: examples/notifyicon/notifyicon.go
function main (line 15) | func main() {
FILE: examples/progressindicator/dialog_ui.go
type myDialogUI (line 9) | type myDialogUI struct
method init (line 18) | func (w *MyDialog) init(owner walk.Form) (err error) {
FILE: examples/progressindicator/pi.go
function main (line 17) | func main() {
type MyDialog (line 23) | type MyDialog struct
method setState (line 28) | func (dlg *MyDialog) setState(state walk.PIState) {
function RunMyDialog (line 34) | func RunMyDialog(owner walk.Form) (int, error) {
FILE: examples/radiobutton/radiobutton.go
type Foo (line 15) | type Foo struct
function main (line 20) | func main() {
FILE: examples/settings/settings.go
function main (line 19) | func main() {
function RunMainWindow (line 48) | func RunMainWindow() error {
function NewFooModel (line 75) | func NewFooModel() *FooModel {
type FooModel (line 94) | type FooModel struct
method Items (line 99) | func (m *FooModel) Items() interface{} {
type Foo (line 103) | type Foo struct
FILE: examples/slider/slider.go
function main (line 14) | func main() {
FILE: examples/statusbar/statusbar.go
function main (line 17) | func main() {
FILE: examples/tableview/tableview.go
type Foo (line 20) | type Foo struct
type FooModel (line 28) | type FooModel struct
method RowCount (line 44) | func (m *FooModel) RowCount() int {
method Value (line 49) | func (m *FooModel) Value(row, col int) interface{} {
method Checked (line 70) | func (m *FooModel) Checked(row int) bool {
method SetChecked (line 75) | func (m *FooModel) SetChecked(row int, checked bool) error {
method Sort (line 82) | func (m *FooModel) Sort(col int, order walk.SortOrder) error {
method ResetRows (line 116) | func (m *FooModel) ResetRows() {
function NewFooModel (line 36) | func NewFooModel() *FooModel {
function main (line 137) | func main() {
FILE: examples/webview/webview.go
function main (line 14) | func main() {
FILE: examples/webview_events/webview_events.go
type MainWin (line 16) | type MainWin struct
method webView_OnNavigating (line 91) | func (mainWin *MainWin) webView_OnNavigating(eventData *walk.WebViewNa...
method webView_OnNavigated (line 103) | func (mainWin *MainWin) webView_OnNavigated(url string) {
method webView_OnDownloading (line 108) | func (mainWin *MainWin) webView_OnDownloading() {
method webView_OnDownloaded (line 112) | func (mainWin *MainWin) webView_OnDownloaded() {
method webView_OnDocumentCompleted (line 116) | func (mainWin *MainWin) webView_OnDocumentCompleted(url string) {
method webView_OnNavigatedError (line 121) | func (mainWin *MainWin) webView_OnNavigatedError(eventData *walk.WebVi...
method webView_OnNewWindow (line 131) | func (mainWin *MainWin) webView_OnNewWindow(eventData *walk.WebViewNew...
method webView_OnQuitting (line 141) | func (mainWin *MainWin) webView_OnQuitting() {
method webView_OnWindowClosing (line 145) | func (mainWin *MainWin) webView_OnWindowClosing(eventData *walk.WebVie...
method webView_OnStatusBarVisibleChanged (line 153) | func (mainWin *MainWin) webView_OnStatusBarVisibleChanged() {
method webView_OnTheaterModeChanged (line 158) | func (mainWin *MainWin) webView_OnTheaterModeChanged() {
method webView_OnToolBarVisibleChanged (line 163) | func (mainWin *MainWin) webView_OnToolBarVisibleChanged() {
method webView_OnBrowserVisibleChanged (line 168) | func (mainWin *MainWin) webView_OnBrowserVisibleChanged() {
method webView_OnCanGoBackChanged (line 173) | func (mainWin *MainWin) webView_OnCanGoBackChanged() {
method webView_OnCanGoForwardChanged (line 178) | func (mainWin *MainWin) webView_OnCanGoForwardChanged() {
method webView_OnToolBarEnabledChanged (line 183) | func (mainWin *MainWin) webView_OnToolBarEnabledChanged() {
method webView_OnProgressChanged (line 188) | func (mainWin *MainWin) webView_OnProgressChanged() {
method webView_OnStatusTextChanged (line 194) | func (mainWin *MainWin) webView_OnStatusTextChanged() {
method webView_OnDocumentTitleChanged (line 199) | func (mainWin *MainWin) webView_OnDocumentTitleChanged() {
function main (line 22) | func main() {
function NewMainWin (line 31) | func NewMainWin() (*MainWin, error) {
FILE: expression.go
type Expression (line 16) | type Expression interface
type reflectExpression (line 21) | type reflectExpression struct
method Value (line 30) | func (re *reflectExpression) Value() interface{} {
method Changed (line 48) | func (re *reflectExpression) Changed() *Event {
function NewReflectExpression (line 26) | func NewReflectExpression(root Expression, path string) Expression {
FILE: flowlayout.go
type FlowLayout (line 13) | type FlowLayout struct
method StretchFactor (line 31) | func (l *FlowLayout) StretchFactor(widget Widget) int {
method SetStretchFactor (line 39) | func (l *FlowLayout) SetStretchFactor(widget Widget, factor int) error {
method CreateLayoutItem (line 62) | func (l *FlowLayout) CreateLayoutItem(ctx *LayoutContext) ContainerLay...
function NewFlowLayout (line 18) | func NewFlowLayout() *FlowLayout {
type flowLayoutItem (line 75) | type flowLayoutItem struct
method LayoutFlags (line 92) | func (*flowLayoutItem) LayoutFlags() LayoutFlags {
method MinSize (line 96) | func (li *flowLayoutItem) MinSize() Size {
method HeightForWidth (line 100) | func (li *flowLayoutItem) HeightForWidth(width int) int {
method MinSizeForSize (line 104) | func (li *flowLayoutItem) MinSizeForSize(size Size) Size {
method PerformLayout (line 172) | func (li *flowLayoutItem) PerformLayout() []LayoutResultItem {
method sectionsForPrimarySize (line 223) | func (li *flowLayoutItem) sectionsForPrimarySize(primarySize int) []fl...
type flowLayoutSection (line 81) | type flowLayoutSection struct
type flowLayoutSectionItem (line 87) | type flowLayoutSectionItem struct
FILE: font.go
type FontStyle (line 17) | type FontStyle
constant FontBold (line 21) | FontBold FontStyle = 0x01
constant FontItalic (line 22) | FontItalic FontStyle = 0x02
constant FontUnderline (line 23) | FontUnderline FontStyle = 0x04
constant FontStrikeOut (line 24) | FontStrikeOut FontStyle = 0x08
function init (line 32) | func init() {
type fontInfo (line 42) | type fontInfo struct
type Font (line 50) | type Font struct
method createForDPI (line 112) | func (f *Font) createForDPI(dpi int) (win.HFONT, error) {
method Bold (line 150) | func (f *Font) Bold() bool {
method Dispose (line 158) | func (f *Font) Dispose() {
method Family (line 170) | func (f *Font) Family() string {
method Italic (line 175) | func (f *Font) Italic() bool {
method handleForDPI (line 181) | func (f *Font) handleForDPI(dpi int) win.HFONT {
method StrikeOut (line 199) | func (f *Font) StrikeOut() bool {
method Style (line 204) | func (f *Font) Style() FontStyle {
method Underline (line 209) | func (f *Font) Underline() bool {
method PointSize (line 214) | func (f *Font) PointSize() int {
function NewFont (line 58) | func NewFont(family string, pointSize int, style FontStyle) (*Font, erro...
function newFontFromLOGFONT (line 84) | func newFontFromLOGFONT(lf *win.LOGFONT, dpi int) (*Font, error) {
function screenDPI (line 218) | func screenDPI() int {
FILE: fontresource.go
type FontMemResource (line 16) | type FontMemResource struct
method Dispose (line 78) | func (fmr *FontMemResource) Dispose() {
function newFontMemResource (line 20) | func newFontMemResource(resourceName *uint16) (*FontMemResource, error) {
function NewFontMemResourceByName (line 60) | func NewFontMemResourceByName(name string) (*FontMemResource, error) {
function NewFontMemResourceById (line 73) | func NewFontMemResourceById(id int) (*FontMemResource, error) {
FILE: form.go
type CloseReason (line 20) | type CloseReason
constant CloseReasonUnknown (line 23) | CloseReasonUnknown CloseReason = iota
constant CloseReasonUser (line 24) | CloseReasonUser
function init (line 38) | func init() {
type Form (line 46) | type Form interface
type FormBase (line 76) | type FormBase struct
method init (line 105) | func (fb *FormBase) init(form Form) error {
method Dispose (line 155) | func (fb *FormBase) Dispose() {
method AsContainerBase (line 163) | func (fb *FormBase) AsContainerBase() *ContainerBase {
method AsFormBase (line 171) | func (fb *FormBase) AsFormBase() *FormBase {
method Children (line 175) | func (fb *FormBase) Children() *WidgetList {
method Layout (line 183) | func (fb *FormBase) Layout() Layout {
method SetLayout (line 191) | func (fb *FormBase) SetLayout(value Layout) error {
method SetBoundsPixels (line 199) | func (fb *FormBase) SetBoundsPixels(bounds Rectangle) error {
method fixedSize (line 222) | func (fb *FormBase) fixedSize() bool {
method DataBinder (line 226) | func (fb *FormBase) DataBinder() *DataBinder {
method SetDataBinder (line 230) | func (fb *FormBase) SetDataBinder(db *DataBinder) {
method SetSuspended (line 234) | func (fb *FormBase) SetSuspended(suspended bool) {
method MouseDown (line 246) | func (fb *FormBase) MouseDown() *MouseEvent {
method MouseMove (line 250) | func (fb *FormBase) MouseMove() *MouseEvent {
method MouseUp (line 254) | func (fb *FormBase) MouseUp() *MouseEvent {
method onInsertingWidget (line 258) | func (fb *FormBase) onInsertingWidget(index int, widget Widget) error {
method onInsertedWidget (line 262) | func (fb *FormBase) onInsertedWidget(index int, widget Widget) error {
method onRemovingWidget (line 266) | func (fb *FormBase) onRemovingWidget(index int, widget Widget) error {
method onRemovedWidget (line 270) | func (fb *FormBase) onRemovedWidget(index int, widget Widget) error {
method onClearingWidgets (line 274) | func (fb *FormBase) onClearingWidgets() error {
method onClearedWidgets (line 278) | func (fb *FormBase) onClearedWidgets() error {
method ContextMenu (line 282) | func (fb *FormBase) ContextMenu() *Menu {
method SetContextMenu (line 286) | func (fb *FormBase) SetContextMenu(contextMenu *Menu) {
method ContextMenuLocation (line 290) | func (fb *FormBase) ContextMenuLocation() Point {
method applyEnabled (line 294) | func (fb *FormBase) applyEnabled(enabled bool) {
method applyFont (line 300) | func (fb *FormBase) applyFont(font *Font) {
method ApplySysColors (line 306) | func (fb *FormBase) ApplySysColors() {
method Background (line 311) | func (fb *FormBase) Background() Brush {
method SetBackground (line 315) | func (fb *FormBase) SetBackground(background Brush) {
method Title (line 319) | func (fb *FormBase) Title() string {
method SetTitle (line 323) | func (fb *FormBase) SetTitle(value string) error {
method TitleChanged (line 327) | func (fb *FormBase) TitleChanged() *Event {
method RightToLeftLayout (line 333) | func (fb *FormBase) RightToLeftLayout() bool {
method SetRightToLeftLayout (line 339) | func (fb *FormBase) SetRightToLeftLayout(rtl bool) error {
method Run (line 343) | func (fb *FormBase) Run() int {
method handleKeyDown (line 378) | func (fb *FormBase) handleKeyDown(msg *win.MSG) bool {
method Starting (line 471) | func (fb *FormBase) Starting() *Event {
method Activating (line 475) | func (fb *FormBase) Activating() *Event {
method Deactivating (line 479) | func (fb *FormBase) Deactivating() *Event {
method Activate (line 483) | func (fb *FormBase) Activate() error {
method Owner (line 491) | func (fb *FormBase) Owner() Form {
method SetOwner (line 495) | func (fb *FormBase) SetOwner(value Form) error {
method Icon (line 515) | func (fb *FormBase) Icon() Image {
method SetIcon (line 519) | func (fb *FormBase) SetIcon(icon Image) error {
method IconChanged (line 553) | func (fb *FormBase) IconChanged() *Event {
method Hide (line 557) | func (fb *FormBase) Hide() {
method Show (line 561) | func (fb *FormBase) Show() {
method close (line 571) | func (fb *FormBase) close() error {
method Close (line 581) | func (fb *FormBase) Close() error {
method Persistent (line 587) | func (fb *FormBase) Persistent() bool {
method SetPersistent (line 591) | func (fb *FormBase) SetPersistent(value bool) {
method SaveState (line 595) | func (fb *FormBase) SaveState() error {
method RestoreState (line 622) | func (fb *FormBase) RestoreState() error {
method Closing (line 667) | func (fb *FormBase) Closing() *CloseEvent {
method ProgressIndicator (line 671) | func (fb *FormBase) ProgressIndicator() *ProgressIndicator {
method setStopwatch (line 675) | func (fb *FormBase) setStopwatch(sw *stopwatch) {
method startLayout (line 681) | func (fb *FormBase) startLayout() bool {
method WndProc (line 708) | func (fb *FormBase) WndProc(hwnd win.HWND, msg uint32, wParam, lParam ...
FILE: gradientcomposite.go
type GradientComposite (line 15) | type GradientComposite struct
method Vertical (line 114) | func (gc *GradientComposite) Vertical() bool {
method SetVertical (line 118) | func (gc *GradientComposite) SetVertical(vertical bool) (err error) {
method Color1 (line 142) | func (gc *GradientComposite) Color1() Color {
method SetColor1 (line 146) | func (gc *GradientComposite) SetColor1(c Color) (err error) {
method Color2 (line 170) | func (gc *GradientComposite) Color2() Color {
method SetColor2 (line 174) | func (gc *GradientComposite) SetColor2(c Color) (err error) {
method updateBackground (line 198) | func (gc *GradientComposite) updateBackground() error {
method Dispose (line 253) | func (gc *GradientComposite) Dispose() {
method WndProc (line 264) | func (gc *GradientComposite) WndProc(hwnd win.HWND, msg uint32, wParam...
function NewGradientComposite (line 26) | func NewGradientComposite(parent Container) (*GradientComposite, error) {
function NewGradientCompositeWithStyle (line 30) | func NewGradientCompositeWithStyle(parent Container, style uint32) (*Gra...
FILE: graphicseffects.go
type WidgetGraphicsEffect (line 18) | type WidgetGraphicsEffect interface
type widgetGraphicsEffectBase (line 22) | type widgetGraphicsEffectBase struct
method create (line 27) | func (wgeb *widgetGraphicsEffectBase) create(color Color) error {
method Dispose (line 32) | func (wgeb *widgetGraphicsEffectBase) Dispose() {
method bitmapForDPI (line 43) | func (wgeb *widgetGraphicsEffectBase) bitmapForDPI(dpi int) (*Bitmap, ...
type BorderGlowEffect (line 112) | type BorderGlowEffect struct
method Draw (line 126) | func (bge *BorderGlowEffect) Draw(widget Widget, canvas *Canvas) error {
function NewBorderGlowEffect (line 116) | func NewBorderGlowEffect(color Color) (*BorderGlowEffect, error) {
type DropShadowEffect (line 151) | type DropShadowEffect struct
method Draw (line 165) | func (dse *DropShadowEffect) Draw(widget Widget, canvas *Canvas) error {
function NewDropShadowEffect (line 155) | func NewDropShadowEffect(color Color) (*DropShadowEffect, error) {
type widgetGraphicsEffectListObserver (line 188) | type widgetGraphicsEffectListObserver interface
type WidgetGraphicsEffectList (line 194) | type WidgetGraphicsEffectList struct
method Add (line 203) | func (l *WidgetGraphicsEffectList) Add(effect WidgetGraphicsEffect) er...
method At (line 211) | func (l *WidgetGraphicsEffectList) At(index int) WidgetGraphicsEffect {
method Clear (line 215) | func (l *WidgetGraphicsEffectList) Clear() error {
method Index (line 230) | func (l *WidgetGraphicsEffectList) Index(effect WidgetGraphicsEffect) ...
method Contains (line 240) | func (l *WidgetGraphicsEffectList) Contains(effect WidgetGraphicsEffec...
method insertIntoSlice (line 244) | func (l *WidgetGraphicsEffectList) insertIntoSlice(index int, effect W...
method Insert (line 250) | func (l *WidgetGraphicsEffectList) Insert(index int, effect WidgetGrap...
method Len (line 265) | func (l *WidgetGraphicsEffectList) Len() int {
method Remove (line 269) | func (l *WidgetGraphicsEffectList) Remove(effect WidgetGraphicsEffect)...
method RemoveAt (line 278) | func (l *WidgetGraphicsEffectList) RemoveAt(index int) error {
function newWidgetGraphicsEffectList (line 199) | func newWidgetGraphicsEffectList(observer widgetGraphicsEffectListObserv...
FILE: gridlayout.go
type gridLayoutCell (line 14) | type gridLayoutCell struct
type gridLayoutSection (line 20) | type gridLayoutSection struct
type gridLayoutWidgetInfo (line 25) | type gridLayoutWidgetInfo struct
type GridLayout (line 32) | type GridLayout struct
method sufficientStretchFactors (line 53) | func (l *GridLayout) sufficientStretchFactors(stretchFactors []int, re...
method ensureSufficientSize (line 72) | func (l *GridLayout) ensureSufficientSize(rows, columns int) {
method RowStretchFactor (line 104) | func (l *GridLayout) RowStretchFactor(row int) int {
method SetRowStretchFactor (line 117) | func (l *GridLayout) SetRowStretchFactor(row, factor int) error {
method ColumnStretchFactor (line 140) | func (l *GridLayout) ColumnStretchFactor(column int) int {
method SetColumnStretchFactor (line 153) | func (l *GridLayout) SetColumnStretchFactor(column, factor int) error {
method setWidgetOnCells (line 185) | func (l *GridLayout) setWidgetOnCells(widget Widget, r Rectangle) {
method Range (line 198) | func (l *GridLayout) Range(widget Widget) (r Rectangle, ok bool) {
method SetRange (line 214) | func (l *GridLayout) SetRange(widget Widget, r Rectangle) error {
method CreateLayoutItem (line 260) | func (l *GridLayout) CreateLayoutItem(ctx *LayoutContext) ContainerLay...
function NewGridLayout (line 40) | func NewGridLayout() *GridLayout {
function rangeFromGridLayoutWidgetInfo (line 176) | func rangeFromGridLayoutWidgetInfo(info *gridLayoutWidgetInfo) Rectangle {
type gridLayoutItem (line 315) | type gridLayoutItem struct
method stretchFactorsTotal (line 339) | func (*gridLayoutItem) stretchFactorsTotal(stretchFactors []int) int {
method LayoutFlags (line 349) | func (li *gridLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 376) | func (li *gridLayoutItem) IdealSize() Size {
method MinSize (line 380) | func (li *gridLayoutItem) MinSize() Size {
method HeightForWidth (line 388) | func (li *gridLayoutItem) HeightForWidth(width int) int {
method MinSizeForSize (line 392) | func (li *gridLayoutItem) MinSizeForSize(size Size) Size {
method spannedWidth (line 503) | func (li *gridLayoutItem) spannedWidth(info *gridLayoutItemInfo, width...
method spannedHeight (line 521) | func (li *gridLayoutItem) spannedHeight(info *gridLayoutItemInfo, heig...
method PerformLayout (line 575) | func (li *gridLayoutItem) PerformLayout() []LayoutResultItem {
method sectionSizesForSpace (line 671) | func (li *gridLayoutItem) sectionSizesForSpace(orientation Orientation...
type gridLayoutItemInfo (line 326) | type gridLayoutItemInfo struct
type gridLayoutItemCell (line 333) | type gridLayoutItemCell struct
type gridLayoutSectionInfo (line 538) | type gridLayoutSectionInfo struct
type gridLayoutSectionInfoList (line 547) | type gridLayoutSectionInfoList
method Len (line 549) | func (l gridLayoutSectionInfoList) Len() int {
method Less (line 553) | func (l gridLayoutSectionInfoList) Less(i, j int) bool {
method Swap (line 571) | func (l gridLayoutSectionInfoList) Swap(i, j int) {
FILE: groupbox.go
constant groupBoxWindowClass (line 16) | groupBoxWindowClass = `\o/ Walk_GroupBox_Class \o/`
function init (line 18) | func init() {
type GroupBox (line 24) | type GroupBox struct
method AsContainerBase (line 116) | func (gb *GroupBox) AsContainerBase() *ContainerBase {
method ClientBoundsPixels (line 124) | func (gb *GroupBox) ClientBoundsPixels() Rectangle {
method updateHeaderHeight (line 142) | func (gb *GroupBox) updateHeaderHeight() {
method Persistent (line 146) | func (gb *GroupBox) Persistent() bool {
method SetPersistent (line 150) | func (gb *GroupBox) SetPersistent(value bool) {
method SaveState (line 154) | func (gb *GroupBox) SaveState() error {
method RestoreState (line 158) | func (gb *GroupBox) RestoreState() error {
method applyEnabled (line 162) | func (gb *GroupBox) applyEnabled(enabled bool) {
method applyEnabledFromCheckBox (line 178) | func (gb *GroupBox) applyEnabledFromCheckBox(enabled bool) {
method applyFont (line 188) | func (gb *GroupBox) applyFont(font *Font) {
method SetSuspended (line 206) | func (gb *GroupBox) SetSuspended(suspend bool) {
method DataBinder (line 212) | func (gb *GroupBox) DataBinder() *DataBinder {
method SetDataBinder (line 216) | func (gb *GroupBox) SetDataBinder(dataBinder *DataBinder) {
method Title (line 220) | func (gb *GroupBox) Title() string {
method SetTitle (line 228) | func (gb *GroupBox) SetTitle(title string) error {
method Checkable (line 240) | func (gb *GroupBox) Checkable() bool {
method SetCheckable (line 244) | func (gb *GroupBox) SetCheckable(checkable bool) {
method Checked (line 254) | func (gb *GroupBox) Checked() bool {
method SetChecked (line 258) | func (gb *GroupBox) SetChecked(checked bool) {
method CheckedChanged (line 262) | func (gb *GroupBox) CheckedChanged() *Event {
method ApplyDPI (line 266) | func (gb *GroupBox) ApplyDPI(dpi int) {
method Children (line 276) | func (gb *GroupBox) Children() *WidgetList {
method Layout (line 285) | func (gb *GroupBox) Layout() Layout {
method SetLayout (line 295) | func (gb *GroupBox) SetLayout(value Layout) error {
method MouseDown (line 299) | func (gb *GroupBox) MouseDown() *MouseEvent {
method MouseMove (line 303) | func (gb *GroupBox) MouseMove() *MouseEvent {
method MouseUp (line 307) | func (gb *GroupBox) MouseUp() *MouseEvent {
method WndProc (line 311) | func (gb *GroupBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam ...
method CreateLayoutItem (line 371) | func (gb *GroupBox) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function NewGroupBox (line 33) | func NewGroupBox(parent Container) (*GroupBox, error) {
type groupBoxLayoutItem (line 391) | type groupBoxLayoutItem struct
method LayoutFlags (line 396) | func (li *groupBoxLayoutItem) LayoutFlags() LayoutFlags {
method MinSize (line 400) | func (li *groupBoxLayoutItem) MinSize() Size {
method MinSizeForSize (line 408) | func (li *groupBoxLayoutItem) MinSizeForSize(size Size) Size {
method HasHeightForWidth (line 412) | func (li *groupBoxLayoutItem) HasHeightForWidth() bool {
method HeightForWidth (line 416) | func (li *groupBoxLayoutItem) HeightForWidth(width int) int {
method IdealSize (line 420) | func (li *groupBoxLayoutItem) IdealSize() Size {
method PerformLayout (line 426) | func (li *groupBoxLayoutItem) PerformLayout() []LayoutResultItem {
FILE: icon.go
type Icon (line 22) | type Icon struct
method handleForDPI (line 235) | func (i *Icon) handleForDPI(dpi int) win.HICON {
method handleForDPIWithError (line 240) | func (i *Icon) handleForDPIWithError(dpi int) (win.HICON, error) {
method Dispose (line 304) | func (i *Icon) Dispose() {
method draw (line 315) | func (i *Icon) draw(hdc win.HDC, location Point) error {
method drawStretched (line 322) | func (i *Icon) drawStretched(hdc win.HDC, bounds Rectangle) error {
method Size (line 347) | func (i *Icon) Size() Size {
type ExtractableIcon (line 32) | type ExtractableIcon interface
function IconFrom (line 38) | func IconFrom(src interface{}, dpi int) (*Icon, error) {
function IconApplication (line 51) | func IconApplication() *Icon {
function IconError (line 55) | func IconError() *Icon {
function IconQuestion (line 59) | func IconQuestion() *Icon {
function IconWarning (line 63) | func IconWarning() *Icon {
function IconInformation (line 67) | func IconInformation() *Icon {
function IconWinLogo (line 71) | func IconWinLogo() *Icon {
function IconShield (line 75) | func IconShield() *Icon {
function stockIcon (line 79) | func stockIcon(id uintptr) *Icon {
function NewIconFromFile (line 84) | func NewIconFromFile(filePath string) (*Icon, error) {
function NewIconFromFileWithSize (line 89) | func NewIconFromFileWithSize(filePath string, size Size) (*Icon, error) {
function NewIconFromResource (line 98) | func NewIconFromResource(name string) (*Icon, error) {
function NewIconFromResourceWithSize (line 103) | func NewIconFromResourceWithSize(name string, size Size) (*Icon, error) {
function NewIconFromResourceId (line 108) | func NewIconFromResourceId(id int) (*Icon, error) {
function NewIconFromResourceIdWithSize (line 113) | func NewIconFromResourceIdWithSize(id int, size Size) (*Icon, error) {
function newIconFromResource (line 117) | func newIconFromResource(res *uint16, size Size) (*Icon, error) {
function NewIconFromSysDLL (line 127) | func NewIconFromSysDLL(dllBaseName string, index int) (*Icon, error) {
function NewIconFromSysDLLWithSize (line 133) | func NewIconFromSysDLLWithSize(dllBaseName string, index, size int) (*Ic...
function NewIconExtractedFromFile (line 143) | func NewIconExtractedFromFile(filePath string, index, _ int) (*Icon, err...
function NewIconExtractedFromFileWithSize (line 148) | func NewIconExtractedFromFileWithSize(filePath string, index, size int) ...
function NewIconFromImage (line 155) | func NewIconFromImage(im image.Image) (ic *Icon, err error) {
function NewIconFromImageForDPI (line 160) | func NewIconFromImageForDPI(im image.Image, dpi int) (ic *Icon, err erro...
function NewIconFromImageWithSize (line 171) | func NewIconFromImageWithSize(image Image, size Size) (*Icon, error) {
function newIconFromImageForDPI (line 180) | func newIconFromImageForDPI(image Image, dpi int) (*Icon, error) {
function NewIconFromBitmap (line 198) | func NewIconFromBitmap(bmp *Bitmap) (ic *Icon, err error) {
function NewIconFromHICON (line 209) | func NewIconFromHICON(hIcon win.HICON) (ic *Icon, err error) {
function NewIconFromHICONForDPI (line 214) | func NewIconFromHICONForDPI(hIcon win.HICON, dpi int) (ic *Icon, err err...
function newIconFromHICONAndSize (line 223) | func newIconFromHICONAndSize(hIcon win.HICON, size Size, dpi int) *Icon {
function checkNewIcon (line 227) | func checkNewIcon(icon *Icon) (*Icon, error) {
function createAlphaCursorOrIconFromImage (line 353) | func createAlphaCursorOrIconFromImage(im image.Image, hotspot image.Poin...
function createAlphaCursorOrIconFromBitmap (line 364) | func createAlphaCursorOrIconFromBitmap(bmp *Bitmap, hotspot Point, fIcon...
function sizeFromHICON (line 388) | func sizeFromHICON(hIcon win.HICON) (Size, error) {
function defaultIconSize (line 414) | func defaultIconSize() Size {
FILE: iconcache.go
function init (line 11) | func init() {
type IconCache (line 17) | type IconCache struct
method Clear (line 34) | func (ic *IconCache) Clear() {
method Dispose (line 45) | func (ic *IconCache) Dispose() {
method Bitmap (line 49) | func (ic *IconCache) Bitmap(image Image, dpi int) (*Bitmap, error) {
method Icon (line 68) | func (ic *IconCache) Icon(image Image, dpi int) (*Icon, error) {
type imageAndDPI (line 22) | type imageAndDPI struct
function NewIconCache (line 27) | func NewIconCache() *IconCache {
FILE: image.go
type Image (line 16) | type Image interface
function ImageFrom (line 29) | func ImageFrom(src interface{}) (img Image, err error) {
function NewImageFromFile (line 56) | func NewImageFromFile(filePath string) (Image, error) {
function NewImageFromFileForDPI (line 62) | func NewImageFromFileForDPI(filePath string, dpi int) (Image, error) {
type PaintFuncImage (line 72) | type PaintFuncImage struct
method draw (line 103) | func (pfi *PaintFuncImage) draw(hdc win.HDC, location Point) error {
method drawStretched (line 110) | func (pfi *PaintFuncImage) drawStretched(hdc win.HDC, bounds Rectangle...
method drawStretchedOnCanvasPixels (line 120) | func (pfi *PaintFuncImage) drawStretchedOnCanvasPixels(canvas *Canvas,...
method Dispose (line 131) | func (pfi *PaintFuncImage) Dispose() {
method Size (line 139) | func (pfi *PaintFuncImage) Size() Size {
function NewPaintFuncImage (line 81) | func NewPaintFuncImage(size Size, paint func(canvas *Canvas, bounds Rect...
function NewPaintFuncImagePixels (line 87) | func NewPaintFuncImagePixels(size Size, paint func(canvas *Canvas, bound...
function NewPaintFuncImageWithDispose (line 93) | func NewPaintFuncImageWithDispose(size Size, paint func(canvas *Canvas, ...
function NewPaintFuncImagePixelsWithDispose (line 99) | func NewPaintFuncImagePixelsWithDispose(size Size, paint func(canvas *Ca...
FILE: imagelist.go
type ImageList (line 16) | type ImageList struct
method Handle (line 63) | func (il *ImageList) Handle() win.HIMAGELIST {
method Add (line 67) | func (il *ImageList) Add(bitmap, maskBitmap *Bitmap) (int, error) {
method AddMasked (line 93) | func (il *ImageList) AddMasked(bitmap *Bitmap) (int32, error) {
method AddIcon (line 115) | func (il *ImageList) AddIcon(icon *Icon) (int32, error) {
method AddImage (line 134) | func (il *ImageList) AddImage(image interface{}) (int32, error) {
method DrawPixels (line 154) | func (il *ImageList) DrawPixels(canvas *Canvas, index int, bounds Rect...
method Dispose (line 162) | func (il *ImageList) Dispose() {
method MaskColor (line 169) | func (il *ImageList) MaskColor() Color {
type bitmapMaskedBitmap (line 26) | type bitmapMaskedBitmap struct
function NewImageList (line 35) | func NewImageList(imageSize Size, maskColor Color) (*ImageList, error) {
function NewImageListForDPI (line 41) | func NewImageListForDPI(imageSize Size, maskColor Color, dpi int) (*Imag...
function imageListForImage (line 173) | func imageListForImage(image interface{}, dpi int) (hIml win.HIMAGELIST,...
function iconIndexAndHImlForFilePath (line 196) | func iconIndexAndHImlForFilePath(filePath string) (int32, win.HIMAGELIST) {
function imageIndexMaybeAdd (line 212) | func imageIndexMaybeAdd(image interface{}, hIml win.HIMAGELIST, isSysIml...
function imageIndexAddIfNotExists (line 229) | func imageIndexAddIfNotExists(image interface{}, hIml win.HIMAGELIST, im...
FILE: imageview.go
type ImageViewMode (line 15) | type ImageViewMode
constant ImageViewModeIdeal (line 18) | ImageViewModeIdeal ImageViewMode = iota
constant ImageViewModeCorner (line 19) | ImageViewModeCorner
constant ImageViewModeCenter (line 20) | ImageViewModeCenter
constant ImageViewModeShrink (line 21) | ImageViewModeShrink
constant ImageViewModeZoom (line 22) | ImageViewModeZoom
constant ImageViewModeStretch (line 23) | ImageViewModeStretch
type ImageView (line 26) | type ImageView struct
method Mode (line 82) | func (iv *ImageView) Mode() ImageViewMode {
method SetMode (line 86) | func (iv *ImageView) SetMode(mode ImageViewMode) {
method applyDPI (line 98) | func (iv *ImageView) applyDPI(dpi int) {
method Image (line 106) | func (iv *ImageView) Image() Image {
method SetImage (line 110) | func (iv *ImageView) SetImage(image Image) error {
method ImageChanged (line 139) | func (iv *ImageView) ImageChanged() *Event {
method Margin (line 143) | func (iv *ImageView) Margin() int {
method SetMargin (line 147) | func (iv *ImageView) SetMargin(margin int) error {
method MarginChanged (line 165) | func (iv *ImageView) MarginChanged() *Event {
method drawImage (line 169) | func (iv *ImageView) drawImage(canvas *Canvas, _ Rectangle) error {
method CreateLayoutItem (line 233) | func (iv *ImageView) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function NewImageView (line 35) | func NewImageView(parent Container) (*ImageView, error) {
type imageViewLayoutItem (line 264) | type imageViewLayoutItem struct
method LayoutFlags (line 271) | func (li *imageViewLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 275) | func (li *imageViewLayoutItem) IdealSize() Size {
method MinSize (line 279) | func (li *imageViewLayoutItem) MinSize() Size {
FILE: inifilesettings.go
constant iniFileTimeStampFormat (line 18) | iniFileTimeStampFormat = "2006-01-02"
type IniFileSettings (line 20) | type IniFileSettings struct
method Get (line 39) | func (ifs *IniFileSettings) Get(key string) (string, bool) {
method Timestamp (line 44) | func (ifs *IniFileSettings) Timestamp(key string) (time.Time, bool) {
method Put (line 49) | func (ifs *IniFileSettings) Put(key, value string) error {
method PutExpiring (line 53) | func (ifs *IniFileSettings) PutExpiring(key, value string) error {
method put (line 57) | func (ifs *IniFileSettings) put(key, value string, expiring bool) error {
method Remove (line 78) | func (ifs *IniFileSettings) Remove(key string) error {
method ExpireDuration (line 84) | func (ifs *IniFileSettings) ExpireDuration() time.Duration {
method SetExpireDuration (line 88) | func (ifs *IniFileSettings) SetExpireDuration(expireDuration time.Dura...
method Portable (line 92) | func (ifs *IniFileSettings) Portable() bool {
method SetPortable (line 96) | func (ifs *IniFileSettings) SetPortable(portable bool) {
method FilePath (line 100) | func (ifs *IniFileSettings) FilePath() string {
method fileExists (line 122) | func (ifs *IniFileSettings) fileExists() (bool, error) {
method withFile (line 133) | func (ifs *IniFileSettings) withFile(flags int, f func(file *os.File) ...
method Load (line 150) | func (ifs *IniFileSettings) Load() error {
method Save (line 190) | func (ifs *IniFileSettings) Save() error {
type iniFileRecord (line 27) | type iniFileRecord struct
function NewIniFileSettings (line 32) | func NewIniFileSettings(fileName string) *IniFileSettings {
FILE: intevent.go
type intEventHandlerInfo (line 9) | type intEventHandlerInfo struct
type IntEventHandler (line 14) | type IntEventHandler
type IntEvent (line 16) | type IntEvent struct
method Attach (line 20) | func (e *IntEvent) Attach(handler IntEventHandler) int {
method Detach (line 35) | func (e *IntEvent) Detach(handle int) {
method Once (line 39) | func (e *IntEvent) Once(handler IntEventHandler) {
type IntEventPublisher (line 44) | type IntEventPublisher struct
method Event (line 48) | func (p *IntEventPublisher) Event() *IntEvent {
method Publish (line 52) | func (p *IntEventPublisher) Publish(n int) {
FILE: intrangeevent.go
type intRangeEventHandlerInfo (line 9) | type intRangeEventHandlerInfo struct
type IntRangeEventHandler (line 14) | type IntRangeEventHandler
type IntRangeEvent (line 16) | type IntRangeEvent struct
method Attach (line 20) | func (e *IntRangeEvent) Attach(handler IntRangeEventHandler) int {
method Detach (line 35) | func (e *IntRangeEvent) Detach(handle int) {
method Once (line 39) | func (e *IntRangeEvent) Once(handler IntRangeEventHandler) {
type IntRangeEventPublisher (line 44) | type IntRangeEventPublisher struct
method Event (line 48) | func (p *IntRangeEventPublisher) Event() *IntRangeEvent {
method Publish (line 52) | func (p *IntRangeEventPublisher) Publish(from, to int) {
FILE: keyboard.go
type Key (line 17) | type Key
method String (line 19) | func (k Key) String() string {
constant KeyLButton (line 24) | KeyLButton Key = win.VK_LBUTTON
constant KeyRButton (line 25) | KeyRButton Key = win.VK_RBUTTON
constant KeyCancel (line 26) | KeyCancel Key = win.VK_CANCEL
constant KeyMButton (line 27) | KeyMButton Key = win.VK_MBUTTON
constant KeyXButton1 (line 28) | KeyXButton1 Key = win.VK_XBUTTON1
constant KeyXButton2 (line 29) | KeyXButton2 Key = win.VK_XBUTTON2
constant KeyBack (line 30) | KeyBack Key = win.VK_BACK
constant KeyTab (line 31) | KeyTab Key = win.VK_TAB
constant KeyClear (line 32) | KeyClear Key = win.VK_CLEAR
constant KeyReturn (line 33) | KeyReturn Key = win.VK_RETURN
constant KeyShift (line 34) | KeyShift Key = win.VK_SHIFT
constant KeyControl (line 35) | KeyControl Key = win.VK_CONTROL
constant KeyAlt (line 36) | KeyAlt Key = win.VK_MENU
constant KeyMenu (line 37) | KeyMenu Key = win.VK_MENU
constant KeyPause (line 38) | KeyPause Key = win.VK_PAUSE
constant KeyCapital (line 39) | KeyCapital Key = win.VK_CAPITAL
constant KeyKana (line 40) | KeyKana Key = win.VK_KANA
constant KeyHangul (line 41) | KeyHangul Key = win.VK_HANGUL
constant KeyJunja (line 42) | KeyJunja Key = win.VK_JUNJA
constant KeyFinal (line 43) | KeyFinal Key = win.VK_FINAL
constant KeyHanja (line 44) | KeyHanja Key = win.VK_HANJA
constant KeyKanji (line 45) | KeyKanji Key = win.VK_KANJI
constant KeyEscape (line 46) | KeyEscape Key = win.VK_ESCAPE
constant KeyConvert (line 47) | KeyConvert Key = win.VK_CONVERT
constant KeyNonconvert (line 48) | KeyNonconvert Key = win.VK_NONCONVERT
constant KeyAccept (line 49) | KeyAccept Key = win.VK_ACCEPT
constant KeyModeChange (line 50) | KeyModeChange Key = win.VK_MODECHANGE
constant KeySpace (line 51) | KeySpace Key = win.VK_SPACE
constant KeyPrior (line 52) | KeyPrior Key = win.VK_PRIOR
constant KeyNext (line 53) | KeyNext Key = win.VK_NEXT
constant KeyEnd (line 54) | KeyEnd Key = win.VK_END
constant KeyHome (line 55) | KeyHome Key = win.VK_HOME
constant KeyLeft (line 56) | KeyLeft Key = win.VK_LEFT
constant KeyUp (line 57) | KeyUp Key = win.VK_UP
constant KeyRight (line 58) | KeyRight Key = win.VK_RIGHT
constant KeyDown (line 59) | KeyDown Key = win.VK_DOWN
constant KeySelect (line 60) | KeySelect Key = win.VK_SELECT
constant KeyPrint (line 61) | KeyPrint Key = win.VK_PRINT
constant KeyExecute (line 62) | KeyExecute Key = win.VK_EXECUTE
constant KeySnapshot (line 63) | KeySnapshot Key = win.VK_SNAPSHOT
constant KeyInsert (line 64) | KeyInsert Key = win.VK_INSERT
constant KeyDelete (line 65) | KeyDelete Key = win.VK_DELETE
constant KeyHelp (line 66) | KeyHelp Key = win.VK_HELP
constant Key0 (line 67) | Key0 Key = 0x30
constant Key1 (line 68) | Key1 Key = 0x31
constant Key2 (line 69) | Key2 Key = 0x32
constant Key3 (line 70) | Key3 Key = 0x33
constant Key4 (line 71) | Key4 Key = 0x34
constant Key5 (line 72) | Key5 Key = 0x35
constant Key6 (line 73) | Key6 Key = 0x36
constant Key7 (line 74) | Key7 Key = 0x37
constant Key8 (line 75) | Key8 Key = 0x38
constant Key9 (line 76) | Key9 Key = 0x39
constant KeyA (line 77) | KeyA Key = 0x41
constant KeyB (line 78) | KeyB Key = 0x42
constant KeyC (line 79) | KeyC Key = 0x43
constant KeyD (line 80) | KeyD Key = 0x44
constant KeyE (line 81) | KeyE Key = 0x45
constant KeyF (line 82) | KeyF Key = 0x46
constant KeyG (line 83) | KeyG Key = 0x47
constant KeyH (line 84) | KeyH Key = 0x48
constant KeyI (line 85) | KeyI Key = 0x49
constant KeyJ (line 86) | KeyJ Key = 0x4A
constant KeyK (line 87) | KeyK Key = 0x4B
constant KeyL (line 88) | KeyL Key = 0x4C
constant KeyM (line 89) | KeyM Key = 0x4D
constant KeyN (line 90) | KeyN Key = 0x4E
constant KeyO (line 91) | KeyO Key = 0x4F
constant KeyP (line 92) | KeyP Key = 0x50
constant KeyQ (line 93) | KeyQ Key = 0x51
constant KeyR (line 94) | KeyR Key = 0x52
constant KeyS (line 95) | KeyS Key = 0x53
constant KeyT (line 96) | KeyT Key = 0x54
constant KeyU (line 97) | KeyU Key = 0x55
constant KeyV (line 98) | KeyV Key = 0x56
constant KeyW (line 99) | KeyW Key = 0x57
constant KeyX (line 100) | KeyX Key = 0x58
constant KeyY (line 101) | KeyY Key = 0x59
constant KeyZ (line 102) | KeyZ Key = 0x5A
constant KeyLWin (line 103) | KeyLWin Key = win.VK_LWIN
constant KeyRWin (line 104) | KeyRWin Key = win.VK_RWIN
constant KeyApps (line 105) | KeyApps Key = win.VK_APPS
constant KeySleep (line 106) | KeySleep Key = win.VK_SLEEP
constant KeyNumpad0 (line 107) | KeyNumpad0 Key = win.VK_NUMPAD0
constant KeyNumpad1 (line 108) | KeyNumpad1 Key = win.VK_NUMPAD1
constant KeyNumpad2 (line 109) | KeyNumpad2 Key = win.VK_NUMPAD2
constant KeyNumpad3 (line 110) | KeyNumpad3 Key = win.VK_NUMPAD3
constant KeyNumpad4 (line 111) | KeyNumpad4 Key = win.VK_NUMPAD4
constant KeyNumpad5 (line 112) | KeyNumpad5 Key = win.VK_NUMPAD5
constant KeyNumpad6 (line 113) | KeyNumpad6 Key = win.VK_NUMPAD6
constant KeyNumpad7 (line 114) | KeyNumpad7 Key = win.VK_NUMPAD7
constant KeyNumpad8 (line 115) | KeyNumpad8 Key = win.VK_NUMPAD8
constant KeyNumpad9 (line 116) | KeyNumpad9 Key = win.VK_NUMPAD9
constant KeyMultiply (line 117) | KeyMultiply Key = win.VK_MULTIPLY
constant KeyAdd (line 118) | KeyAdd Key = win.VK_ADD
constant KeySeparator (line 119) | KeySeparator Key = win.VK_SEPARATOR
constant KeySubtract (line 120) | KeySubtract Key = win.VK_SUBTRACT
constant KeyDecimal (line 121) | KeyDecimal Key = win.VK_DECIMAL
constant KeyDivide (line 122) | KeyDivide Key = win.VK_DIVIDE
constant KeyF1 (line 123) | KeyF1 Key = win.VK_F1
constant KeyF2 (line 124) | KeyF2 Key = win.VK_F2
constant KeyF3 (line 125) | KeyF3 Key = win.VK_F3
constant KeyF4 (line 126) | KeyF4 Key = win.VK_F4
constant KeyF5 (line 127) | KeyF5 Key = win.VK_F5
constant KeyF6 (line 128) | KeyF6 Key = win.VK_F6
constant KeyF7 (line 129) | KeyF7 Key = win.VK_F7
constant KeyF8 (line 130) | KeyF8 Key = win.VK_F8
constant KeyF9 (line 131) | KeyF9 Key = win.VK_F9
constant KeyF10 (line 132) | KeyF10 Key = win.VK_F10
constant KeyF11 (line 133) | KeyF11 Key = win.VK_F11
constant KeyF12 (line 134) | KeyF12 Key = win.VK_F12
constant KeyF13 (line 135) | KeyF13 Key = win.VK_F13
constant KeyF14 (line 136) | KeyF14 Key = win.VK_F14
constant KeyF15 (line 137) | KeyF15 Key = win.VK_F15
constant KeyF16 (line 138) | KeyF16 Key = win.VK_F16
constant KeyF17 (line 139) | KeyF17 Key = win.VK_F17
constant KeyF18 (line 140) | KeyF18 Key = win.VK_F18
constant KeyF19 (line 141) | KeyF19 Key = win.VK_F19
constant KeyF20 (line 142) | KeyF20 Key = win.VK_F20
constant KeyF21 (line 143) | KeyF21 Key = win.VK_F21
constant KeyF22 (line 144) | KeyF22 Key = win.VK_F22
constant KeyF23 (line 145) | KeyF23 Key = win.VK_F23
constant KeyF24 (line 146) | KeyF24 Key = win.VK_F24
constant KeyNumlock (line 147) | KeyNumlock Key = win.VK_NUMLOCK
constant KeyScroll (line 148) | KeyScroll Key = win.VK_SCROLL
constant KeyLShift (line 149) | KeyLShift Key = win.VK_LSHIFT
constant KeyRShift (line 150) | KeyRShift Key = win.VK_RSHIFT
constant KeyLControl (line 151) | KeyLControl Key = win.VK_LCONTROL
constant KeyRControl (line 152) | KeyRControl Key = win.VK_RCONTROL
constant KeyLAlt (line 153) | KeyLAlt Key = win.VK_LMENU
constant KeyLMenu (line 154) | KeyLMenu Key = win.VK_LMENU
constant KeyRAlt (line 155) | KeyRAlt Key = win.VK_RMENU
constant KeyRMenu (line 156) | KeyRMenu Key = win.VK_RMENU
constant KeyBrowserBack (line 157) | KeyBrowserBack Key = win.VK_BROWSER_BACK
constant KeyBrowserForward (line 158) | KeyBrowserForward Key = win.VK_BROWSER_FORWARD
constant KeyBrowserRefresh (line 159) | KeyBrowserRefresh Key = win.VK_BROWSER_REFRESH
constant KeyBrowserStop (line 160) | KeyBrowserStop Key = win.VK_BROWSER_STOP
constant KeyBrowserSearch (line 161) | KeyBrowserSearch Key = win.VK_BROWSER_SEARCH
constant KeyBrowserFavorites (line 162) | KeyBrowserFavorites Key = win.VK_BROWSER_FAVORITES
constant KeyBrowserHome (line 163) | KeyBrowserHome Key = win.VK_BROWSER_HOME
constant KeyVolumeMute (line 164) | KeyVolumeMute Key = win.VK_VOLUME_MUTE
constant KeyVolumeDown (line 165) | KeyVolumeDown Key = win.VK_VOLUME_DOWN
constant KeyVolumeUp (line 166) | KeyVolumeUp Key = win.VK_VOLUME_UP
constant KeyMediaNextTrack (line 167) | KeyMediaNextTrack Key = win.VK_MEDIA_NEXT_TRACK
constant KeyMediaPrevTrack (line 168) | KeyMediaPrevTrack Key = win.VK_MEDIA_PREV_TRACK
constant KeyMediaStop (line 169) | KeyMediaStop Key = win.VK_MEDIA_STOP
constant KeyMediaPlayPause (line 170) | KeyMediaPlayPause Key = win.VK_MEDIA_PLAY_PAUSE
constant KeyLaunchMail (line 171) | KeyLaunchMail Key = win.VK_LAUNCH_MAIL
constant KeyLaunchMediaSelect (line 172) | KeyLaunchMediaSelect Key = win.VK_LAUNCH_MEDIA_SELECT
constant KeyLaunchApp1 (line 173) | KeyLaunchApp1 Key = win.VK_LAUNCH_APP1
constant KeyLaunchApp2 (line 174) | KeyLaunchApp2 Key = win.VK_LAUNCH_APP2
constant KeyOEM1 (line 175) | KeyOEM1 Key = win.VK_OEM_1
constant KeyOEMPlus (line 176) | KeyOEMPlus Key = win.VK_OEM_PLUS
constant KeyOEMComma (line 177) | KeyOEMComma Key = win.VK_OEM_COMMA
constant KeyOEMMinus (line 178) | KeyOEMMinus Key = win.VK_OEM_MINUS
constant KeyOEMPeriod (line 179) | KeyOEMPeriod Key = win.VK_OEM_PERIOD
constant KeyOEM2 (line 180) | KeyOEM2 Key = win.VK_OEM_2
constant KeyOEM3 (line 181) | KeyOEM3 Key = win.VK_OEM_3
constant KeyOEM4 (line 182) | KeyOEM4 Key = win.VK_OEM_4
constant KeyOEM5 (line 183) | KeyOEM5 Key = win.VK_OEM_5
constant KeyOEM6 (line 184) | KeyOEM6 Key = win.VK_OEM_6
constant KeyOEM7 (line 185) | KeyOEM7 Key = win.VK_OEM_7
constant KeyOEM8 (line 186) | KeyOEM8 Key = win.VK_OEM_8
constant KeyOEM102 (line 187) | KeyOEM102 Key = win.VK_OEM_102
constant KeyProcessKey (line 188) | KeyProcessKey Key = win.VK_PROCESSKEY
constant KeyPacket (line 189) | KeyPacket Key = win.VK_PACKET
constant KeyAttn (line 190) | KeyAttn Key = win.VK_ATTN
constant KeyCRSel (line 191) | KeyCRSel Key = win.VK_CRSEL
constant KeyEXSel (line 192) | KeyEXSel Key = win.VK_EXSEL
constant KeyErEOF (line 193) | KeyErEOF Key = win.VK_EREOF
constant KeyPlay (line 194) | KeyPlay Key = win.VK_PLAY
constant KeyZoom (line 195) | KeyZoom Key = win.VK_ZOOM
constant KeyNoName (line 196) | KeyNoName Key = win.VK_NONAME
constant KeyPA1 (line 197) | KeyPA1 Key = win.VK_PA1
constant KeyOEMClear (line 198) | KeyOEMClear Key = win.VK_OEM_CLEAR
type Modifiers (line 374) | type Modifiers
method String (line 376) | func (m Modifiers) String() string {
constant ModShift (line 391) | ModShift Modifiers = 1 << iota
constant ModControl (line 392) | ModControl
constant ModAlt (line 393) | ModAlt
function ModifiersDown (line 396) | func ModifiersDown() Modifiers {
type Shortcut (line 412) | type Shortcut struct
method String (line 417) | func (s Shortcut) String() string {
function AltDown (line 432) | func AltDown() bool {
function ControlDown (line 436) | func ControlDown() bool {
function ShiftDown (line 440) | func ShiftDown() bool {
FILE: keyevent.go
type keyEventHandlerInfo (line 9) | type keyEventHandlerInfo struct
type KeyEventHandler (line 14) | type KeyEventHandler
type KeyEvent (line 16) | type KeyEvent struct
method Attach (line 20) | func (e *KeyEvent) Attach(handler KeyEventHandler) int {
method Detach (line 35) | func (e *KeyEvent) Detach(handle int) {
method Once (line 39) | func (e *KeyEvent) Once(handler KeyEventHandler) {
type KeyEventPublisher (line 44) | type KeyEventPublisher struct
method Event (line 48) | func (p *KeyEventPublisher) Event() *KeyEvent {
method Publish (line 52) | func (p *KeyEventPublisher) Publish(key Key) {
FILE: label.go
type EllipsisMode (line 11) | type EllipsisMode
constant EllipsisNone (line 14) | EllipsisNone EllipsisMode = 0
constant EllipsisEnd (line 15) | EllipsisEnd = EllipsisMode(win.SS_ENDELLIPSIS)
constant EllipsisPath (line 16) | EllipsisPath = EllipsisMode(win.SS_PATHELLIPSIS)
type Label (line 19) | type Label struct
method asStatic (line 49) | func (l *Label) asStatic() *static {
method EllipsisMode (line 53) | func (l *Label) EllipsisMode() EllipsisMode {
method SetEllipsisMode (line 57) | func (l *Label) SetEllipsisMode(mode EllipsisMode) error {
method TextAlignment (line 73) | func (l *Label) TextAlignment() Alignment1D {
method SetTextAlignment (line 77) | func (l *Label) SetTextAlignment(alignment Alignment1D) error {
method Text (line 85) | func (l *Label) Text() string {
method SetText (line 89) | func (l *Label) SetText(text string) error {
function NewLabel (line 24) | func NewLabel(parent Container) (*Label, error) {
function NewLabelWithStyle (line 28) | func NewLabelWithStyle(parent Container, style uint32) (*Label, error) {
FILE: layout.go
function createLayoutItemForWidget (line 15) | func createLayoutItemForWidget(widget Widget) LayoutItem {
function createLayoutItemForWidgetWithContext (line 21) | func createLayoutItemForWidgetWithContext(widget Widget, ctx *LayoutCont...
function CreateLayoutItemsForContainer (line 47) | func CreateLayoutItemsForContainer(container Container) ContainerLayoutI...
function CreateLayoutItemsForContainerWithContext (line 53) | func CreateLayoutItemsForContainerWithContext(container Container, ctx *...
function startLayoutPerformer (line 102) | func startLayoutPerformer(form Form) (performLayout chan ContainerLayout...
function layoutTree (line 165) | func layoutTree(root ContainerLayoutItem, size Size, cancel chan struct{...
function applyLayoutResults (line 288) | func applyLayoutResults(results []LayoutResult, stopwatch *stopwatch) er...
type Margins (line 391) | type Margins struct
method isZero (line 395) | func (m Margins) isZero() bool {
type Layout (line 399) | type Layout interface
type LayoutBase (line 410) | type LayoutBase struct
method asLayoutBase (line 422) | func (l *LayoutBase) asLayoutBase() *LayoutBase {
method Container (line 426) | func (l *LayoutBase) Container() Container {
method SetContainer (line 430) | func (l *LayoutBase) SetContainer(value Container) {
method Margins (line 453) | func (l *LayoutBase) Margins() Margins {
method SetMargins (line 457) | func (l *LayoutBase) SetMargins(value Margins) error {
method Spacing (line 477) | func (l *LayoutBase) Spacing() int {
method SetSpacing (line 481) | func (l *LayoutBase) SetSpacing(value int) error {
method updateMargins (line 501) | func (l *LayoutBase) updateMargins() {
method updateSpacing (line 507) | func (l *LayoutBase) updateSpacing() {
method Alignment (line 513) | func (l *LayoutBase) Alignment() Alignment2D {
method SetAlignment (line 517) | func (l *LayoutBase) SetAlignment(alignment Alignment2D) error {
type IdealSizer (line 533) | type IdealSizer interface
type MinSizer (line 538) | type MinSizer interface
type MinSizeForSizer (line 543) | type MinSizeForSizer interface
type HeightForWidther (line 548) | type HeightForWidther interface
type LayoutContext (line 556) | type LayoutContext struct
method DPI (line 561) | func (ctx *LayoutContext) DPI() int {
function newLayoutContext (line 565) | func newLayoutContext(handle win.HWND) *LayoutContext {
type LayoutItem (line 572) | type LayoutItem interface
type ContainerLayoutItem (line 582) | type ContainerLayoutItem interface
type LayoutItemBase (line 597) | type LayoutItemBase struct
method AsLayoutItemBase (line 605) | func (lib *LayoutItemBase) AsLayoutItemBase() *LayoutItemBase {
method Context (line 609) | func (lib *LayoutItemBase) Context() *LayoutContext {
method Handle (line 613) | func (lib *LayoutItemBase) Handle() win.HWND {
method Geometry (line 617) | func (lib *LayoutItemBase) Geometry() *Geometry {
method Parent (line 621) | func (lib *LayoutItemBase) Parent() ContainerLayoutItem {
method Visible (line 625) | func (lib *LayoutItemBase) Visible() bool {
type ContainerLayoutItemBase (line 629) | type ContainerLayoutItemBase struct
method AsContainerLayoutItemBase (line 637) | func (clib *ContainerLayoutItemBase) AsContainerLayoutItemBase() *Cont...
method MinSizeEffectiveForChild (line 643) | func (clib *ContainerLayoutItemBase) MinSizeEffectiveForChild(child La...
method Children (line 685) | func (clib *ContainerLayoutItemBase) Children() []LayoutItem {
method SetChildren (line 689) | func (clib *ContainerLayoutItemBase) SetChildren(children []LayoutItem) {
method containsHandle (line 693) | func (clib *ContainerLayoutItemBase) containsHandle(handle win.HWND) b...
method HasHeightForWidth (line 703) | func (clib *ContainerLayoutItemBase) HasHeightForWidth() bool {
type greedyLayoutItem (line 713) | type greedyLayoutItem struct
method LayoutFlags (line 721) | func (*greedyLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 725) | func (li *greedyLayoutItem) IdealSize() Size {
method MinSize (line 729) | func (li *greedyLayoutItem) MinSize() Size {
function NewGreedyLayoutItem (line 717) | func NewGreedyLayoutItem() LayoutItem {
type Geometry (line 733) | type Geometry struct
type formLayoutResult (line 743) | type formLayoutResult struct
type LayoutResult (line 749) | type LayoutResult struct
type LayoutResultItem (line 754) | type LayoutResultItem struct
function shouldLayoutItem (line 759) | func shouldLayoutItem(item LayoutItem) bool {
function itemsToLayout (line 769) | func itemsToLayout(allItems []LayoutItem) []LayoutItem {
function anyVisibleItemInHierarchy (line 795) | func anyVisibleItemInHierarchy(item LayoutItem) bool {
function minSizeEffective (line 814) | func minSizeEffective(item LayoutItem) Size {
FILE: lineedit.go
type CaseMode (line 18) | type CaseMode
constant CaseModeMixed (line 21) | CaseModeMixed CaseMode = iota
constant CaseModeUpper (line 22) | CaseModeUpper
constant CaseModeLower (line 23) | CaseModeLower
constant lineEditMinChars (line 27) | lineEditMinChars = 1
constant lineEditGreedyLimit (line 28) | lineEditGreedyLimit = 29
type LineEdit (line 31) | type LineEdit struct
method CueBanner (line 104) | func (le *LineEdit) CueBanner() string {
method SetCueBanner (line 114) | func (le *LineEdit) SetCueBanner(value string) error {
method MaxLength (line 122) | func (le *LineEdit) MaxLength() int {
method SetMaxLength (line 126) | func (le *LineEdit) SetMaxLength(value int) {
method Text (line 130) | func (le *LineEdit) Text() string {
method SetText (line 134) | func (le *LineEdit) SetText(value string) error {
method TextSelection (line 138) | func (le *LineEdit) TextSelection() (start, end int) {
method SetTextSelection (line 143) | func (le *LineEdit) SetTextSelection(start, end int) {
method TextAlignment (line 147) | func (le *LineEdit) TextAlignment() Alignment1D {
method SetTextAlignment (line 159) | func (le *LineEdit) SetTextAlignment(alignment Alignment1D) error {
method CaseMode (line 180) | func (le *LineEdit) CaseMode() CaseMode {
method SetCaseMode (line 192) | func (le *LineEdit) SetCaseMode(mode CaseMode) error {
method PasswordMode (line 214) | func (le *LineEdit) PasswordMode() bool {
method SetPasswordMode (line 218) | func (le *LineEdit) SetPasswordMode(value bool) {
method ReadOnly (line 227) | func (le *LineEdit) ReadOnly() bool {
method SetReadOnly (line 231) | func (le *LineEdit) SetReadOnly(readOnly bool) error {
method sizeHintForLimit (line 246) | func (le *LineEdit) sizeHintForLimit(limit int) (size Size) {
method initCharWidth (line 257) | func (le *LineEdit) initCharWidth() {
method EditingFinished (line 284) | func (le *LineEdit) EditingFinished() *Event {
method TextChanged (line 288) | func (le *LineEdit) TextChanged() *Event {
method TextColor (line 292) | func (le *LineEdit) TextColor() Color {
method SetTextColor (line 296) | func (le *LineEdit) SetTextColor(c Color) {
method NeedsWmSize (line 302) | func (*LineEdit) NeedsWmSize() bool {
method WndProc (line 306) | func (le *LineEdit) WndProc(hwnd win.HWND, msg uint32, wParam, lParam ...
method CreateLayoutItem (line 349) | func (le *LineEdit) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function newLineEdit (line 41) | func newLineEdit(parent Window) (*LineEdit, error) {
function NewLineEdit (line 77) | func NewLineEdit(parent Container) (*LineEdit, error) {
type lineEditLayoutItem (line 362) | type lineEditLayoutItem struct
method LayoutFlags (line 369) | func (li *lineEditLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 373) | func (li *lineEditLayoutItem) IdealSize() Size {
method MinSize (line 377) | func (li *lineEditLayoutItem) MinSize() Size {
FILE: linklabel.go
type LinkLabel (line 16) | type LinkLabel struct
method Text (line 48) | func (ll *LinkLabel) Text() string {
method SetText (line 52) | func (ll *LinkLabel) SetText(value string) error {
method LinkActivated (line 66) | func (ll *LinkLabel) LinkActivated() *LinkLabelLinkEvent {
method WndProc (line 70) | func (ll *LinkLabel) WndProc(hwnd win.HWND, msg uint32, wParam, lParam...
method CreateLayoutItem (line 221) | func (ll *LinkLabel) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function NewLinkLabel (line 22) | func NewLinkLabel(parent Container) (*LinkLabel, error) {
type LinkLabelLinkEventHandler (line 106) | type LinkLabelLinkEventHandler
type LinkLabelLinkEvent (line 108) | type LinkLabelLinkEvent struct
method Attach (line 112) | func (e *LinkLabelLinkEvent) Attach(handler LinkLabelLinkEventHandler)...
method Detach (line 124) | func (e *LinkLabelLinkEvent) Detach(handle int) {
type LinkLabelLinkEventPublisher (line 128) | type LinkLabelLinkEventPublisher struct
method Event (line 132) | func (p *LinkLabelLinkEventPublisher) Event() *LinkLabelLinkEvent {
method Publish (line 136) | func (p *LinkLabelLinkEventPublisher) Publish(link *LinkLabelLink) {
type LinkLabelLink (line 144) | type LinkLabelLink struct
method Index (line 151) | func (lll *LinkLabelLink) Index() int {
method Id (line 155) | func (lll *LinkLabelLink) Id() string {
method URL (line 159) | func (lll *LinkLabelLink) URL() string {
method Enabled (line 163) | func (lll *LinkLabelLink) Enabled() (bool, error) {
method SetEnabled (line 167) | func (lll *LinkLabelLink) SetEnabled(enabled bool) error {
method Focused (line 171) | func (lll *LinkLabelLink) Focused() (bool, error) {
method SetFocused (line 175) | func (lll *LinkLabelLink) SetFocused(focused bool) error {
method Visited (line 179) | func (lll *LinkLabelLink) Visited() (bool, error) {
method SetVisited (line 183) | func (lll *LinkLabelLink) SetVisited(visited bool) error {
method hasState (line 187) | func (lll *LinkLabelLink) hasState(state uint32) (bool, error) {
method setState (line 201) | func (lll *LinkLabelLink) setState(state uint32, set bool) error {
type linkLabelLayoutItem (line 230) | type linkLabelLayoutItem struct
method LayoutFlags (line 235) | func (*linkLabelLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 239) | func (li *linkLabelLayoutItem) IdealSize() Size {
method MinSize (line 243) | func (li *linkLabelLayoutItem) MinSize() Size {
FILE: listbox.go
type ListBox (line 20) | type ListBox struct
method LayoutFlags (line 149) | func (*ListBox) LayoutFlags() LayoutFlags {
method ItemStyler (line 153) | func (lb *ListBox) ItemStyler() ListItemStyler {
method SetItemStyler (line 157) | func (lb *ListBox) SetItemStyler(styler ListItemStyler) {
method ApplySysColors (line 161) | func (lb *ListBox) ApplySysColors() {
method ApplyDPI (line 177) | func (lb *ListBox) ApplyDPI(dpi int) {
method applyFont (line 183) | func (lb *ListBox) applyFont(font *Font) {
method itemString (line 191) | func (lb *ListBox) itemString(index int) string {
method insertItemAt (line 208) | func (lb *ListBox) insertItemAt(index int) error {
method removeItem (line 218) | func (lb *ListBox) removeItem(index int) error {
method resetItems (line 227) | func (lb *ListBox) resetItems() error {
method ensureVisibleItemsHeightUpToDate (line 267) | func (lb *ListBox) ensureVisibleItemsHeightUpToDate() error {
method attachModel (line 312) | func (lb *ListBox) attachModel() {
method detachModel (line 371) | func (lb *ListBox) detachModel() {
method Model (line 379) | func (lb *ListBox) Model() interface{} {
method SetModel (line 387) | func (lb *ListBox) SetModel(mdl interface{}) error {
method BindingMember (line 427) | func (lb *ListBox) BindingMember() string {
method SetBindingMember (line 447) | func (lb *ListBox) SetBindingMember(bindingMember string) error {
method DisplayMember (line 468) | func (lb *ListBox) DisplayMember() string {
method SetDisplayMember (line 488) | func (lb *ListBox) SetDisplayMember(displayMember string) error {
method Format (line 504) | func (lb *ListBox) Format() string {
method SetFormat (line 508) | func (lb *ListBox) SetFormat(value string) {
method Precision (line 512) | func (lb *ListBox) Precision() int {
method SetPrecision (line 516) | func (lb *ListBox) SetPrecision(value int) {
method calculateMaxItemTextWidth (line 521) | func (lb *ListBox) calculateMaxItemTextWidth() int {
method idealSize (line 555) | func (lb *ListBox) idealSize() Size {
method ItemVisible (line 569) | func (lb *ListBox) ItemVisible(index int) bool {
method EnsureItemVisible (line 577) | func (lb *ListBox) EnsureItemVisible(index int) {
method CurrentIndex (line 581) | func (lb *ListBox) CurrentIndex() int {
method SetCurrentIndex (line 585) | func (lb *ListBox) SetCurrentIndex(value int) error {
method SelectedIndexes (line 604) | func (lb *ListBox) SelectedIndexes() []int {
method SetSelectedIndexes (line 621) | func (lb *ListBox) SetSelectedIndexes(indexes []int) {
method CurrentIndexChanged (line 630) | func (lb *ListBox) CurrentIndexChanged() *Event {
method SelectedIndexesChanged (line 634) | func (lb *ListBox) SelectedIndexesChanged() *Event {
method ItemActivated (line 638) | func (lb *ListBox) ItemActivated() *Event {
method WndProc (line 642) | func (lb *ListBox) WndProc(hwnd win.HWND, msg uint32, wParam, lParam u...
method invalidateItem (line 845) | func (lb *ListBox) invalidateItem(index int) {
method CreateLayoutItem (line 852) | func (lb *ListBox) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
function NewListBox (line 51) | func NewListBox(parent Container) (*ListBox, error) {
function NewListBoxWithStyle (line 55) | func NewListBoxWithStyle(parent Container, style uint32) (*ListBox, erro...
FILE: mainloop_cgo.go
function shimHandleKeyDown (line 45) | func shimHandleKeyDown(fb uintptr, msg uintptr) bool {
function shimRunSynchronized (line 50) | func shimRunSynchronized(fb uintptr) {
method mainLoop (line 54) | func (fb *FormBase) mainLoop() int {
FILE: mainloop_default.go
method mainLoop (line 15) | func (fb *FormBase) mainLoop() int {
FILE: mainwindow.go
constant mainWindowWindowClass (line 15) | mainWindowWindowClass = `\o/ Walk_MainWindow_Class \o/`
function init (line 17) | func init() {
type MainWindowCfg (line 23) | type MainWindowCfg struct
type MainWindow (line 28) | type MainWindow struct
method Menu (line 98) | func (mw *MainWindow) Menu() *Menu {
method ToolBar (line 102) | func (mw *MainWindow) ToolBar() *ToolBar {
method SetToolBar (line 106) | func (mw *MainWindow) SetToolBar(tb *ToolBar) {
method StatusBar (line 122) | func (mw *MainWindow) StatusBar() *StatusBar {
method ClientBoundsPixels (line 126) | func (mw *MainWindow) ClientBoundsPixels() Rectangle {
method SetVisible (line 143) | func (mw *MainWindow) SetVisible(visible bool) {
method applyFont (line 153) | func (mw *MainWindow) applyFont(font *Font) {
method Fullscreen (line 165) | func (mw *MainWindow) Fullscreen() bool {
method SetFullscreen (line 169) | func (mw *MainWindow) SetFullscreen(fullscreen bool) error {
method WndProc (line 221) | func (mw *MainWindow) WndProc(hwnd win.HWND, msg uint32, wParam, lPara...
function NewMainWindow (line 36) | func NewMainWindow() (*MainWindow, error) {
function NewMainWindowWithName (line 40) | func NewMainWindowWithName(name string) (*MainWindow, error) {
function NewMainWindowWithCfg (line 44) | func NewMainWindowWithCfg(cfg *MainWindowCfg) (*MainWindow, error) {
FILE: maptablemodel.go
type mapTableModel (line 13) | type mapTableModel struct
method setDataMembers (line 30) | func (m *mapTableModel) setDataMembers(dataMembers []string) {
method RowCount (line 34) | func (m *mapTableModel) RowCount() int {
method Value (line 38) | func (m *mapTableModel) Value(row, col int) interface{} {
method Sort (line 54) | func (m *mapTableModel) Sort(col int, order SortOrder) error {
method Len (line 64) | func (m *mapTableModel) Len() int {
method Less (line 68) | func (m *mapTableModel) Less(i, j int) bool {
method Swap (line 74) | func (m *mapTableModel) Swap(i, j int) {
function newMapTableModel (line 21) | func newMapTableModel(dataSource interface{}) (TableModel, error) {
FILE: menu.go
type Menu (line 17) | type Menu struct
method Dispose (line 67) | func (m *Menu) Dispose() {
method IsDisposed (line 76) | func (m *Menu) IsDisposed() bool {
method Actions (line 80) | func (m *Menu) Actions() *ActionList {
method updateItemsWithImageForWindow (line 84) | func (m *Menu) updateItemsWithImageForWindow(window Window) {
method initMenuItemInfoFromAction (line 102) | func (m *Menu) initMenuItemInfoFromAction(mii *win.MENUITEMINFO, actio...
method handleDefaultState (line 157) | func (m *Menu) handleDefaultState(action *Action) {
method onActionChanged (line 169) | func (m *Menu) onActionChanged(action *Action) error {
method onActionVisibleChanged (line 215) | func (m *Menu) onActionVisibleChanged(action *Action) error {
method insertAction (line 227) | func (m *Menu) insertAction(action *Action, visibleChanged bool) (err ...
method removeAction (line 267) | func (m *Menu) removeAction(action *Action, visibleChanged bool) error {
method ensureMenuBarRedrawn (line 283) | func (m *Menu) ensureMenuBarRedrawn() {
method onInsertedAction (line 291) | func (m *Menu) onInsertedAction(action *Action) error {
method onRemovingAction (line 295) | func (m *Menu) onRemovingAction(action *Action) error {
method onClearingActions (line 299) | func (m *Menu) onClearingActions() error {
function newMenuBar (line 24) | func newMenuBar(window Window) (*Menu, error) {
function NewMenu (line 39) | func NewMenu() (*Menu, error) {
FILE: messagebox.go
type MsgBoxStyle (line 18) | type MsgBoxStyle
constant MsgBoxOK (line 21) | MsgBoxOK MsgBoxStyle = win.MB_OK
constant MsgBoxOKCancel (line 22) | MsgBoxOKCancel MsgBoxStyle = win.MB_OKCANCEL
constant MsgBoxAbortRetryIgnore (line 23) | MsgBoxAbortRetryIgnore MsgBoxStyle = win.MB_ABORTRETRYIGNORE
constant MsgBoxYesNoCancel (line 24) | MsgBoxYesNoCancel MsgBoxStyle = win.MB_YESNOCANCEL
constant MsgBoxYesNo (line 25) | MsgBoxYesNo MsgBoxStyle = win.MB_YESNO
constant MsgBoxRetryCancel (line 26) | MsgBoxRetryCancel MsgBoxStyle = win.MB_RETRYCANCEL
constant MsgBoxCancelTryContinue (line 27) | MsgBoxCancelTryContinue MsgBoxStyle = win.MB_CANCELTRYCONTINUE
constant MsgBoxIconHand (line 28) | MsgBoxIconHand MsgBoxStyle = win.MB_ICONHAND
constant MsgBoxIconQuestion (line 29) | MsgBoxIconQuestion MsgBoxStyle = win.MB_ICONQUESTION
constant MsgBoxIconExclamation (line 30) | MsgBoxIconExclamation MsgBoxStyle = win.MB_ICONEXCLAMATION
constant MsgBoxIconAsterisk (line 31) | MsgBoxIconAsterisk MsgBoxStyle = win.MB_ICONASTERISK
constant MsgBoxUserIcon (line 32) | MsgBoxUserIcon MsgBoxStyle = win.MB_USERICON
constant MsgBoxIconWarning (line 33) | MsgBoxIconWarning MsgBoxStyle = win.MB_ICONWARNING
constant MsgBoxIconError (line 34) | MsgBoxIconError MsgBoxStyle = win.MB_ICONERROR
constant MsgBoxIconInformation (line 35) | MsgBoxIconInformation MsgBoxStyle = win.MB_ICONINFORMATION
constant MsgBoxIconStop (line 36) | MsgBoxIconStop MsgBoxStyle = win.MB_ICONSTOP
constant MsgBoxDefButton1 (line 37) | MsgBoxDefButton1 MsgBoxStyle = win.MB_DEFBUTTON1
constant MsgBoxDefButton2 (line 38) | MsgBoxDefButton2 MsgBoxStyle = win.MB_DEFBUTTON2
constant MsgBoxDefButton3 (line 39) | MsgBoxDefButton3 MsgBoxStyle = win.MB_DEFBUTTON3
constant MsgBoxDefButton4 (line 40) | MsgBoxDefButton4 MsgBoxStyle = win.MB_DEFBUTTON4
constant MsgBoxApplModal (line 41) | MsgBoxApplModal MsgBoxStyle = win.MB_APPLMODAL
constant MsgBoxSystemModal (line 42) | MsgBoxSystemModal MsgBoxStyle = win.MB_SYSTEMMODAL
constant MsgBoxTaskModal (line 43) | MsgBoxTaskModal MsgBoxStyle = win.MB_TASKMODAL
constant MsgBoxHelp (line 44) | MsgBoxHelp MsgBoxStyle = win.MB_HELP
constant MsgBoxSetForeground (line 45) | MsgBoxSetForeground MsgBoxStyle = win.MB_SETFOREGROUND
constant MsgBoxDefaultDesktopOnly (line 46) | MsgBoxDefaultDesktopOnly MsgBoxStyle = win.MB_DEFAULT_DESKTOP_ONLY
constant MsgBoxTopMost (line 47) | MsgBoxTopMost MsgBoxStyle = win.MB_TOPMOST
constant MsgBoxRight (line 48) | MsgBoxRight MsgBoxStyle = win.MB_RIGHT
constant MsgBoxRTLReading (line 49) | MsgBoxRTLReading MsgBoxStyle = win.MB_RTLREADING
constant MsgBoxServiceNotification (line 50) | MsgBoxServiceNotification MsgBoxStyle = win.MB_SERVICE_NOTIFICATION
function MsgBox (line 53) | func MsgBox(owner Form, title, message string, style MsgBoxStyle) int {
FILE: metafile.go
constant milimeterPerMeter (line 17) | milimeterPerMeter float64 = 1000.0
type Metafile (line 19) | type Metafile struct
method Dispose (line 51) | func (mf *Metafile) Dispose() {
method Save (line 61) | func (mf *Metafile) Save(filePath string) error {
method readSizeFromHeader (line 72) | func (mf *Metafile) readSizeFromHeader() error {
method ensureFinished (line 89) | func (mf *Metafile) ensureFinished() error {
method Size (line 109) | func (mf *Metafile) Size() Size {
method draw (line 116) | func (mf *Metafile) draw(hdc win.HDC, location Point) error {
method drawStretched (line 120) | func (mf *Metafile) drawStretched(hdc win.HDC, bounds Rectangle) error {
function NewMetafile (line 26) | func NewMetafile(referenceCanvas *Canvas) (*Metafile, error) {
function NewMetafileFromFile (line 35) | func NewMetafileFromFile(filePath string) (*Metafile, error) {
FILE: models.go
type BindingValueProvider (line 17) | type BindingValueProvider interface
type ListModel (line 23) | type ListModel interface
type ListModelBase (line 49) | type ListModelBase struct
method ItemsReset (line 56) | func (lmb *ListModelBase) ItemsReset() *Event {
method ItemChanged (line 60) | func (lmb *ListModelBase) ItemChanged() *IntEvent {
method ItemsInserted (line 64) | func (lmb *ListModelBase) ItemsInserted() *IntRangeEvent {
method ItemsRemoved (line 68) | func (lmb *ListModelBase) ItemsRemoved() *IntRangeEvent {
method PublishItemsReset (line 72) | func (lmb *ListModelBase) PublishItemsReset() {
method PublishItemChanged (line 76) | func (lmb *ListModelBase) PublishItemChanged(index int) {
method PublishItemsInserted (line 80) | func (lmb *ListModelBase) PublishItemsInserted(from, to int) {
method PublishItemsRemoved (line 84) | func (lmb *ListModelBase) PublishItemsRemoved(from, to int) {
type ReflectListModel (line 90) | type ReflectListModel interface
type ReflectListModelBase (line 115) | type ReflectListModelBase struct
method setValueFunc (line 120) | func (rlmb *ReflectListModelBase) setValueFunc(value func(index int) i...
method Value (line 124) | func (rlmb *ReflectListModelBase) Value(index int) interface{} {
type TableModel (line 130) | type TableModel interface
type TableModelBase (line 161) | type TableModelBase struct
method RowsReset (line 169) | func (tmb *TableModelBase) RowsReset() *Event {
method RowChanged (line 173) | func (tmb *TableModelBase) RowChanged() *IntEvent {
method RowsChanged (line 177) | func (tmb *TableModelBase) RowsChanged() *IntRangeEvent {
method RowsInserted (line 181) | func (tmb *TableModelBase) RowsInserted() *IntRangeEvent {
method RowsRemoved (line 185) | func (tmb *TableModelBase) RowsRemoved() *IntRangeEvent {
method PublishRowsReset (line 189) | func (tmb *TableModelBase) PublishRowsReset() {
method PublishRowChanged (line 193) | func (tmb *TableModelBase) PublishRowChanged(row int) {
method PublishRowsChanged (line 197) | func (tmb *TableModelBase) PublishRowsChanged(from, to int) {
method PublishRowsInserted (line 201) | func (tmb *TableModelBase) PublishRowsInserted(from, to int) {
method PublishRowsRemoved (line 205) | func (tmb *TableModelBase) PublishRowsRemoved(from, to int) {
type ReflectTableModel (line 211) | type ReflectTableModel interface
type ReflectTableModelBase (line 241) | type ReflectTableModelBase struct
method setValueFunc (line 246) | func (rtmb *ReflectTableModelBase) setValueFunc(value func(row, col in...
method Value (line 250) | func (rtmb *ReflectTableModelBase) Value(row, col int) interface{} {
type interceptedSorter (line 254) | type interceptedSorter interface
type SortedReflectTableModelBase (line 262) | type SortedReflectTableModelBase struct
method setSortFunc (line 268) | func (srtmb *SortedReflectTableModelBase) setSortFunc(sort func(col in...
method sorterBase (line 272) | func (srtmb *SortedReflectTableModelBase) sorterBase() *SorterBase {
method Sort (line 276) | func (srtmb *SortedReflectTableModelBase) Sort(col int, order SortOrde...
type Populator (line 289) | type Populator interface
type ImageProvider (line 299) | type ImageProvider interface
type CellStyler (line 311) | type CellStyler interface
type CellStyle (line 318) | type CellStyle struct
method Row (line 338) | func (cs *CellStyle) Row() int {
method Col (line 342) | func (cs *CellStyle) Col() int {
method Bounds (line 346) | func (cs *CellStyle) Bounds() Rectangle {
method BoundsPixels (line 350) | func (cs *CellStyle) BoundsPixels() Rectangle {
method Canvas (line 354) | func (cs *CellStyle) Canvas() *Canvas {
type IDProvider (line 371) | type IDProvider interface
type ListItemStyler (line 377) | type ListItemStyler interface
type ListItemStyle (line 394) | type ListItemStyle struct
method Index (line 413) | func (lis *ListItemStyle) Index() int {
method Bounds (line 417) | func (lis *ListItemStyle) Bounds() Rectangle {
method BoundsPixels (line 421) | func (lis *ListItemStyle) BoundsPixels() Rectangle {
method Canvas (line 425) | func (lis *ListItemStyle) Canvas() *Canvas {
method DrawBackground (line 439) | func (lis *ListItemStyle) DrawBackground() error {
method DrawText (line 479) | func (lis *ListItemStyle) DrawText(text string, bounds Rectangle, form...
method stateID (line 501) | func (lis *ListItemStyle) stateID() int32 {
type ItemChecker (line 521) | type ItemChecker interface
type SortOrder (line 530) | type SortOrder
constant SortAscending (line 534) | SortAscending SortOrder = iota
constant SortDescending (line 537) | SortDescending
type Sorter (line 542) | type Sorter interface
type SorterBase (line 569) | type SorterBase struct
method ColumnSortable (line 575) | func (sb *SorterBase) ColumnSortable(col int) bool {
method Sort (line 579) | func (sb *SorterBase) Sort(col int, order SortOrder) error {
method SortChanged (line 587) | func (sb *SorterBase) SortChanged() *Event {
method SortedColumn (line 591) | func (sb *SorterBase) SortedColumn() int {
method SortOrder (line 595) | func (sb *SorterBase) SortOrder() SortOrder {
type Imager (line 600) | type Imager interface
type TreeItem (line 611) | type TreeItem interface
type HasChilder (line 627) | type HasChilder interface
type TreeModel (line 632) | type TreeModel interface
type TreeModelBase (line 668) | type TreeModelBase struct
method LazyPopulation (line 675) | func (tmb *TreeModelBase) LazyPopulation() bool {
method ItemsReset (line 679) | func (tmb *TreeModelBase) ItemsReset() *TreeItemEvent {
method ItemChanged (line 683) | func (tmb *TreeModelBase) ItemChanged() *TreeItemEvent {
method ItemInserted (line 687) | func (tmb *TreeModelBase) ItemInserted() *TreeItemEvent {
method ItemRemoved (line 691) | func (tmb *TreeModelBase) ItemRemoved() *TreeItemEvent {
method PublishItemsReset (line 695) | func (tmb *TreeModelBase) PublishItemsReset(parent TreeItem) {
method PublishItemChanged (line 699) | func (tmb *TreeModelBase) PublishItemChanged(item TreeItem) {
method PublishItemInserted (line 703) | func (tmb *TreeModelBase) PublishItemInserted(item TreeItem) {
method PublishItemRemoved (line 707) | func (tmb *TreeModelBase) PublishItemRemoved(item TreeItem) {
FILE: mouseevent.go
type MouseButton (line 13) | type MouseButton
constant LeftButton (line 16) | LeftButton MouseButton = win.MK_LBUTTON
constant RightButton (line 17) | RightButton MouseButton = win.MK_RBUTTON
constant MiddleButton (line 18) | MiddleButton MouseButton = win.MK_MBUTTON
type mouseEventHandlerInfo (line 21) | type mouseEventHandlerInfo struct
type MouseEventHandler (line 27) | type MouseEventHandler
type MouseEvent (line 29) | type MouseEvent struct
method Attach (line 33) | func (e *MouseEvent) Attach(handler MouseEventHandler) int {
method Detach (line 48) | func (e *MouseEvent) Detach(handle int) {
method Once (line 52) | func (e *MouseEvent) Once(handler MouseEventHandler) {
type MouseEventPublisher (line 57) | type MouseEventPublisher struct
method Event (line 61) | func (p *MouseEventPublisher) Event() *MouseEvent {
method Publish (line 66) | func (p *MouseEventPublisher) Publish(x, y int, button MouseButton) {
function MouseWheelEventDelta (line 78) | func MouseWheelEventDelta(button MouseButton) int {
function MouseWheelEventKeyState (line 82) | func MouseWheelEventKeyState(button MouseButton) int {
FILE: notifyicon.go
function notifyIconWndProc (line 18) | func notifyIconWndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr...
type NotifyIcon (line 74) | type NotifyIcon struct
method DPI (line 135) | func (ni *NotifyIcon) DPI() int {
method readdToTaskbar (line 140) | func (ni *NotifyIcon) readdToTaskbar() error {
method applyDPI (line 182) | func (ni *NotifyIcon) applyDPI() {
method notifyIconData (line 200) | func (ni *NotifyIcon) notifyIconData() *win.NOTIFYICONDATA {
method Dispose (line 214) | func (ni *NotifyIcon) Dispose() error {
method showMessage (line 231) | func (ni *NotifyIcon) showMessage(title, info string, iconType uint32,...
method ShowMessage (line 263) | func (ni *NotifyIcon) ShowMessage(title, info string) error {
method ShowInfo (line 270) | func (ni *NotifyIcon) ShowInfo(title, info string) error {
method ShowWarning (line 277) | func (ni *NotifyIcon) ShowWarning(title, info string) error {
method ShowError (line 284) | func (ni *NotifyIcon) ShowError(title, info string) error {
method ShowCustom (line 292) | func (ni *NotifyIcon) ShowCustom(title, info string, icon Image) error {
method ContextMenu (line 297) | func (ni *NotifyIcon) ContextMenu() *Menu {
method Icon (line 302) | func (ni *NotifyIcon) Icon() Image {
method SetIcon (line 307) | func (ni *NotifyIcon) SetIcon(icon Image) error {
method setNIDIcon (line 331) | func (ni *NotifyIcon) setNIDIcon(nid *win.NOTIFYICONDATA, icon Image) ...
method ToolTip (line 343) | func (ni *NotifyIcon) ToolTip() string {
method SetToolTip (line 348) | func (ni *NotifyIcon) SetToolTip(toolTip string) error {
method Visible (line 367) | func (ni *NotifyIcon) Visible() bool {
method SetVisible (line 372) | func (ni *NotifyIcon) SetVisible(visible bool) error {
method publishMouseEvent (line 393) | func (ni *NotifyIcon) publishMouseEvent(publisher *MouseEventPublisher...
method MouseDown (line 404) | func (ni *NotifyIcon) MouseDown() *MouseEvent {
method MouseUp (line 410) | func (ni *NotifyIcon) MouseUp() *MouseEvent {
method MessageClicked (line 416) | func (ni *NotifyIcon) MessageClicked() *Event {
function NewNotifyIcon (line 90) | func NewNotifyIcon(form Form) (*NotifyIcon, error) {
FILE: numberedit.go
constant numberEditWindowClass (line 21) | numberEditWindowClass = `\o/ Walk_NumberEdit_Class \o/`
function init (line 23) | func init() {
type NumberEdit (line 30) | type NumberEdit struct
method applyEnabled (line 135) | func (ne *NumberEdit) applyEnabled(enabled bool) {
method applyFont (line 145) | func (ne *NumberEdit) applyFont(font *Font) {
method Decimals (line 156) | func (ne *NumberEdit) Decimals() int {
method SetDecimals (line 161) | func (ne *NumberEdit) SetDecimals(decimals int) error {
method Prefix (line 172) | func (ne *NumberEdit) Prefix() string {
method SetPrefix (line 177) | func (ne *NumberEdit) SetPrefix(prefix string) error {
method PrefixChanged (line 201) | func (ne *NumberEdit) PrefixChanged() *Event {
method Suffix (line 206) | func (ne *NumberEdit) Suffix() string {
method SetSuffix (line 211) | func (ne *NumberEdit) SetSuffix(suffix string) error {
method SuffixChanged (line 235) | func (ne *NumberEdit) SuffixChanged() *Event {
method Increment (line 242) | func (ne *NumberEdit) Increment() float64 {
method SetIncrement (line 249) | func (ne *NumberEdit) SetIncrement(increment float64) error {
method MinValue (line 256) | func (ne *NumberEdit) MinValue() float64 {
method MaxValue (line 261) | func (ne *NumberEdit) MaxValue() float64 {
method SetRange (line 268) | func (ne *NumberEdit) SetRange(min, max float64) error {
method Value (line 301) | func (ne *NumberEdit) Value() float64 {
method SetValue (line 306) | func (ne *NumberEdit) SetValue(value float64) error {
method ValueChanged (line 317) | func (ne *NumberEdit) ValueChanged() *Event {
method SetFocus (line 322) | func (ne *NumberEdit) SetFocus() error {
method TextSelection (line 332) | func (ne *NumberEdit) TextSelection() (start, end int) {
method SetTextSelection (line 338) | func (ne *NumberEdit) SetTextSelection(start, end int) {
method ReadOnly (line 343) | func (ne *NumberEdit) ReadOnly() bool {
method SetReadOnly (line 348) | func (ne *NumberEdit) SetReadOnly(readOnly bool) error {
method SpinButtonsVisible (line 357) | func (ne *NumberEdit) SpinButtonsVisible() bool {
method SetSpinButtonsVisible (line 362) | func (ne *NumberEdit) SetSpinButtonsVisible(visible bool) error {
method Background (line 400) | func (ne *NumberEdit) Background() Brush {
method SetBackground (line 405) | func (ne *NumberEdit) SetBackground(bg Brush) {
method TextColor (line 410) | func (ne *NumberEdit) TextColor() Color {
method SetTextColor (line 415) | func (ne *NumberEdit) SetTextColor(c Color) {
method NeedsWmSize (line 419) | func (*NumberEdit) NeedsWmSize() bool {
method WndProc (line 427) | func (ne *NumberEdit) WndProc(hwnd win.HWND, msg uint32, wParam, lPara...
method CreateLayoutItem (line 465) | func (ne *NumberEdit) CreateLayoutItem(ctx *LayoutContext) LayoutItem {
method SetToolTipText (line 978) | func (ne *NumberEdit) SetToolTipText(s string) error {
function NewNumberEdit (line 41) | func NewNumberEdit(parent Container) (*NumberEdit, error) {
type numberEditLayoutItem (line 472) | type numberEditLayoutItem struct
method LayoutFlags (line 478) | func (*numberEditLayoutItem) LayoutFlags() LayoutFlags {
method IdealSize (line 482) | func (li *numberEditLayoutItem) Ide
Condensed preview — 254 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,273K chars).
[
{
"path": "AUTHORS",
"chars": 1289,
"preview": "# This is the official list of 'Walk' authors for copyright purposes.\n\n# Names should be added to this file as\n# Name "
},
{
"path": "LICENSE",
"chars": 1400,
"preview": "Copyright (c) 2010 The Walk Authors. All rights reserved.\n\nRedistribution and use in source and binary forms, with or wi"
},
{
"path": "README.mdown",
"chars": 3775,
"preview": "About Walk\n==========\n\nWalk is a \"Windows Application Library Kit\" for the Go Programming Language.\n\nIts primarily usefu"
},
{
"path": "accessibility.go",
"chars": 10590,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "action.go",
"chars": 8730,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "actionlist.go",
"chars": 3462,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "application.go",
"chars": 2657,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "bitmap.go",
"chars": 18279,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "boxlayout.go",
"chars": 13652,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "brush.go",
"chars": 12950,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "button.go",
"chars": 4570,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "cancelevent.go",
"chars": 1207,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "canvas.go",
"chars": 22673,
"preview": "// Copyright 2010 The Walk Authorc. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "checkbox.go",
"chars": 2934,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "clipboard.go",
"chars": 3545,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "closeevent.go",
"chars": 1239,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "color.go",
"chars": 474,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "combobox.go",
"chars": 17851,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "commondialogs.go",
"chars": 4786,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "composite.go",
"chars": 894,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "condition.go",
"chars": 3051,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "container.go",
"chars": 11381,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "cursor.go",
"chars": 2610,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "customwidget.go",
"chars": 5751,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "databinding.go",
"chars": 12538,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "dateedit.go",
"chars": 5767,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "datelabel.go",
"chars": 2167,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/accessibility.go",
"chars": 6560,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/action.go",
"chars": 4807,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/brush.go",
"chars": 1763,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/builder.go",
"chars": 17344,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/checkbox.go",
"chars": 2352,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/combobox.go",
"chars": 2862,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/composite.go",
"chars": 2124,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/customwidget.go",
"chars": 2421,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/databinder.go",
"chars": 1350,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/dateedit.go",
"chars": 2089,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/datelabel.go",
"chars": 1737,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/dialog.go",
"chars": 3952,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/font.go",
"chars": 715,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/gradientcomposite.go",
"chars": 2239,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/groupbox.go",
"chars": 1811,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/imageview.go",
"chars": 2011,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/interfaces.go",
"chars": 2871,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/label.go",
"chars": 2105,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/layouts.go",
"chars": 3447,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/lineedit.go",
"chars": 2549,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/linklabel.go",
"chars": 1657,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/listbox.go",
"chars": 3030,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/mainwindow.go",
"chars": 4934,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/nonwin.go",
"chars": 201,
"preview": "// Copyright 2010 The win Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license"
},
{
"path": "declarative/numberedit.go",
"chars": 2354,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/numberlabel.go",
"chars": 1771,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/progressbar.go",
"chars": 1751,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/pushbutton.go",
"chars": 1756,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/radiobutton.go",
"chars": 1793,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/radiobuttongroup.go",
"chars": 1897,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/radiobuttongroupbox.go",
"chars": 2109,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/scrollview.go",
"chars": 1777,
"preview": "// Copyright 2014 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/separator.go",
"chars": 2552,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/slider.go",
"chars": 2145,
"preview": "// Copyright 2016 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/spacer.go",
"chars": 1653,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/splitbutton.go",
"chars": 1844,
"preview": "// Copyright 2016 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/splitter.go",
"chars": 3193,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/tableview.go",
"chars": 4756,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/tableviewcolumn.go",
"chars": 1519,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/tabpage.go",
"chars": 1695,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/tabwidget.go",
"chars": 2140,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/textedit.go",
"chars": 2164,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/textlabel.go",
"chars": 2511,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/toolbar.go",
"chars": 2345,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/toolbutton.go",
"chars": 1645,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/treeview.go",
"chars": 2165,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/validators.go",
"chars": 1399,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "declarative/webview.go",
"chars": 4970,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "dialog.go",
"chars": 5130,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "dropfilesevent.go",
"chars": 1830,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "error.go",
"chars": 2428,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "errorevent.go",
"chars": 1176,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "event.go",
"chars": 1588,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/actions/actions.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/actions/actions.go",
"chars": 4819,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/clipboard/clipboard.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/clipboard/clipboard.go",
"chars": 905,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/databinding/databinding.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/databinding/databinding.go",
"chars": 4983,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/drawing/drawing.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/drawing/drawing.go",
"chars": 3532,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/dropfiles/dropfiles.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/dropfiles/dropfiles.go",
"chars": 652,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/externalwidgets/externalwidgets.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/externalwidgets/externalwidgets.go",
"chars": 2519,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/filebrowser/filebrowser.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/filebrowser/filebrowser.go",
"chars": 5973,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/gradientcomposite/gradientcomposite.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/gradientcomposite/gradientcomposite.go",
"chars": 2508,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/imageicon/imageicon.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/imageicon/main.go",
"chars": 1781,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/imageview/imageview.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/imageview/imageview.go",
"chars": 1097,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/imageviewer/imageviewer.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/imageviewer/imageviewer.go",
"chars": 2891,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/img/README",
"chars": 176,
"preview": "Most image files in this directory are from the base icon theme of the\nTango Desktop Project at http://tango.freedesktop"
},
{
"path": "examples/linklabel/linklabel.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/linklabel/linklabel.go",
"chars": 799,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/listbox/listbox.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/listbox/listbox.go",
"chars": 1965,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/listbox_ownerdrawing/listbox_ownerdrawing.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/listbox_ownerdrawing/listbox_ownerdrawing.go",
"chars": 6120,
"preview": "// Copyright 2019 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/logview/logview.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/logview/logview.go",
"chars": 2234,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/logview/logviewapp.go",
"chars": 780,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/multiplepages/main.go",
"chars": 2946,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/multiplepages/multipagemainwindow.go",
"chars": 5821,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/multiplepages/multiplepages.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/notifyicon/notifyicon.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/notifyicon/notifyicon.go",
"chars": 1961,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/progressindicator/dialog.ui",
"chars": 3500,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>Dialog</class>\n <widget class=\"QDialog\" name=\"Dialog\">"
},
{
"path": "examples/progressindicator/dialog_ui.go",
"chars": 3035,
"preview": "// THIS FILE WAS GENERATED BY A TOOL, DO NOT EDIT!\n\npackage main\n\nimport (\n\t\"github.com/lxn/walk\"\n)\n\ntype myDialogUI str"
},
{
"path": "examples/progressindicator/pi.go",
"chars": 1592,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/progressindicator/progressindicator.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/radiobutton/radiobutton.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/radiobutton/radiobutton.go",
"chars": 1718,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/settings/settings.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/settings/settings.go",
"chars": 2287,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/slider/slider.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/slider/slider.go",
"chars": 2296,
"preview": "// Copyright 2016 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/statusbar/statusbar.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/statusbar/statusbar.go",
"chars": 1417,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/tableview/tableview.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/tableview/tableview.go",
"chars": 5095,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/webview/webview.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/webview/webview.go",
"chars": 1055,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "examples/webview_events/webview_events.exe.manifest",
"chars": 811,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVers"
},
{
"path": "examples/webview_events/webview_events.go",
"chars": 6835,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "expression.go",
"chars": 944,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "flowlayout.go",
"chars": 6949,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "font.go",
"chars": 4754,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "fontresource.go",
"chars": 2311,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "form.go",
"chars": 20752,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "gradientcomposite.go",
"chars": 4804,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "graphicseffects.go",
"chars": 7778,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "gridlayout.go",
"chars": 19757,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "groupbox.go",
"chars": 9306,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "icon.go",
"chars": 11431,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "iconcache.go",
"chars": 1708,
"preview": "// Copyright 2019 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "image.go",
"chars": 4222,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "imagelist.go",
"chars": 6377,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "imageview.go",
"chars": 5694,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "inifilesettings.go",
"chars": 5074,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "intevent.go",
"chars": 1134,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "intrangeevent.go",
"chars": 1235,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "keyboard.go",
"chars": 14098,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "keyevent.go",
"chars": 1140,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "l10n/update.bat",
"chars": 52,
"preview": "polyglot -name=\"walk\" -dir=\"..\" -locales=\"de,fr,ko\"\n"
},
{
"path": "l10n/walk-de.tr",
"chars": 1404,
"preview": "{\"Messages\":[{\"Locations\":[{\"File\":\"../validators.go\",\"Line\":\"148\"}],\"Source\":\"Please select one of the provided options"
},
{
"path": "l10n/walk-ko.tr",
"chars": 1235,
"preview": "{\"Messages\":[{\"Locations\":[{\"File\":\"../validators.go\",\"Line\":\"87\"}],\"Source\":\"Number out of allowed range\",\"Context\":[\"w"
},
{
"path": "label.go",
"chars": 1995,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "layout.go",
"chars": 18600,
"preview": "// Copyright 2019 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "lineedit.go",
"chars": 8028,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "linklabel.go",
"chars": 4957,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "listbox.go",
"chars": 21656,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of lb source code is governed by a BSD-style\n// license "
},
{
"path": "mainloop_cgo.go",
"chars": 1493,
"preview": "// Copyright 2019 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "mainloop_default.go",
"chars": 803,
"preview": "// Copyright 2019 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "mainwindow.go",
"chars": 5270,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "maptablemodel.go",
"chars": 1557,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "menu.go",
"chars": 6095,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "messagebox.go",
"chars": 2431,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "metafile.go",
"chars": 2720,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "models.go",
"chars": 20477,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "mouseevent.go",
"chars": 1762,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "notifyicon.go",
"chars": 10146,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "numberedit.go",
"chars": 21824,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "numberlabel.go",
"chars": 2972,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "path.go",
"chars": 1413,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "pen.go",
"chars": 4100,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "point.go",
"chars": 514,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "progressbar.go",
"chars": 1934,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "progressindicator.go",
"chars": 2924,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "property.go",
"chars": 7117,
"preview": "// Copyright 2012 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "pushbutton.go",
"chars": 2527,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "radiobutton.go",
"chars": 2707,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "rectangle.go",
"chars": 1379,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "reflectmodels.go",
"chars": 8910,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "registry.go",
"chars": 2024,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "resourcemanager.go",
"chars": 3572,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "scrollview.go",
"chars": 10616,
"preview": "// Copyright 2014 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "separator.go",
"chars": 1345,
"preview": "// Copyright 2017 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "simpletypes.go",
"chars": 523,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "size.go",
"chars": 1274,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "slider.go",
"chars": 4286,
"preview": "// Copyright 2016 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "spacer.go",
"chars": 2297,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "splitbutton.go",
"chars": 1917,
"preview": "// Copyright 2016 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "splitter.go",
"chars": 13725,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "splitterhandle.go",
"chars": 2381,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "splitterlayout.go",
"chars": 12703,
"preview": "// Copyright 2010 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "static.go",
"chars": 7298,
"preview": "// Copyright 2018 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "statusbar.go",
"chars": 8383,
"preview": "// Copyright 2013 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "stopwatch.go",
"chars": 2568,
"preview": "// Copyright 2019 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
},
{
"path": "stringevent.go",
"chars": 1188,
"preview": "// Copyright 2011 The Walk Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// licens"
}
]
// ... and 54 more files (download for full content)
About this extraction
This page contains the full source code of the lxn/walk GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 254 files (1.1 MB), approximately 323.6k tokens, and a symbol index with 3793 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.