Documentation
¶
Overview ¶
Package windows is NSGo's Win32 backend: one window that draws a retained tree of views with Direct2D into a flip-model swap chain on a Direct3D 11 device, text the engine laid out with DirectWrite, presses hit tested by the engine, inputs as editors of the backend's own drawn with the views (input.go), web views as WebView2 composition controllers in the window's DirectComposition tree, videos played by Media Foundation's media engine, images decoded by Go, native components' child windows following their views (component.go), files dropped through OLE (drop.go), alerts as task dialogs and updates through WinSparkle (updates.go). A window with a material behind its content draws through DirectComposition too, over the system backdrop DWM draws (material.go). It uses only the syscall package, so it builds without cgo.
Transforms are Direct2D world transforms, translucent views draw in layers, and shapes and text are antialiased by Direct2D. Style transitions, animated values, layout animations and animated images tick on one frame clock, a timer that runs only while something animates (animate.go). Image blur and modal animations are not drawn, and there is no accessibility yet, which needs UI Automation providers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
Title string
Width, Height driver.Points
// Hidden keeps the backend's root window off the screen as the app's
// own surface (nsgo.Run(App)), which opens the windows the app shows
// and shows only as an alert's window.
Hidden bool
// Frame is where the window opens (nsgo.WindowFrame).
Frame driver.WindowFrame
// ID names the app's directories and storage (engine.AppDirs).
ID string
// InstanceKey scopes the single-instance lock; empty keeps one lock per ID.
InstanceKey string
// Components are the native components Native elements name.
Components driver.NativeComponents
// Material is the material behind the window's content, where the app
// draws nothing opaque (nsgo.WindowMaterial). It needs Windows 11
// 22H2 or later, where DWM draws system backdrops; earlier Windows
// keeps the window opaque.
Material driver.WindowMaterial
// Constraints limit the window (nsgo.WindowConstraints).
Constraints driver.WindowConstraints
// Transparent opens the window without a background or frame, NoShadow without DWM's shadow, which only a transparent window lacks, and SkipTaskbar off the taskbar (look.go).
Transparent, NoShadow, SkipTaskbar bool
// Fonts are font files under the app's resources, registered before
// the first view.
Fonts []string
// Appearance is the appearance the app starts in.
Appearance driver.Appearance
// Perf shows the performance monitor over the app (perf.go).
Perf bool
// Updates is how the app updates, with WinSparkle (updates.go).
Updates updates.Config
// RegisterToast is the shortcut the installer has the app stamp with the toast activator, and UnregisterToast has the uninstaller's run remove the activator's registration, from the launch flags; either run does that alone and returns (toast_activation.go).
RegisterToast string
UnregisterToast bool
// DockTask is the label of the item the Jump List task that started the app chose, from the launch flags.
DockTask string
// LaunchedAtLogin says the login item started this process.
LaunchedAtLogin bool
// Host is what an embedding host gives the view (NewView), and Parent
// the HWND of the window it is a child window of.
Host engine.HostOptions
Parent uintptr
// contains filtered or unexported fields
}
Options configure the window.
type View ¶
type View struct {
// contains filtered or unexported fields
}
View is an app in a child window of an embedding host's window, which the host's own message loop runs (NewView).
func NewView ¶
NewView makes a child window of opts.Parent showing app, for a host that runs the message loop itself on this thread, with COM initialized (OleInitialize, for the clipboard and drops). The host places it (MoveWindow); its engine starts once it first has a size, so settings made before that are in the app's first frame. Several views may show at once.
func (*View) Close ¶
func (v *View) Close()
Close stops the app, destroys its native components and the child window.
func (*View) SetHostEnvironment ¶
func (v *View) SetHostEnvironment(env engine.HostEnvironment)
SetHostEnvironment sets what the host sets over the system's environment: its locale, text size and appearance, which the fields NSGo draws take too.
Source Files
¶
- alert.go
- animate.go
- authsession.go
- awake.go
- backdrop.go
- canvas.go
- canvascache.go
- chrome.go
- com.go
- com_amd64.go
- component.go
- compose.go
- d2d.go
- damage.go
- decor.go
- drop.go
- drop_64.go
- edge.go
- effect.go
- env.go
- focus.go
- fonts.go
- frontmost.go
- gesture.go
- gfx.go
- glass.go
- hotkey.go
- http.go
- image.go
- input.go
- inputsource.go
- instance.go
- jumplist.go
- login.go
- look.go
- material.go
- menu_speech.go
- notifications.go
- outline.go
- outline_x86.go
- paint.go
- paste.go
- perf.go
- permissions.go
- pointer.go
- pointer_transform.go
- press.go
- scroll.go
- secrets.go
- selection.go
- services.go
- shader.go
- speak.go
- system.go
- text.go
- textedit.go
- toast_activation.go
- touch_geometry.go
- touchscroll.go
- tray.go
- uia.go
- uia_thunk.go
- uia_vtbl.go
- updates.go
- video.go
- web.go
- webcookie.go
- webhistory.go
- webview2.go
- webview2options.go
- windowpointer.go
- windows.go