Documentation
¶
Overview ¶
Package windows implements the MyGo backend for Windows: Win32 windows hosting WebView2, called through the syscall package (no cgo).
Index ¶
- func TestAccessibilityPerform(hwnd uintptr, label, action, value string) bool
- func TestActivateAccelerator(hwnd uintptr, acc string) bool
- func TestActivateMenuItem(hwnd uintptr, path ...string) error
- func TestCaptionButtons(hwnd uintptr) []string
- func TestCaptionColor(hwnd uintptr, name string) (r, g, b uint8, ok bool)
- func TestChoosePopupItem(label string) bool
- func TestClickSurface(hwnd uintptr, x, y float64) bool
- func TestComposeOver(hwnd uintptr, text string, caret int, commit bool, from, length int) bool
- func TestComposed(hwnd uintptr) (noRedirect, composed bool)
- func TestDocumentFeed(hwnd uintptr) (text string, start, length int, ok bool)
- func TestDragFiles(hwnd uintptr, x, y float64, paths []string) (dropped bool)
- func TestDragSurface(hwnd uintptr, points [][2]float64) bool
- func TestDropData(hwnd uintptr, x, y float64, d transfer.Data, ops transfer.Operation) (operation transfer.Operation, dropped bool)
- func TestDropFiles(hwnd uintptr, x, y float64, paths []string) (over, dropped bool)
- func TestEndMenu()
- func TestEnterMenuBar(hwnd uintptr) bool
- func TestFailWebViews(n int)
- func TestForeground(hwnd uintptr) bool
- func TestInputClick(hwnd uintptr, x, y float64) bool
- func TestLoseComposition(removed bool) bool
- func TestMenuBarShown(hwnd uintptr) bool
- func TestPopups() [][]string
- func TestPressCaptionButton(hwnd uintptr, name string) bool
- func TestPressKeys(keys ...byte)
- func TestRightClickSurface(hwnd uintptr, x, y float64) bool
- func TestSetDroppedFiles(hwnd uintptr, paths []string)
- func TestSideButton(hwnd uintptr, back bool) bool
- func TestSurfacePixel(hwnd uintptr, x, y float64) (r, g, b uint8, ok bool)
- func TestTopNonClient(hwnd uintptr) (px, want int32)
- type Backend
- func (b *Backend) App() platform.AppController
- func (b *Backend) Clipboard() platform.Clipboard
- func (b *Backend) Dialogs() platform.Dialogs
- func (b *Backend) Init(h platform.AppHandler, opts platform.AppOptions) error
- func (b *Backend) IsMainThread() bool
- func (b *Backend) Name() string
- func (b *Backend) NewTray(h platform.TrayHandler) (platform.Tray, error)
- func (b *Backend) NewWindow(o *platform.WindowOptions, h platform.WindowHandler) (platform.Window, error)
- func (b *Backend) NotificationsSupported() bool
- func (b *Backend) PopupMenu(m *platform.Menu, pw platform.Window, pos *platform.Point)
- func (b *Backend) Power() platform.Power
- func (b *Backend) Quit()
- func (b *Backend) RegisterHotkey(id int, acc string) error
- func (b *Backend) RemoveAllNotifications()
- func (b *Backend) RemoveNotification(id string)
- func (b *Backend) Run() error
- func (b *Backend) Screen() platform.Screen
- func (b *Backend) SetApplicationMenu(m *platform.Menu)
- func (b *Backend) Shell() platform.Shell
- func (b *Backend) ShowNotification(n *platform.Notification, done func(error))
- func (b *Backend) Signal()
- func (b *Backend) Step()
- func (b *Backend) Theme() platform.Theme
- func (b *Backend) UnregisterHotkey(id int)
- func (b *Backend) UpdateMenuItem(it *platform.MenuItem)
- func (b *Backend) Wake()
- type GUID
- type TestAccessNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestAccessibilityPerform ¶ added in v0.2.0
TestAccessibilityPerform acts on the element labeled label as UI Automation's clients do: "press", "increment", "decrement", "focus", or "value" to set its text to value. It reports whether the element can.
func TestActivateAccelerator ¶ added in v0.1.10
TestActivateAccelerator runs the menu item of a window's shortcut, as its keys do in the page, and reports whether there is one.
func TestActivateMenuItem ¶
TestActivateMenuItem activates an item of a window's menu bar, found by the labels along its path, e.g. TestActivateMenuItem(hwnd, "File", "New").
func TestCaptionButtons ¶ added in v0.1.11
TestCaptionButtons returns the window controls of a window with a hidden title bar, left to right, named after what WM_NCHITTEST answers over their middles, which Windows' snap layouts rely on.
func TestCaptionColor ¶ added in v0.2.8
TestCaptionColor puts the pointer over a window control of a hidden title bar, "minimize", "maximize" or "close", as far as the control knows, and returns the color on the screen beside its glyph once Windows has composed it: what the user sees, through UpdateLayeredWindow or DirectComposition. The pointer leaves after.
func TestChoosePopupItem ¶ added in v0.2.0
TestChoosePopupItem chooses the item labeled label of a popup menu the main thread shows, with the keys a keyboard presses in it, and reports whether there is one.
func TestClickSurface ¶ added in v0.2.0
TestClickSurface clicks (x, y), in DIPs, in a window showing native UI, with the messages a mouse sends. It reports false for a window showing a web page.
func TestComposeOver ¶ added in v0.2.0
TestComposeOver does what an input method that converts typed text again does: unless from is -1, it settles the reconversion of length runes from rune from of the text around the caret; then it composes text with the caret at caret, or commits it.
func TestComposed ¶ added in v0.2.8
TestComposed reports whether a window has no redirection bitmap, for the material behind its page, and whether the controls of its hidden title bar show through the DirectComposition device in use.
func TestDocumentFeed ¶ added in v0.2.0
TestDocumentFeed returns the text around the caret that input methods get from a window showing native UI with IMR_DOCUMENTFEED, and the selection in it, in runes.
func TestDragFiles ¶ added in v0.4.0
TestDragFiles drags files from another application to (x, y), in DIPs, of a window showing native UI and drops them there, as OLE does: through the window's drop target, with the production IDataObject, asking the target again while the window runs until it takes them, as the page of a web view answers later, for a few seconds. It reports whether the drop took them.
func TestDragSurface ¶ added in v0.2.5
TestDragSurface presses the primary button at the first of points, in DIPs, in a window showing native UI, moves the pointer through the others, and releases it at the last, with the messages a mouse sends.
func TestDropData ¶ added in v0.2.17
func TestDropData(hwnd uintptr, x, y float64, d transfer.Data, ops transfer.Operation) (operation transfer.Operation, dropped bool)
TestDropData uses the production IDataObject and OLE destination with no process-local token, exercising serialized data and delayed rendering.
func TestDropFiles ¶ added in v0.2.0
TestDropFiles drags files from Explorer to (x, y), in DIPs, of a window showing native UI and drops them there, through its drop target, and reports whether the content took them over there and when dropped.
func TestEndMenu ¶ added in v0.1.10
func TestEndMenu()
TestEndMenu leaves the menus, as Escape does.
func TestEnterMenuBar ¶ added in v0.1.10
TestEnterMenuBar takes the keyboard to a window's menu bar, as Alt and F10 do, and returns once it leaves the menus. It reports false when the window cannot come to the front, which the keyboard needs.
func TestFailWebViews ¶ added in v0.2.15
func TestFailWebViews(n int)
TestFailWebViews makes the next n creations of webviews fail, as WebView2 reports a failure, when it would have created them; 0 lets them be.
func TestForeground ¶ added in v0.2.3
TestForeground brings a window to the front, where the keyboard types, and reports whether it came.
func TestInputClick ¶ added in v0.4.1
TestInputClick clicks a point of a window showing native UI with the system's input, as a mouse does: the window it lands on activates as for the user.
func TestLoseComposition ¶ added in v0.2.8
TestLoseComposition takes the DirectComposition device away, as a draw that finds it invalid does, or, with removed, signals that its GPU device was removed. It reports false without a device, or, with removed, without the event (Windows 10 before 1607).
func TestMenuBarShown ¶ added in v0.1.10
TestMenuBarShown reports whether a window shows its menu bar.
func TestPopups ¶ added in v0.2.0
func TestPopups() [][]string
TestPopups returns the labels of the items of the popup menus the main thread shows, "-" for separators.
func TestPressCaptionButton ¶ added in v0.1.11
TestPressCaptionButton clicks a window control of a window with a hidden title bar: "minimize", "maximize" or "close".
func TestPressKeys ¶
func TestPressKeys(keys ...byte)
TestPressKeys presses virtual keys together and releases them, like a keyboard would.
func TestRightClickSurface ¶ added in v0.2.0
TestRightClickSurface clicks (x, y), in DIPs, in a window showing native UI with the secondary button, as TestClickSurface does with the primary.
func TestSetDroppedFiles ¶
TestSetDroppedFiles makes paths the files of the next drop on a window's page, as if they had been dragged there.
func TestSideButton ¶ added in v0.2.5
TestSideButton clicks a mouse's back or forward button (XBUTTON1 and XBUTTON2) in a window showing native UI, with the messages a mouse sends.
func TestSurfacePixel ¶ added in v0.3.4
TestSurfacePixel returns the color the screen shows at (x, y), in DIPs, in a window showing native UI, once what was drawn shows: there, in a window without a redirection bitmap, the frames over the material.
func TestTopNonClient ¶ added in v0.1.12
TestTopNonClient returns how many pixels at the top of a window are not its client area, and how many a hidden title bar keeps there on this version of Windows: one on Windows 11, none on Windows 10.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the Windows (Win32 + WebView2) implementation of platform.Backend.
func (*Backend) App ¶
func (b *Backend) App() platform.AppController
func (*Backend) Init ¶
func (b *Backend) Init(h platform.AppHandler, opts platform.AppOptions) error
func (*Backend) IsMainThread ¶
func (*Backend) NewWindow ¶
func (b *Backend) NewWindow(o *platform.WindowOptions, h platform.WindowHandler) (platform.Window, error)
func (*Backend) NotificationsSupported ¶
func (*Backend) Quit ¶
func (b *Backend) Quit()
Quit ends the event loop. Modal loops (dialogs, menus) end too: they forward WM_QUIT to the loop they run in.
func (*Backend) RemoveAllNotifications ¶ added in v0.2.15
func (b *Backend) RemoveAllNotifications()
func (*Backend) RemoveNotification ¶
func (*Backend) SetApplicationMenu ¶
func (*Backend) ShowNotification ¶
func (b *Backend) ShowNotification(n *platform.Notification, done func(error))
func (*Backend) UnregisterHotkey ¶
func (*Backend) UpdateMenuItem ¶
type TestAccessNode ¶ added in v0.2.0
type TestAccessNode struct {
Role, Label, Value string
// contains filtered or unexported fields
}
TestAccessNode is an element of native UI as UI Automation reads it: the name of its control type, its name, and its value.
func TestAccessibility ¶ added in v0.2.0
func TestAccessibility(hwnd uintptr) ([]TestAccessNode, bool)
TestAccessibility reads the elements of a window showing native UI as UI Automation's clients do, in order, and reports false when it cannot.
Source Files
¶
- abi_amd64.go
- app.go
- clipboard.go
- com.go
- compositor.go
- deeplink.go
- dialog.go
- flyout.go
- login.go
- menu.go
- power.go
- registry.go
- surface.go
- surface_access.go
- surface_drag.go
- surface_drop.go
- surface_input.go
- system.go
- taskbar.go
- testhooks.go
- testhooks_surface.go
- titlebar.go
- tray.go
- webview.go
- webview2.go
- webview_embed.go
- win32.go
- window.go