gui/stubs/wails/pkg/application/window.go
Claude d9fa59ab04
Some checks failed
Security Scan / security (push) Failing after 24s
feat(stubs): rebuild Wails v3 stub bridge from clean dev — 15 files, 479 exports
Rebuilt from scratch on current dev (post-fleet AX passes).

Stub files:
- application.go (expanded App with 12 managers, WebviewWindow satisfies Window)
- application_options.go (Options, Mac/Win/Linux/iOS/Android, Server, TLS, Assets)
- browser_manager.go, browser_window.go (~47 no-op methods)
- clipboard.go, context_menu.go, dialog.go (full dialog builder API)
- environment.go, events.go (EventManager with On/Off/Emit/Reset)
- keybinding.go, menuitem.go (42 Role constants)
- screen.go (Rect/Point/Size geometry), services.go (generic Service[T])
- webview_window_options.go (full platform types)
- window.go (Window interface ~50 methods)

Wails v3 submodule at internal/wails3/ pinned to alpha 74.
All 16 gui packages build and test clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 17:20:22 +01:00

160 lines
3.3 KiB
Go

package application
import (
"unsafe"
"github.com/wailsapp/wails/v3/pkg/events"
)
// Window is the interface satisfied by all window types in the application.
// Fluent mutating methods return Window so callers can chain calls:
//
// app.Window.NewWithOptions(opts).SetTitle("Main").Show()
type Window interface {
// Identity
ID() uint
Name() string
// Visibility
Show() Window
Hide() Window
IsVisible() bool
// Lifecycle
Close()
Focus()
Run()
// Geometry
Center()
Position() (x int, y int)
RelativePosition() (x int, y int)
Size() (width int, height int)
Width() int
Height() int
Bounds() Rect
SetPosition(x, y int)
SetRelativePosition(x, y int) Window
SetSize(width, height int) Window
SetBounds(bounds Rect)
SetMaxSize(maxWidth, maxHeight int) Window
SetMinSize(minWidth, minHeight int) Window
EnableSizeConstraints()
DisableSizeConstraints()
Resizable() bool
SetResizable(b bool) Window
// State
Maximise() Window
UnMaximise()
ToggleMaximise()
IsMaximised() bool
Minimise() Window
UnMinimise()
IsMinimised() bool
Fullscreen() Window
UnFullscreen()
ToggleFullscreen()
IsFullscreen() bool
Restore()
SnapAssist()
// Title and content
SetTitle(title string) Window
SetURL(s string) Window
SetHTML(html string) Window
// Titlebar buttons (macOS / Windows)
SetMinimiseButtonState(state ButtonState) Window
SetMaximiseButtonState(state ButtonState) Window
SetCloseButtonState(state ButtonState) Window
// Menu bar
SetMenu(menu *Menu)
ShowMenuBar()
HideMenuBar()
ToggleMenuBar()
// Appearance
SetBackgroundColour(colour RGBA) Window
SetAlwaysOnTop(b bool) Window
SetFrameless(frameless bool) Window
ToggleFrameless()
SetIgnoreMouseEvents(ignore bool) Window
IsIgnoreMouseEvents() bool
SetContentProtection(protection bool) Window
// Zoom
GetZoom() float64
SetZoom(magnification float64) Window
Zoom()
ZoomIn()
ZoomOut()
ZoomReset() Window
// Border sizes (Windows)
GetBorderSizes() *LRTB
// Screen
GetScreen() (*Screen, error)
// JavaScript / events
ExecJS(js string)
EmitEvent(name string, data ...any) bool
DispatchWailsEvent(event *CustomEvent)
OnWindowEvent(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
RegisterHook(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
// Drag-and-drop (internal message bus)
handleDragAndDropMessage(filenames []string, dropTarget *DropTargetDetails)
InitiateFrontendDropProcessing(filenames []string, x int, y int)
// Message handling (internal)
HandleMessage(message string)
HandleWindowEvent(id uint)
HandleKeyEvent(acceleratorString string)
// Context menu
OpenContextMenu(data *ContextMenuData)
// Modal
AttachModal(modalWindow Window)
// DevTools
OpenDevTools()
// Print
Print() error
// Flash (Windows taskbar flash)
Flash(enabled bool)
// Focus tracking
IsFocused() bool
// Native handle (platform-specific, use with care)
NativeWindow() unsafe.Pointer
// Enabled state
SetEnabled(enabled bool)
// Reload
Reload()
ForceReload()
// Logging (routed to the application logger)
Info(message string, args ...any)
Error(message string, args ...any)
// Internal hooks
shouldUnconditionallyClose() bool
// Editing operations (routed to focused element)
cut()
copy()
paste()
undo()
redo()
delete()
selectAll()
}