Stubs (15 files, 479 exports): - All managers: Dialog, Event, Browser, Clipboard, ContextMenu, Environment, Screen, KeyBinding - Window interface (~50 methods), BrowserWindow, platform options (iOS/Android) - MenuItem (42 roles), WebviewWindowOptions (full platform types) - Wails v3 submodule pinned at alpha 74 New events package (17th package): - Custom event system bridged to Core IPC - TaskEmit, TaskOn, TaskOff, QueryListeners, ActionEventFired Feature expansions: - Window: zoom, content (SetURL/SetHTML/ExecJS), bounds, print, flash - Screen: QueryCurrent, ScreenPlacement, Rect geometry - Dialog: typed tasks, file options, Info/Question/Warning/Error - Keybinding: TaskProcess, ErrorNotRegistered - Notification: RevokePermission, RegisterCategory, action broadcasts - Dock: SetProgressBar, Bounce/StopBounce - Environment: HasFocusFollowsMouse - ContextMenu: QueryGetAll, TaskUpdate, TaskDestroy Display bridge: 5 new event types wired to WebSocket MCP: 4 event tools (emit, on, off, list) 17 packages build and test clean (1 flaky test ordering issue in window). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
98 lines
2 KiB
Go
98 lines
2 KiB
Go
// pkg/window/platform.go
|
|
package window
|
|
|
|
// Platform abstracts the windowing backend (Wails v3).
|
|
type Platform interface {
|
|
CreateWindow(options PlatformWindowOptions) PlatformWindow
|
|
GetWindows() []PlatformWindow
|
|
}
|
|
|
|
// PlatformWindowOptions are the backend-specific options passed to CreateWindow.
|
|
type PlatformWindowOptions struct {
|
|
Name string
|
|
Title string
|
|
URL string
|
|
Width, Height int
|
|
X, Y int
|
|
MinWidth, MinHeight int
|
|
MaxWidth, MaxHeight int
|
|
Frameless bool
|
|
Hidden bool
|
|
AlwaysOnTop bool
|
|
BackgroundColour [4]uint8 // RGBA
|
|
DisableResize bool
|
|
EnableFileDrop bool
|
|
}
|
|
|
|
// PlatformWindow is a live window handle from the backend.
|
|
type PlatformWindow interface {
|
|
// Identity
|
|
Name() string
|
|
Title() string
|
|
|
|
// Queries
|
|
Position() (int, int)
|
|
Size() (int, int)
|
|
IsMaximised() bool
|
|
IsFocused() bool
|
|
|
|
// Mutations
|
|
SetTitle(title string)
|
|
SetPosition(x, y int)
|
|
SetSize(width, height int)
|
|
SetBackgroundColour(r, g, b, a uint8)
|
|
SetVisibility(visible bool)
|
|
SetAlwaysOnTop(alwaysOnTop bool)
|
|
|
|
// Window state
|
|
Maximise()
|
|
Restore()
|
|
Minimise()
|
|
Focus()
|
|
Close()
|
|
Show()
|
|
Hide()
|
|
Fullscreen()
|
|
UnFullscreen()
|
|
|
|
// Zoom
|
|
GetZoom() float64
|
|
SetZoom(factor float64)
|
|
ZoomIn()
|
|
ZoomOut()
|
|
|
|
// Content
|
|
SetURL(url string)
|
|
SetHTML(html string)
|
|
ExecJS(js string)
|
|
|
|
// Bounds
|
|
GetBounds() Bounds
|
|
SetBounds(bounds Bounds)
|
|
|
|
// Extras
|
|
ToggleFullscreen()
|
|
Print() error
|
|
Flash(enabled bool)
|
|
|
|
// Events
|
|
OnWindowEvent(handler func(event WindowEvent))
|
|
|
|
// File drop
|
|
OnFileDrop(handler func(paths []string, targetID string))
|
|
}
|
|
|
|
// Bounds holds the position and dimensions of a window.
|
|
type Bounds struct {
|
|
X int `json:"x"`
|
|
Y int `json:"y"`
|
|
Width int `json:"width"`
|
|
Height int `json:"height"`
|
|
}
|
|
|
|
// WindowEvent is emitted by the backend for window state changes.
|
|
type WindowEvent struct {
|
|
Type string // "focus", "blur", "move", "resize", "close"
|
|
Name string // window name
|
|
Data map[string]any
|
|
}
|