gui/pkg/dialog/platform.go
Claude a9b795f223
Some checks failed
Security Scan / security (push) Failing after 29s
Test / test (push) Successful in 2m9s
feat: Wails v3 stub bridge + feature expansion + display bridge + MCP events
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>
2026-03-31 17:42:09 +01:00

62 lines
2.1 KiB
Go

// pkg/dialog/platform.go
package dialog
// Platform abstracts the native dialog backend.
type Platform interface {
OpenFile(options OpenFileOptions) ([]string, error)
SaveFile(options SaveFileOptions) (string, error)
OpenDirectory(options OpenDirectoryOptions) (string, error)
MessageDialog(options MessageDialogOptions) (string, error)
}
// DialogType represents the type of message dialog.
type DialogType int
const (
DialogInfo DialogType = iota
DialogWarning
DialogError
DialogQuestion
)
// OpenFileOptions contains options for the open file dialog.
type OpenFileOptions struct {
Title string `json:"title,omitempty"`
Directory string `json:"directory,omitempty"`
Filename string `json:"filename,omitempty"`
Filters []FileFilter `json:"filters,omitempty"`
AllowMultiple bool `json:"allowMultiple,omitempty"`
CanChooseDirectories bool `json:"canChooseDirectories,omitempty"`
CanChooseFiles bool `json:"canChooseFiles,omitempty"`
ShowHiddenFiles bool `json:"showHiddenFiles,omitempty"`
}
// SaveFileOptions contains options for the save file dialog.
type SaveFileOptions struct {
Title string `json:"title,omitempty"`
Directory string `json:"directory,omitempty"`
Filename string `json:"filename,omitempty"`
Filters []FileFilter `json:"filters,omitempty"`
}
// OpenDirectoryOptions contains options for the directory picker.
type OpenDirectoryOptions struct {
Title string `json:"title,omitempty"`
Directory string `json:"directory,omitempty"`
AllowMultiple bool `json:"allowMultiple,omitempty"`
}
// MessageDialogOptions contains options for a message dialog.
type MessageDialogOptions struct {
Type DialogType `json:"type"`
Title string `json:"title"`
Message string `json:"message"`
Buttons []string `json:"buttons,omitempty"`
}
// FileFilter represents a file type filter for dialogs.
type FileFilter struct {
DisplayName string `json:"displayName"`
Pattern string `json:"pattern"`
Extensions []string `json:"extensions,omitempty"`
}