Documentation ¶
Overview ¶
Portions of this code are derived from the project: - https://github.com/fyne-io/systray
Index ¶
- Constants
- Variables
- func AssetFileServerFS(assets fs.FS) http.Handler
- func BundledAssetFileServer(assets fs.FS) http.Handler
- func DefaultLogger(level slog.Level) *slog.Logger
- func Fatal(message string, args ...interface{})
- func InvokeAsync(fn func())
- func InvokeSync(fn func())
- func InvokeSyncWithError(fn func() error) (err error)
- func InvokeSyncWithResult[T any](fn func() T) (res T)
- func InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)
- func InvokeSyncWithResultAndOther[T any, U any](fn func() (T, U)) (res T, other U)
- func ToARGB(img *image.RGBA) (int, int, []byte)
- type ActivationPolicy
- type App
- func (a *App) AssetServerHandler() func(rw http.ResponseWriter, req *http.Request)
- func (a *App) BrowserOpenFile(path string) error
- func (a *App) BrowserOpenURL(url string) error
- func (a *App) Capabilities() capabilities.Capabilities
- func (a *App) Clipboard() *Clipboard
- func (a *App) CurrentWindow() *WebviewWindow
- func (a *App) EmitEvent(name string, data ...any)
- func (a *App) Environment() EnvironmentInfo
- func (a *App) GetPID() int
- func (a *App) GetPrimaryScreen() (*Screen, error)
- func (a *App) GetScreens() ([]*Screen, error)
- func (a *App) GetWindowByName(name string) Window
- func (a *App) Hide()
- func (a *App) IsDarkMode() bool
- func (a *App) NewMenu() *Menu
- func (a *App) NewSystemTray() *SystemTray
- func (a *App) NewWebviewWindow() *WebviewWindow
- func (a *App) NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow
- func (a *App) OffEvent(name string)
- func (a *App) OnApplicationEvent(eventType events.ApplicationEventType, callback func(event *ApplicationEvent)) func()
- func (a *App) OnEvent(name string, callback func(event *CustomEvent)) func()
- func (a *App) OnMultipleEvent(name string, callback func(event *CustomEvent), counter int)
- func (a *App) OnShutdown(f func())
- func (a *App) OnWindowCreation(callback func(window Window))
- func (a *App) Quit()
- func (a *App) RegisterApplicationEventHook(eventType events.ApplicationEventType, callback func(event *ApplicationEvent)) func()
- func (a *App) RegisterContextMenu(name string, menu *Menu)
- func (a *App) ResetEvents()
- func (a *App) Run() error
- func (a *App) SetIcon(icon []byte)
- func (a *App) SetMenu(menu *Menu)
- func (a *App) Show()
- func (a *App) ShowAboutDialog()
- type ApplicationEvent
- type ApplicationEventContext
- type Args
- type AssetOptions
- type BackdropType
- type BackgroundType
- type Bindings
- type BoundMethod
- type Button
- type ButtonState
- type CallOptions
- type Callback
- type Calloc
- type Clipboard
- type Context
- type ContextMenuData
- type CoreWebView2PermissionKind
- type CoreWebView2PermissionState
- type CustomEvent
- type DialogType
- type DragEffect
- type EnvironmentInfo
- type EventListener
- type EventProcessor
- func (e *EventProcessor) Emit(thisEvent *CustomEvent)
- func (e *EventProcessor) Off(eventName string)
- func (e *EventProcessor) OffAll()
- func (e *EventProcessor) On(eventName string, callback func(event *CustomEvent)) func()
- func (e *EventProcessor) OnMultiple(eventName string, callback func(event *CustomEvent), counter int) func()
- func (e *EventProcessor) Once(eventName string, callback func(event *CustomEvent)) func()
- func (e *EventProcessor) RegisterHook(eventName string, callback func(*CustomEvent)) func()
- type FileFilter
- type GSList
- type GSListPointer
- type IconPosition
- type LRTB
- type LinuxOptions
- type LinuxWindow
- type MacAppearanceType
- type MacBackdrop
- type MacOptions
- type MacTitleBar
- type MacToolbarStyle
- type MacWebviewPreferences
- type MacWindow
- type MacWindowLevel
- type Menu
- func (m *Menu) Add(label string) *MenuItem
- func (m *Menu) AddCheckbox(label string, enabled bool) *MenuItem
- func (m *Menu) AddRadio(label string, enabled bool) *MenuItem
- func (m *Menu) AddRole(role Role) *Menu
- func (m *Menu) AddSeparator()
- func (m *Menu) AddSubmenu(s string) *Menu
- func (m *Menu) Append(in *Menu)
- func (m *Menu) Clone() *Menu
- func (m *Menu) FindByLabel(label string) *MenuItem
- func (m *Menu) FindByRole(role Role) *MenuItem
- func (m *Menu) ItemAt(index int) *MenuItem
- func (m *Menu) RemoveMenuItem(target *MenuItem)
- func (m *Menu) SetLabel(label string)
- func (m *Menu) Update()
- type MenuItem
- func NewAboutMenuItem() *MenuItem
- func NewAppMenu() *MenuItem
- func NewBringAllToFrontMenuItem() *MenuItem
- func NewCloseMenuItem() *MenuItem
- func NewCopyMenuItem() *MenuItem
- func NewCutMenuItem() *MenuItem
- func NewDeleteMenuItem() *MenuItem
- func NewEditMenu() *MenuItem
- func NewFileMenu() *MenuItem
- func NewFindAndReplaceMenuItem() *MenuItem
- func NewFindMenuItem() *MenuItem
- func NewFindNextMenuItem() *MenuItem
- func NewFindPreviousMenuItem() *MenuItem
- func NewForceReloadMenuItem() *MenuItem
- func NewFrontMenuItem() *MenuItem
- func NewFullScreenMenuItem() *MenuItem
- func NewHelpMenu() *MenuItem
- func NewHelpMenuItem() *MenuItem
- func NewHideMenuItem() *MenuItem
- func NewHideOthersMenuItem() *MenuItem
- func NewMenuItem(label string) *MenuItem
- func NewMenuItemCheckbox(label string, checked bool) *MenuItem
- func NewMenuItemRadio(label string, checked bool) *MenuItem
- func NewMenuItemSeparator() *MenuItem
- func NewMinimizeMenuItem() *MenuItem
- func NewNewFileMenuItem() *MenuItem
- func NewOpenDevToolsMenuItem() *MenuItem
- func NewOpenMenuItem() *MenuItem
- func NewPageLayoutMenuItem() *MenuItem
- func NewPasteAndMatchStyleMenuItem() *MenuItem
- func NewPasteMenuItem() *MenuItem
- func NewPrintMenuItem() *MenuItem
- func NewQuitMenuItem() *MenuItem
- func NewRedoMenuItem() *MenuItem
- func NewReloadMenuItem() *MenuItem
- func NewRevertMenuItem() *MenuItem
- func NewRole(role Role) *MenuItem
- func NewSaveAsMenuItem() *MenuItem
- func NewSaveMenuItem() *MenuItem
- func NewSelectAllMenuItem() *MenuItem
- func NewServicesMenu() *MenuItem
- func NewShowAllMenuItem() *MenuItem
- func NewSpeechMenu() *MenuItem
- func NewStartSpeakingMenuItem() *MenuItem
- func NewStopSpeakingMenuItem() *MenuItem
- func NewSubMenuItem(label string) *MenuItem
- func NewSubmenu(s string, items *Menu) *MenuItem
- func NewToggleFullscreenMenuItem() *MenuItem
- func NewUndoMenuItem() *MenuItem
- func NewUnhideMenuItem() *MenuItem
- func NewViewMenu() *MenuItem
- func NewWindowMenu() *MenuItem
- func NewZoomInMenuItem() *MenuItem
- func NewZoomMenuItem() *MenuItem
- func NewZoomOutMenuItem() *MenuItem
- func NewZoomResetMenuItem() *MenuItem
- func (m *MenuItem) Checked() bool
- func (m *MenuItem) Clone() *MenuItem
- func (m *MenuItem) Enabled() bool
- func (m *MenuItem) GetAccelerator() string
- func (m *MenuItem) GetSubmenu() *Menu
- func (m *MenuItem) Hidden() bool
- func (m *MenuItem) IsCheckbox() bool
- func (m *MenuItem) IsRadio() bool
- func (m *MenuItem) IsSeparator() bool
- func (m *MenuItem) IsSubmenu() bool
- func (m *MenuItem) Label() string
- func (m *MenuItem) OnClick(f func(*Context)) *MenuItem
- func (m *MenuItem) RemoveAccelerator()
- func (m *MenuItem) SetAccelerator(shortcut string) *MenuItem
- func (m *MenuItem) SetBitmap(bitmap []byte) *MenuItem
- func (m *MenuItem) SetChecked(checked bool) *MenuItem
- func (m *MenuItem) SetEnabled(enabled bool) *MenuItem
- func (m *MenuItem) SetHidden(hidden bool) *MenuItem
- func (m *MenuItem) SetLabel(s string) *MenuItem
- func (m *MenuItem) SetRole(role Role) *MenuItem
- func (m *MenuItem) SetTooltip(s string) *MenuItem
- func (m *MenuItem) Tooltip() string
- type MessageDialog
- func (d *MessageDialog) AddButton(s string) *Button
- func (d *MessageDialog) AddButtons(buttons []*Button) *MessageDialog
- func (d *MessageDialog) AttachToWindow(window Window) *MessageDialog
- func (d *MessageDialog) SetCancelButton(button *Button) *MessageDialog
- func (d *MessageDialog) SetDefaultButton(button *Button) *MessageDialog
- func (d *MessageDialog) SetIcon(icon []byte) *MessageDialog
- func (d *MessageDialog) SetMessage(message string) *MessageDialog
- func (d *MessageDialog) SetTitle(title string) *MessageDialog
- func (d *MessageDialog) Show()
- type MessageDialogOptions
- type MessageProcessor
- type Middleware
- type OpenFileDialogOptions
- type OpenFileDialogStruct
- func (d *OpenFileDialogStruct) AddFilter(displayName, pattern string) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) AllowsOtherFileTypes(allowsOtherFileTypes bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) AttachToWindow(window Window) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) CanChooseDirectories(canChooseDirectories bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) CanChooseFiles(canChooseFiles bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) CanCreateDirectories(canCreateDirectories bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) CanSelectHiddenExtension(canSelectHiddenExtension bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) HideExtension(hideExtension bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) PromptForMultipleSelection() ([]string, error)
- func (d *OpenFileDialogStruct) PromptForSingleSelection() (string, error)
- func (d *OpenFileDialogStruct) ResolvesAliases(resolvesAliases bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) SetButtonText(text string) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) SetDirectory(directory string) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) SetMessage(message string) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) SetOptions(options *OpenFileDialogOptions)
- func (d *OpenFileDialogStruct) SetTitle(title string) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) ShowHiddenFiles(showHiddenFiles bool) *OpenFileDialogStruct
- func (d *OpenFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *OpenFileDialogStruct
- type Options
- type PX
- type Parameter
- type PluginCallOptions
- type PositionOptions
- type QueryParams
- func (qp QueryParams) Args() (*Args, error)
- func (qp QueryParams) Bool(key string) *bool
- func (qp QueryParams) Float64(key string) *float64
- func (qp QueryParams) Int(key string) *int
- func (qp QueryParams) String(key string) *string
- func (qp QueryParams) ToStruct(str any) error
- func (qp QueryParams) UInt(key string) *uint
- func (qp QueryParams) UInt8(key string) *uint8
- type RGBA
- type Rect
- type Role
- type SaveFileDialogOptions
- type SaveFileDialogStruct
- func (d *SaveFileDialogStruct) AddFilter(displayName, pattern string) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) AllowsOtherFileTypes(allowOtherFileTypes bool) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) AttachToWindow(window Window) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) CanCreateDirectories(canCreateDirectories bool) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) CanSelectHiddenExtension(canSelectHiddenExtension bool) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) HideExtension(hideExtension bool) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) PromptForSingleSelection() (string, error)
- func (d *SaveFileDialogStruct) SetButtonText(text string) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) SetDirectory(directory string) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) SetFilename(filename string) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) SetMessage(message string) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) SetOptions(options *SaveFileDialogOptions)
- func (d *SaveFileDialogStruct) ShowHiddenFiles(showHiddenFiles bool) *SaveFileDialogStruct
- func (d *SaveFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *SaveFileDialogStruct
- type Screen
- type Service
- type ServiceName
- type ServiceOptions
- type ServiceShutdown
- type ServiceStartup
- type Size
- type SystemTray
- func (s *SystemTray) AttachWindow(window *WebviewWindow) *SystemTray
- func (s *SystemTray) Destroy()
- func (s *SystemTray) Label() string
- func (s *SystemTray) OnClick(handler func()) *SystemTray
- func (s *SystemTray) OnDoubleClick(handler func()) *SystemTray
- func (s *SystemTray) OnMouseEnter(handler func()) *SystemTray
- func (s *SystemTray) OnMouseLeave(handler func()) *SystemTray
- func (s *SystemTray) OnRightClick(handler func()) *SystemTray
- func (s *SystemTray) OnRightDoubleClick(handler func()) *SystemTray
- func (s *SystemTray) OpenMenu()
- func (s *SystemTray) PositionWindow(window *WebviewWindow, offset int) error
- func (s *SystemTray) Run()
- func (s *SystemTray) SetDarkModeIcon(icon []byte) *SystemTray
- func (s *SystemTray) SetIcon(icon []byte) *SystemTray
- func (s *SystemTray) SetIconPosition(iconPosition int) *SystemTray
- func (s *SystemTray) SetLabel(label string)
- func (s *SystemTray) SetMenu(menu *Menu) *SystemTray
- func (s *SystemTray) SetTemplateIcon(icon []byte) *SystemTray
- func (s *SystemTray) WindowDebounce(debounce time.Duration) *SystemTray
- func (s *SystemTray) WindowOffset(offset int) *SystemTray
- type Theme
- type ThemeSettings
- type WailsEventListener
- type WebviewGpuPolicy
- type WebviewWindow
- func (w *WebviewWindow) CallError(callID string, result string)
- func (w *WebviewWindow) CallResponse(callID string, result string)
- func (w *WebviewWindow) Center()
- func (w *WebviewWindow) Close()
- func (w *WebviewWindow) Destroy()
- func (w *WebviewWindow) DialogError(dialogID string, result string)
- func (w *WebviewWindow) DialogResponse(dialogID string, result string, isJSON bool)
- func (w *WebviewWindow) DisableSizeConstraints()
- func (w *WebviewWindow) DispatchWailsEvent(event *CustomEvent)
- func (w *WebviewWindow) EmitEvent(name string, data ...any)
- func (w *WebviewWindow) EnableSizeConstraints()
- func (w *WebviewWindow) Error(message string, args ...any)
- func (w *WebviewWindow) ExecJS(js string)
- func (w *WebviewWindow) Flash(enabled bool)
- func (w *WebviewWindow) Focus()
- func (w *WebviewWindow) ForceReload()
- func (w *WebviewWindow) Fullscreen() Window
- func (w *WebviewWindow) GetBorderSizes() *LRTB
- func (w *WebviewWindow) GetScreen() (*Screen, error)
- func (w *WebviewWindow) GetZoom() float64
- func (w *WebviewWindow) HandleDragAndDropMessage(filenames []string)
- func (w *WebviewWindow) HandleKeyEvent(acceleratorString string)
- func (w *WebviewWindow) HandleMessage(message string)
- func (w *WebviewWindow) HandleWindowEvent(id uint)
- func (w *WebviewWindow) Height() int
- func (w *WebviewWindow) Hide() Window
- func (w *WebviewWindow) ID() uint
- func (w *WebviewWindow) Info(message string, args ...any)
- func (w *WebviewWindow) IsFocused() bool
- func (w *WebviewWindow) IsFullscreen() bool
- func (w *WebviewWindow) IsIgnoreMouseEvents() bool
- func (w *WebviewWindow) IsMaximised() bool
- func (w *WebviewWindow) IsMinimised() bool
- func (w *WebviewWindow) IsVisible() bool
- func (w *WebviewWindow) Maximise() Window
- func (w *WebviewWindow) Minimise() Window
- func (w *WebviewWindow) Name() string
- func (w *WebviewWindow) NativeWindowHandle() (uintptr, error)
- func (w *WebviewWindow) OnWindowEvent(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
- func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData)
- func (w *WebviewWindow) OpenDevTools()
- func (w *WebviewWindow) Position() (int, int)
- func (w *WebviewWindow) Print() error
- func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu)
- func (w *WebviewWindow) RegisterHook(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
- func (w *WebviewWindow) RelativePosition() (int, int)
- func (w *WebviewWindow) Reload()
- func (w *WebviewWindow) Resizable() bool
- func (w *WebviewWindow) Restore()
- func (w *WebviewWindow) Run()
- func (w *WebviewWindow) SetAlwaysOnTop(b bool) Window
- func (w *WebviewWindow) SetBackgroundColour(colour RGBA) Window
- func (w *WebviewWindow) SetCloseButtonState(state ButtonState) Window
- func (w *WebviewWindow) SetEnabled(enabled bool)
- func (w *WebviewWindow) SetFrameless(frameless bool) Window
- func (w *WebviewWindow) SetHTML(html string) Window
- func (w *WebviewWindow) SetIgnoreMouseEvents(ignore bool) Window
- func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) Window
- func (w *WebviewWindow) SetMaximiseButtonState(state ButtonState) Window
- func (w *WebviewWindow) SetMinSize(minWidth, minHeight int) Window
- func (w *WebviewWindow) SetMinimiseButtonState(state ButtonState) Window
- func (w *WebviewWindow) SetPosition(x int, y int)
- func (w *WebviewWindow) SetRelativePosition(x, y int) Window
- func (w *WebviewWindow) SetResizable(b bool) Window
- func (w *WebviewWindow) SetSize(width, height int) Window
- func (w *WebviewWindow) SetTitle(title string) Window
- func (w *WebviewWindow) SetURL(s string) Window
- func (w *WebviewWindow) SetZoom(magnification float64) Window
- func (w *WebviewWindow) Show() Window
- func (w *WebviewWindow) Size() (int, int)
- func (w *WebviewWindow) ToggleFullscreen()
- func (w *WebviewWindow) ToggleMaximise()
- func (w *WebviewWindow) UnFullscreen()
- func (w *WebviewWindow) UnMaximise()
- func (w *WebviewWindow) UnMinimise()
- func (w *WebviewWindow) Width() int
- func (w *WebviewWindow) Zoom()
- func (w *WebviewWindow) ZoomIn()
- func (w *WebviewWindow) ZoomOut()
- func (w *WebviewWindow) ZoomReset() Window
- type WebviewWindowOptions
- type Window
- type WindowAttachConfig
- type WindowEvent
- type WindowEventContext
- type WindowEventListener
- type WindowState
- type WindowsOptions
- type WindowsWindow
Constants ¶
const ( // CmdOrCtrlKey represents Command on Mac and Control on other platforms CmdOrCtrlKey modifier = 0 << iota // OptionOrAltKey represents Option on Mac and Alt on other platforms OptionOrAltKey modifier = 1 << iota // ShiftKey represents the shift key on all systems ShiftKey modifier = 2 << iota // SuperKey represents Command on Mac and the Windows key on the other platforms SuperKey modifier = 3 << iota // ControlKey represents the control key on all systems ControlKey modifier = 4 << iota )
const ( ApplicationHide = 0 ApplicationShow = 1 ApplicationQuit = 2 )
const ( ClipboardSetText = 0 ClipboardText = 1 )
const ( DialogInfo = 0 DialogWarning = 1 DialogError = 2 DialogQuestion = 3 DialogOpenFile = 4 DialogSaveFile = 5 )
const ( ScreensGetAll = 0 ScreensGetPrimary = 1 ScreensGetCurrent = 2 )
const ( SystemIsDarkMode = 0 Environment = 1 )
const ( WindowPosition = 0 WindowCenter = 1 WindowClose = 2 WindowDisableSizeConstraints = 3 WindowEnableSizeConstraints = 4 WindowFocus = 5 WindowForceReload = 6 WindowFullscreen = 7 WindowGetScreen = 8 WindowGetZoom = 9 WindowHeight = 10 WindowHide = 11 WindowIsFocused = 12 WindowIsFullscreen = 13 WindowIsMaximised = 14 WindowIsMinimised = 15 WindowMaximise = 16 WindowMinimise = 17 WindowName = 18 WindowOpenDevTools = 19 WindowRelativePosition = 20 WindowReload = 21 WindowResizable = 22 WindowRestore = 23 WindowSetPosition = 24 WindowSetAlwaysOnTop = 25 WindowSetBackgroundColour = 26 WindowSetFrameless = 27 WindowSetFullscreenButtonEnabled = 28 WindowSetMaxSize = 29 WindowSetMinSize = 30 WindowSetRelativePosition = 31 WindowSetResizable = 32 WindowSetSize = 33 WindowSetTitle = 34 WindowSetZoom = 35 WindowShow = 36 WindowSize = 37 WindowToggleFullscreen = 38 WindowToggleMaximise = 39 WindowUnFullscreen = 40 WindowUnMaximise = 41 WindowUnMinimise = 42 WindowWidth = 43 WindowZoom = 44 WindowZoomIn = 45 WindowZoomOut = 46 WindowZoomReset = 47 )
const ( NSImageNone = iota NSImageOnly NSImageLeft NSImageRight NSImageBelow NSImageAbove NSImageOverlaps NSImageLeading NSImageTrailing )
const (
BrowserOpenURL = 0
)
const (
CallBinding = 0
)
const (
ContextMenuOpen = 0
)
const (
EventsEmit = 0
)
Variables ¶
var AlphaAssets = AssetOptions{ Handler: BundledAssetFileServer(alphaAssets), }
AlphaAssets is the default assets for the alpha application
var BuildInfo *debug.BuildInfo
BuildInfo contains the build info for the application
var BuildSettings map[string]string
BuildSettings contains the build settings for the application
var DefaultServiceOptions = ServiceOptions{
Route: "",
}
var Disabled = u.False
Disabled means the feature should be disabled
var Enabled = u.True
Enabled means the feature should be enabled
var MacTitleBarDefault = MacTitleBar{ AppearsTransparent: false, Hide: false, HideTitle: false, FullSizeContent: false, UseToolbar: false, HideToolbarSeparator: false, }
MacTitleBarDefault results in the default Mac MacTitleBar
var MacTitleBarHidden = MacTitleBar{ AppearsTransparent: true, Hide: false, HideTitle: true, FullSizeContent: true, UseToolbar: false, HideToolbarSeparator: false, }
MacTitleBarHidden results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls (“traffic lights”) in the top left.
var MacTitleBarHiddenInset = MacTitleBar{ AppearsTransparent: true, Hide: false, HideTitle: true, FullSizeContent: true, UseToolbar: true, HideToolbarSeparator: true, }
MacTitleBarHiddenInset results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge.
var MacTitleBarHiddenInsetUnified = MacTitleBar{ AppearsTransparent: true, Hide: false, HideTitle: true, FullSizeContent: true, UseToolbar: true, HideToolbarSeparator: true, ToolbarStyle: MacToolbarStyleUnified, }
MacTitleBarHiddenInsetUnified results in a hidden title bar with an alternative look where the traffic light buttons are even more inset from the window edge.
var VirtualKeyCodes = map[uint]string{}/* 146 elements not displayed */
var WebviewWindowDefaults = &WebviewWindowOptions{ Title: "", Width: 800, Height: 600, URL: "", BackgroundColour: RGBA{ Red: 255, Green: 255, Blue: 255, Alpha: 255, }, }
Functions ¶
func AssetFileServerFS ¶
AssetFileServerFS returns a http handler which serves the assets from the fs.FS. If an external devserver has been provided 'FRONTEND_DEVSERVER_URL' the files are being served from the external server, ignoring the `assets`.
func BundledAssetFileServer ¶
BundledAssetFileServer returns a http handler which serves the assets from the fs.FS. If an external devserver has been provided 'FRONTEND_DEVSERVER_URL' the files are being served from the external server, ignoring the `assets`. It also serves the compiled runtime.js file at `/wails/runtime.js`. It will provide the production runtime.js file from the embedded assets if the `production` tag is used.
func InvokeAsync ¶
func InvokeAsync(fn func())
func InvokeSync ¶
func InvokeSync(fn func())
func InvokeSyncWithError ¶
func InvokeSyncWithResult ¶
func InvokeSyncWithResult[T any](fn func() T) (res T)
Types ¶
type ActivationPolicy ¶
type ActivationPolicy int
ActivationPolicy is the activation policy for the application.
const ( // ActivationPolicyRegular is used for applications that have a user interface, ActivationPolicyRegular ActivationPolicy = iota // ActivationPolicyAccessory is used for applications that do not have a main window, // such as system tray applications or background applications. ActivationPolicyAccessory ActivationPolicyProhibited )
type App ¶
type App struct { // The main application menu ApplicationMenu *Menu Logger *slog.Logger // contains filtered or unexported fields }
func (*App) AssetServerHandler ¶
func (a *App) AssetServerHandler() func(rw http.ResponseWriter, req *http.Request)
func (*App) BrowserOpenFile ¶
func (*App) BrowserOpenURL ¶
func (*App) Capabilities ¶
func (a *App) Capabilities() capabilities.Capabilities
func (*App) CurrentWindow ¶
func (a *App) CurrentWindow() *WebviewWindow
func (*App) Environment ¶
func (a *App) Environment() EnvironmentInfo
func (*App) GetPrimaryScreen ¶
func (*App) GetScreens ¶
func (*App) GetWindowByName ¶
func (*App) IsDarkMode ¶
func (*App) NewSystemTray ¶
func (a *App) NewSystemTray() *SystemTray
func (*App) NewWebviewWindow ¶
func (a *App) NewWebviewWindow() *WebviewWindow
func (*App) NewWebviewWindowWithOptions ¶
func (a *App) NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow
func (*App) OnApplicationEvent ¶
func (a *App) OnApplicationEvent(eventType events.ApplicationEventType, callback func(event *ApplicationEvent)) func()
func (*App) OnEvent ¶
func (a *App) OnEvent(name string, callback func(event *CustomEvent)) func()
OnEvent will listen for events
func (*App) OnMultipleEvent ¶
func (a *App) OnMultipleEvent(name string, callback func(event *CustomEvent), counter int)
OnMultipleEvent will listen for events a set number of times before unsubscribing.
func (*App) OnShutdown ¶
func (a *App) OnShutdown(f func())
OnShutdown adds a function to be run when the application is shutting down.
func (*App) OnWindowCreation ¶
func (*App) RegisterApplicationEventHook ¶
func (a *App) RegisterApplicationEventHook(eventType events.ApplicationEventType, callback func(event *ApplicationEvent)) func()
RegisterApplicationEventHook registers a hook for the given application event. Hooks are called before the event listeners and can cancel the event. The returned function can be called to remove the hook.
func (*App) RegisterContextMenu ¶
func (*App) ResetEvents ¶
func (a *App) ResetEvents()
ResetEvents will remove all event listeners and hooks
func (*App) ShowAboutDialog ¶
func (a *App) ShowAboutDialog()
type ApplicationEvent ¶
func (*ApplicationEvent) Cancel ¶
func (w *ApplicationEvent) Cancel()
func (*ApplicationEvent) Context ¶
func (w *ApplicationEvent) Context() *ApplicationEventContext
type ApplicationEventContext ¶
type ApplicationEventContext struct {
// contains filtered or unexported fields
}
func (ApplicationEventContext) HasVisibleWindows ¶
func (c ApplicationEventContext) HasVisibleWindows() bool
func (ApplicationEventContext) IsDarkMode ¶
func (c ApplicationEventContext) IsDarkMode() bool
func (ApplicationEventContext) OpenedFiles ¶
func (c ApplicationEventContext) OpenedFiles() []string
type AssetOptions ¶
type AssetOptions struct { // Handler which serves all the content to the WebView. Handler http.Handler // Middleware is a HTTP Middleware which allows to hook into the AssetServer request chain. It allows to skip the default // request handler dynamically, e.g. implement specialized Routing etc. // The Middleware is called to build a new `http.Handler` used by the AssetSever and it also receives the default // handler used by the AssetServer as an argument. // // This middleware injects itself before any of Wails internal middlewares. // // If not defined, the default AssetServer request chain is executed. // // Multiple Middlewares can be chained together with: // ChainMiddleware(middleware ...Middleware) Middleware Middleware Middleware // DisableLogging disables logging of the AssetServer. By default, the AssetServer logs every request. DisableLogging bool }
AssetOptions defines the configuration of the AssetServer.
type BackdropType ¶
type BackdropType int32
const ( Auto BackdropType = 0 None BackdropType = 1 Mica BackdropType = 2 Acrylic BackdropType = 3 Tabbed BackdropType = 4 )
type BackgroundType ¶
type BackgroundType int
const ( BackgroundTypeSolid BackgroundType = iota BackgroundTypeTransparent BackgroundTypeTranslucent )
type Bindings ¶
type Bindings struct {
// contains filtered or unexported fields
}
func NewBindings ¶
func (*Bindings) GenerateID ¶
GenerateID generates a unique ID for a binding
func (*Bindings) Get ¶
func (b *Bindings) Get(options *CallOptions) *BoundMethod
Get returns the bound method with the given name
func (*Bindings) GetByID ¶
func (b *Bindings) GetByID(id uint32) *BoundMethod
GetByID returns the bound method with the given ID
type BoundMethod ¶
type BoundMethod struct { ID uint32 `json:"id"` Name string `json:"name"` Inputs []*Parameter `json:"inputs,omitempty"` Outputs []*Parameter `json:"outputs,omitempty"` Comments string `json:"comments,omitempty"` Method reflect.Value `json:"-"` TypeName string PackagePath string // contains filtered or unexported fields }
BoundMethod defines all the data related to a Go method that is bound to the Wails application
func (*BoundMethod) Call ¶
func (b *BoundMethod) Call(ctx context.Context, args []json.RawMessage) (returnValue interface{}, err error)
Call will attempt to call this bound method with the given args
func (*BoundMethod) String ¶
func (b *BoundMethod) String() string
type ButtonState ¶
type ButtonState int
const ( ButtonEnabled ButtonState = 0 ButtonDisabled ButtonState = 1 ButtonHidden ButtonState = 2 )
type CallOptions ¶
type CallOptions struct { MethodID uint32 `json:"methodID"` MethodName string `json:"methodName"` Args []json.RawMessage `json:"args"` }
type Calloc ¶
type Calloc struct {
// contains filtered or unexported fields
}
Calloc handles alloc/dealloc of C data
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func (*Context) ClickedMenuItem ¶
func (*Context) ContextMenuData ¶
type ContextMenuData ¶
type CoreWebView2PermissionKind ¶
type CoreWebView2PermissionKind uint32
const ( CoreWebView2PermissionKindUnknownPermission CoreWebView2PermissionKind = iota CoreWebView2PermissionKindMicrophone CoreWebView2PermissionKindCamera CoreWebView2PermissionKindGeolocation CoreWebView2PermissionKindNotifications CoreWebView2PermissionKindOtherSensors CoreWebView2PermissionKindClipboardRead )
type CoreWebView2PermissionState ¶
type CoreWebView2PermissionState uint32
const ( CoreWebView2PermissionStateDefault CoreWebView2PermissionState = iota CoreWebView2PermissionStateAllow CoreWebView2PermissionStateDeny )
type CustomEvent ¶
type CustomEvent struct { Name string `json:"name"` Data any `json:"data"` Sender string `json:"sender"` Cancelled bool }
func (*CustomEvent) Cancel ¶
func (e *CustomEvent) Cancel()
func (*CustomEvent) ToJSON ¶
func (e *CustomEvent) ToJSON() string
type DialogType ¶
type DialogType int
const ( InfoDialogType DialogType = iota QuestionDialogType WarningDialogType ErrorDialogType )
type DragEffect ¶
type DragEffect int32
const ( // DragEffectNone is used to indicate that the drop target cannot accept the data. DragEffectNone DragEffect = 1 // DragEffectCopy is used to indicate that the data is copied to the drop target. DragEffectCopy DragEffect = 2 // DragEffectMove is used to indicate that the data is removed from the drag source. DragEffectMove DragEffect = 3 // DragEffectLink is used to indicate that a link to the original data is established. DragEffectLink DragEffect = 4 )
type EnvironmentInfo ¶
type EnvironmentInfo struct { OS string Arch string Debug bool OSInfo *operatingsystem.OS PlatformInfo map[string]any }
EnvironmentInfo represents information about the current environment.
Fields: - OS: the operating system that the program is running on. - Arch: the architecture of the operating system. - Debug: indicates whether debug mode is enabled. - OSInfo: information about the operating system.
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
type EventProcessor ¶
type EventProcessor struct {
// contains filtered or unexported fields
}
EventProcessor handles custom events
func NewWailsEventProcessor ¶
func NewWailsEventProcessor(dispatchEventToWindows func(*CustomEvent)) *EventProcessor
func (*EventProcessor) Emit ¶
func (e *EventProcessor) Emit(thisEvent *CustomEvent)
Emit sends an event to all listeners
func (*EventProcessor) Off ¶
func (e *EventProcessor) Off(eventName string)
func (*EventProcessor) OffAll ¶
func (e *EventProcessor) OffAll()
func (*EventProcessor) On ¶
func (e *EventProcessor) On(eventName string, callback func(event *CustomEvent)) func()
On is the equivalent of Javascript's `addEventListener`
func (*EventProcessor) OnMultiple ¶
func (e *EventProcessor) OnMultiple(eventName string, callback func(event *CustomEvent), counter int) func()
OnMultiple is the same as `OnApplicationEvent` but will unregister after `count` events
func (*EventProcessor) Once ¶
func (e *EventProcessor) Once(eventName string, callback func(event *CustomEvent)) func()
Once is the same as `OnApplicationEvent` but will unregister after the first event
func (*EventProcessor) RegisterHook ¶
func (e *EventProcessor) RegisterHook(eventName string, callback func(*CustomEvent)) func()
RegisterHook provides a means of registering methods to be called before emitting the event
type FileFilter ¶
type GSListPointer ¶
type GSListPointer *GSList
type IconPosition ¶
type IconPosition int
type LinuxOptions ¶
type LinuxOptions struct { // DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed. DisableQuitOnLastWindowClosed bool // ProgramName is used to set the program's name for the window manager via GTK's g_set_prgname(). //This name should not be localized. [see the docs] // //When a .desktop file is created this value helps with window grouping and desktop icons when the .desktop file's Name //property differs form the executable's filename. // //[see the docs]: https://docs.gtk.org/glib/func.set_prgname.html ProgramName string }
LinuxOptions contains options for Linux applications.
type LinuxWindow ¶
type LinuxWindow struct { // Icon Sets up the icon representing the window. This icon is used when the window is minimized // (also known as iconified). Icon []byte // WindowIsTranslucent sets the window's background to transparent when enabled. WindowIsTranslucent bool // WebviewGpuPolicy used for determining the hardware acceleration policy for the webview. // - WebviewGpuPolicyAlways // - WebviewGpuPolicyOnDemand // - WebviewGpuPolicyNever // // Due to https://github.com/wailsapp/wails/issues/2977, if options.Linux is nil // in the call to wails.Run(), WebviewGpuPolicy is set by default to WebviewGpuPolicyNever. // Client code may override this behavior by passing a non-nil Options and set // WebviewGpuPolicy as needed. WebviewGpuPolicy WebviewGpuPolicy }
LinuxWindow specific to Linux windows
type MacAppearanceType ¶
type MacAppearanceType string
MacAppearanceType is a type of Appearance for Cocoa windows
const ( // DefaultAppearance uses the default system value DefaultAppearance MacAppearanceType = "" // NSAppearanceNameAqua - The standard light system appearance. NSAppearanceNameAqua MacAppearanceType = "NSAppearanceNameAqua" // NSAppearanceNameDarkAqua - The standard dark system appearance. NSAppearanceNameDarkAqua MacAppearanceType = "NSAppearanceNameDarkAqua" // NSAppearanceNameVibrantLight - The light vibrant appearance NSAppearanceNameVibrantLight MacAppearanceType = "NSAppearanceNameVibrantLight" // NSAppearanceNameAccessibilityHighContrastAqua - A high-contrast version of the standard light system appearance. NSAppearanceNameAccessibilityHighContrastAqua MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastAqua" // NSAppearanceNameAccessibilityHighContrastDarkAqua - A high-contrast version of the standard dark system appearance. NSAppearanceNameAccessibilityHighContrastDarkAqua MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastDarkAqua" // NSAppearanceNameAccessibilityHighContrastVibrantLight - A high-contrast version of the light vibrant appearance. NSAppearanceNameAccessibilityHighContrastVibrantLight MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantLight" // NSAppearanceNameAccessibilityHighContrastVibrantDark - A high-contrast version of the dark vibrant appearance. NSAppearanceNameAccessibilityHighContrastVibrantDark MacAppearanceType = "NSAppearanceNameAccessibilityHighContrastVibrantDark" )
type MacBackdrop ¶
type MacBackdrop int
MacBackdrop is the backdrop type for macOS
const ( // MacBackdropNormal - The default value. The window will have a normal opaque background. MacBackdropNormal MacBackdrop = iota // MacBackdropTransparent - The window will have a transparent background, with the content underneath it being visible MacBackdropTransparent // MacBackdropTranslucent - The window will have a translucent background, with the content underneath it being "fuzzy" or "frosted" MacBackdropTranslucent )
type MacOptions ¶
type MacOptions struct { // ActivationPolicy is the activation policy for the application. Defaults to // applicationActivationPolicyRegular. ActivationPolicy ActivationPolicy // If set to true, the application will terminate when the last window is closed. ApplicationShouldTerminateAfterLastWindowClosed bool }
MacOptions contains options for macOS applications.
type MacTitleBar ¶
type MacTitleBar struct { // AppearsTransparent will make the titlebar transparent AppearsTransparent bool // Hide will hide the titlebar Hide bool // HideTitle will hide the title HideTitle bool // FullSizeContent will extend the window content to the full size of the window FullSizeContent bool // UseToolbar will use a toolbar instead of a titlebar UseToolbar bool // HideToolbarSeparator will hide the toolbar separator HideToolbarSeparator bool // ShowToolbarWhenFullscreen will keep the toolbar visible when the window is in fullscreen mode ShowToolbarWhenFullscreen bool // ToolbarStyle is the style of toolbar to use ToolbarStyle MacToolbarStyle }
MacTitleBar contains options for the Mac titlebar
type MacToolbarStyle ¶
type MacToolbarStyle int
MacToolbarStyle is the style of toolbar for macOS
const ( // MacToolbarStyleAutomatic - The default value. The style will be determined by the window's given configuration MacToolbarStyleAutomatic MacToolbarStyle = iota // MacToolbarStyleExpanded - The toolbar will appear below the window title MacToolbarStyleExpanded // MacToolbarStylePreference - The toolbar will appear below the window title and the items in the toolbar will attempt to have equal widths when possible MacToolbarStylePreference // MacToolbarStyleUnified - The window title will appear inline with the toolbar when visible MacToolbarStyleUnified // MacToolbarStyleUnifiedCompact - Same as MacToolbarStyleUnified, but with reduced margins in the toolbar allowing more focus to be on the contents of the window MacToolbarStyleUnifiedCompact )
type MacWebviewPreferences ¶
type MacWebviewPreferences struct { // TabFocusesLinks will enable tabbing to links TabFocusesLinks u.Bool // TextInteractionEnabled will enable text interaction TextInteractionEnabled u.Bool // FullscreenEnabled will enable fullscreen FullscreenEnabled u.Bool }
MacWebviewPreferences contains preferences for the Mac webview
type MacWindow ¶
type MacWindow struct { // Backdrop is the backdrop type for the window Backdrop MacBackdrop // DisableShadow will disable the window shadow DisableShadow bool // TitleBar contains options for the Mac titlebar TitleBar MacTitleBar // Appearance is the appearance type for the window Appearance MacAppearanceType // InvisibleTitleBarHeight defines the height of an invisible titlebar which responds to dragging InvisibleTitleBarHeight int // Maps events from platform specific to common event types EventMapping map[events.WindowEventType]events.WindowEventType // EnableFraudulentWebsiteWarnings will enable warnings for fraudulent websites. // Default: false EnableFraudulentWebsiteWarnings bool // WebviewPreferences contains preferences for the webview WebviewPreferences MacWebviewPreferences // WindowLevel sets the window level to control the order of windows in the screen WindowLevel MacWindowLevel }
MacWindow contains macOS specific options for Webview Windows
type MacWindowLevel ¶
type MacWindowLevel string
const ( MacWindowLevelNormal MacWindowLevel = "normal" MacWindowLevelFloating MacWindowLevel = "floating" MacWindowLevelTornOffMenu MacWindowLevel = "tornOffMenu" MacWindowLevelModalPanel MacWindowLevel = "modalPanel" MacWindowLevelMainMenu MacWindowLevel = "mainMenu" MacWindowLevelStatus MacWindowLevel = "status" MacWindowLevelPopUpMenu MacWindowLevel = "popUpMenu" MacWindowLevelScreenSaver MacWindowLevel = "screenSaver" )
type Menu ¶
type Menu struct {
// contains filtered or unexported fields
}
func DefaultApplicationMenu ¶
func DefaultApplicationMenu() *Menu
func NewMenuFromItems ¶
func (*Menu) AddSeparator ¶
func (m *Menu) AddSeparator()
func (*Menu) AddSubmenu ¶
func (*Menu) FindByLabel ¶
FindByLabel recursively searches for a menu item with the given label and returns the first match, or nil if not found.
func (*Menu) FindByRole ¶
FindByRole recursively searches for a menu item with the given role and returns the first match, or nil if not found.
func (*Menu) ItemAt ¶
ItemAt returns the menu item at the given index, or nil if the index is out of bounds.
func (*Menu) RemoveMenuItem ¶
type MenuItem ¶
type MenuItem struct {
// contains filtered or unexported fields
}
func NewAboutMenuItem ¶
func NewAboutMenuItem() *MenuItem
func NewAppMenu ¶
func NewAppMenu() *MenuItem
func NewBringAllToFrontMenuItem ¶
func NewBringAllToFrontMenuItem() *MenuItem
func NewCloseMenuItem ¶
func NewCloseMenuItem() *MenuItem
func NewCopyMenuItem ¶
func NewCopyMenuItem() *MenuItem
func NewCutMenuItem ¶
func NewCutMenuItem() *MenuItem
func NewDeleteMenuItem ¶
func NewDeleteMenuItem() *MenuItem
func NewEditMenu ¶
func NewEditMenu() *MenuItem
func NewFileMenu ¶
func NewFileMenu() *MenuItem
func NewFindAndReplaceMenuItem ¶
func NewFindAndReplaceMenuItem() *MenuItem
func NewFindMenuItem ¶
func NewFindMenuItem() *MenuItem
func NewFindNextMenuItem ¶
func NewFindNextMenuItem() *MenuItem
func NewFindPreviousMenuItem ¶
func NewFindPreviousMenuItem() *MenuItem
func NewForceReloadMenuItem ¶
func NewForceReloadMenuItem() *MenuItem
func NewFrontMenuItem ¶
func NewFrontMenuItem() *MenuItem
func NewFullScreenMenuItem ¶
func NewFullScreenMenuItem() *MenuItem
func NewHelpMenu ¶
func NewHelpMenu() *MenuItem
func NewHelpMenuItem ¶
func NewHelpMenuItem() *MenuItem
func NewHideMenuItem ¶
func NewHideMenuItem() *MenuItem
func NewHideOthersMenuItem ¶
func NewHideOthersMenuItem() *MenuItem
func NewMenuItem ¶
func NewMenuItemCheckbox ¶
func NewMenuItemRadio ¶
func NewMenuItemSeparator ¶
func NewMenuItemSeparator() *MenuItem
func NewMinimizeMenuItem ¶
func NewMinimizeMenuItem() *MenuItem
func NewNewFileMenuItem ¶
func NewNewFileMenuItem() *MenuItem
func NewOpenDevToolsMenuItem ¶
func NewOpenDevToolsMenuItem() *MenuItem
func NewOpenMenuItem ¶
func NewOpenMenuItem() *MenuItem
func NewPageLayoutMenuItem ¶
func NewPageLayoutMenuItem() *MenuItem
func NewPasteAndMatchStyleMenuItem ¶
func NewPasteAndMatchStyleMenuItem() *MenuItem
func NewPasteMenuItem ¶
func NewPasteMenuItem() *MenuItem
func NewPrintMenuItem ¶
func NewPrintMenuItem() *MenuItem
func NewQuitMenuItem ¶
func NewQuitMenuItem() *MenuItem
func NewRedoMenuItem ¶
func NewRedoMenuItem() *MenuItem
newRedoMenuItem creates a new menu item for redoing the last action
func NewReloadMenuItem ¶
func NewReloadMenuItem() *MenuItem
func NewRevertMenuItem ¶
func NewRevertMenuItem() *MenuItem
func NewSaveAsMenuItem ¶
func NewSaveAsMenuItem() *MenuItem
func NewSaveMenuItem ¶
func NewSaveMenuItem() *MenuItem
func NewSelectAllMenuItem ¶
func NewSelectAllMenuItem() *MenuItem
func NewServicesMenu ¶
func NewServicesMenu() *MenuItem
func NewShowAllMenuItem ¶
func NewShowAllMenuItem() *MenuItem
func NewSpeechMenu ¶
func NewSpeechMenu() *MenuItem
func NewStartSpeakingMenuItem ¶
func NewStartSpeakingMenuItem() *MenuItem
func NewStopSpeakingMenuItem ¶
func NewStopSpeakingMenuItem() *MenuItem
func NewSubMenuItem ¶
func NewSubmenu ¶
func NewToggleFullscreenMenuItem ¶
func NewToggleFullscreenMenuItem() *MenuItem
func NewUndoMenuItem ¶
func NewUndoMenuItem() *MenuItem
func NewUnhideMenuItem ¶
func NewUnhideMenuItem() *MenuItem
func NewViewMenu ¶
func NewViewMenu() *MenuItem
func NewWindowMenu ¶
func NewWindowMenu() *MenuItem
func NewZoomInMenuItem ¶
func NewZoomInMenuItem() *MenuItem
func NewZoomMenuItem ¶
func NewZoomMenuItem() *MenuItem
func NewZoomOutMenuItem ¶
func NewZoomOutMenuItem() *MenuItem
func NewZoomResetMenuItem ¶
func NewZoomResetMenuItem() *MenuItem
func (*MenuItem) GetAccelerator ¶
func (*MenuItem) GetSubmenu ¶
GetSubmenu returns the submenu of the MenuItem. If the MenuItem is not a submenu, it returns nil.
func (*MenuItem) IsCheckbox ¶
func (*MenuItem) IsSeparator ¶
func (*MenuItem) RemoveAccelerator ¶
func (m *MenuItem) RemoveAccelerator()
func (*MenuItem) SetAccelerator ¶
func (*MenuItem) SetChecked ¶
func (*MenuItem) SetEnabled ¶
func (*MenuItem) SetTooltip ¶
type MessageDialog ¶
type MessageDialog struct { MessageDialogOptions // contains filtered or unexported fields }
func ErrorDialog ¶
func ErrorDialog() *MessageDialog
func InfoDialog ¶
func InfoDialog() *MessageDialog
func QuestionDialog ¶
func QuestionDialog() *MessageDialog
func WarningDialog ¶
func WarningDialog() *MessageDialog
func (*MessageDialog) AddButton ¶
func (d *MessageDialog) AddButton(s string) *Button
func (*MessageDialog) AddButtons ¶
func (d *MessageDialog) AddButtons(buttons []*Button) *MessageDialog
func (*MessageDialog) AttachToWindow ¶
func (d *MessageDialog) AttachToWindow(window Window) *MessageDialog
func (*MessageDialog) SetCancelButton ¶
func (d *MessageDialog) SetCancelButton(button *Button) *MessageDialog
func (*MessageDialog) SetDefaultButton ¶
func (d *MessageDialog) SetDefaultButton(button *Button) *MessageDialog
func (*MessageDialog) SetIcon ¶
func (d *MessageDialog) SetIcon(icon []byte) *MessageDialog
func (*MessageDialog) SetMessage ¶
func (d *MessageDialog) SetMessage(message string) *MessageDialog
func (*MessageDialog) SetTitle ¶
func (d *MessageDialog) SetTitle(title string) *MessageDialog
func (*MessageDialog) Show ¶
func (d *MessageDialog) Show()
type MessageDialogOptions ¶
type MessageDialogOptions struct { DialogType DialogType Title string Message string Buttons []*Button Icon []byte // contains filtered or unexported fields }
type MessageProcessor ¶
type MessageProcessor struct {
// contains filtered or unexported fields
}
func NewMessageProcessor ¶
func NewMessageProcessor(logger *slog.Logger) *MessageProcessor
func (*MessageProcessor) Error ¶
func (m *MessageProcessor) Error(message string, args ...any)
func (*MessageProcessor) HandleRuntimeCallWithIDs ¶
func (m *MessageProcessor) HandleRuntimeCallWithIDs(rw http.ResponseWriter, r *http.Request)
func (*MessageProcessor) Info ¶
func (m *MessageProcessor) Info(message string, args ...any)
func (*MessageProcessor) ServeHTTP ¶
func (m *MessageProcessor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
type Middleware ¶
Middleware defines HTTP middleware that can be applied to the AssetServer. The handler passed as next is the next handler in the chain. One can decide to call the next handler or implement a specialized handling.
func ChainMiddleware ¶
func ChainMiddleware(middleware ...Middleware) Middleware
ChainMiddleware allows chaining multiple middlewares to one middleware.
type OpenFileDialogOptions ¶
type OpenFileDialogOptions struct { CanChooseDirectories bool CanChooseFiles bool CanCreateDirectories bool ShowHiddenFiles bool ResolvesAliases bool AllowsMultipleSelection bool HideExtension bool CanSelectHiddenExtension bool TreatsFilePackagesAsDirectories bool AllowsOtherFileTypes bool Filters []FileFilter Window *WebviewWindow Title string Message string ButtonText string Directory string }
type OpenFileDialogStruct ¶
type OpenFileDialogStruct struct {
// contains filtered or unexported fields
}
func OpenFileDialog ¶
func OpenFileDialog() *OpenFileDialogStruct
func OpenFileDialogWithOptions ¶
func OpenFileDialogWithOptions(options *OpenFileDialogOptions) *OpenFileDialogStruct
func (*OpenFileDialogStruct) AddFilter ¶
func (d *OpenFileDialogStruct) AddFilter(displayName, pattern string) *OpenFileDialogStruct
AddFilter adds a filter to the dialog. The filter is a display name and a semicolon separated list of extensions. EG: AddFilter("Image Files", "*.jpg;*.png")
func (*OpenFileDialogStruct) AllowsOtherFileTypes ¶
func (d *OpenFileDialogStruct) AllowsOtherFileTypes(allowsOtherFileTypes bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) AttachToWindow ¶
func (d *OpenFileDialogStruct) AttachToWindow(window Window) *OpenFileDialogStruct
func (*OpenFileDialogStruct) CanChooseDirectories ¶
func (d *OpenFileDialogStruct) CanChooseDirectories(canChooseDirectories bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) CanChooseFiles ¶
func (d *OpenFileDialogStruct) CanChooseFiles(canChooseFiles bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) CanCreateDirectories ¶
func (d *OpenFileDialogStruct) CanCreateDirectories(canCreateDirectories bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) CanSelectHiddenExtension ¶
func (d *OpenFileDialogStruct) CanSelectHiddenExtension(canSelectHiddenExtension bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) HideExtension ¶
func (d *OpenFileDialogStruct) HideExtension(hideExtension bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) PromptForMultipleSelection ¶
func (d *OpenFileDialogStruct) PromptForMultipleSelection() ([]string, error)
func (*OpenFileDialogStruct) PromptForSingleSelection ¶
func (d *OpenFileDialogStruct) PromptForSingleSelection() (string, error)
func (*OpenFileDialogStruct) ResolvesAliases ¶
func (d *OpenFileDialogStruct) ResolvesAliases(resolvesAliases bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) SetButtonText ¶
func (d *OpenFileDialogStruct) SetButtonText(text string) *OpenFileDialogStruct
func (*OpenFileDialogStruct) SetDirectory ¶
func (d *OpenFileDialogStruct) SetDirectory(directory string) *OpenFileDialogStruct
func (*OpenFileDialogStruct) SetMessage ¶
func (d *OpenFileDialogStruct) SetMessage(message string) *OpenFileDialogStruct
func (*OpenFileDialogStruct) SetOptions ¶
func (d *OpenFileDialogStruct) SetOptions(options *OpenFileDialogOptions)
func (*OpenFileDialogStruct) SetTitle ¶
func (d *OpenFileDialogStruct) SetTitle(title string) *OpenFileDialogStruct
func (*OpenFileDialogStruct) ShowHiddenFiles ¶
func (d *OpenFileDialogStruct) ShowHiddenFiles(showHiddenFiles bool) *OpenFileDialogStruct
func (*OpenFileDialogStruct) TreatsFilePackagesAsDirectories ¶
func (d *OpenFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *OpenFileDialogStruct
type Options ¶
type Options struct { // Name is the name of the application (used in the default about box) Name string // Description is the description of the application (used in the default about box) Description string // Icon is the icon of the application (used in the default about box) Icon []byte // Mac is the Mac specific configuration for Mac builds Mac MacOptions // Windows is the Windows specific configuration for Windows builds Windows WindowsOptions // Linux is the Linux specific configuration for Linux builds Linux LinuxOptions // Services allows you to bind Go methods to the frontend. Services []Service // BindAliases allows you to specify alias IDs for your bound methods. // Example: `BindAliases: map[uint32]uint32{1: 1411160069}` states that alias ID 1 maps to the Go method with ID 1411160069. BindAliases map[uint32]uint32 // Logger i a slog.Logger instance used for logging Wails system messages (not application messages). // If not defined, a default logger is used. Logger *slog.Logger // LogLevel defines the log level of the Wails system logger. LogLevel slog.Level // Assets are the application assets to be used. Assets AssetOptions // Flags are key value pairs that are available to the frontend. // This is also used by Wails to provide information to the frontend. Flags map[string]any // PanicHandler is called when a panic occurs PanicHandler func(any) // DisableDefaultSignalHandler disables the default signal handler DisableDefaultSignalHandler bool // KeyBindings is a map of key bindings to functions KeyBindings map[string]func(window *WebviewWindow) // OnShutdown is called when the application is about to terminate. // This is useful for cleanup tasks. // The shutdown process blocks until this function returns OnShutdown func() // ShouldQuit is a function that is called when the user tries to quit the application. // If the function returns true, the application will quit. // If the function returns false, the application will not quit. ShouldQuit func() bool // RawMessageHandler is called when the frontend sends a raw message. // This is useful for implementing custom frontend-to-backend communication. RawMessageHandler func(window Window, message string) // ErrorHandler is called when an error occurs ErrorHandler func(err error) // contains filtered or unexported fields }
Options contains the options for the application
type Parameter ¶
type Parameter struct { Name string `json:"name,omitempty"` TypeName string `json:"type"` ReflectType reflect.Type }
Parameter defines a Go method parameter
type PluginCallOptions ¶
type PluginCallOptions struct { Name string `json:"name"` Args []json.RawMessage `json:"args"` }
type PositionOptions ¶
type PositionOptions struct {
Buffer int
}
type QueryParams ¶
func (QueryParams) Args ¶
func (qp QueryParams) Args() (*Args, error)
func (QueryParams) Bool ¶
func (qp QueryParams) Bool(key string) *bool
func (QueryParams) Float64 ¶
func (qp QueryParams) Float64(key string) *float64
func (QueryParams) Int ¶
func (qp QueryParams) Int(key string) *int
func (QueryParams) String ¶
func (qp QueryParams) String(key string) *string
func (QueryParams) ToStruct ¶
func (qp QueryParams) ToStruct(str any) error
func (QueryParams) UInt ¶
func (qp QueryParams) UInt(key string) *uint
func (QueryParams) UInt8 ¶
func (qp QueryParams) UInt8(key string) *uint8
type Role ¶
type Role uint
Role is a type to identify menu roles
const ( NoRole Role = iota AppMenu Role = iota EditMenu Role = iota ViewMenu Role = iota WindowMenu Role = iota ServicesMenu Role = iota HelpMenu Role = iota Hide Role = iota HideOthers Role = iota ShowAll Role = iota BringAllToFront Role = iota UnHide Role = iota About Role = iota Undo Role = iota Redo Role = iota Cut Role = iota Copy Role = iota Paste Role = iota PasteAndMatchStyle Role = iota SelectAll Role = iota Delete Role = iota SpeechMenu Role = iota Quit Role = iota FileMenu Role = iota CloseWindow Role = iota Reload Role = iota ForceReload Role = iota OpenDevTools Role = iota ResetZoom Role = iota ZoomIn Role = iota ZoomOut Role = iota ToggleFullscreen Role = iota Minimize Role = iota Zoom Role = iota FullScreen Role = iota NewFile Role = iota Open Role = iota Save Role = iota SaveAs Role = iota StartSpeaking Role = iota StopSpeaking Role = iota Revert Role = iota Print Role = iota PageLayout Role = iota Find Role = iota FindAndReplace Role = iota FindNext Role = iota FindPrevious Role = iota Front Role = iota Help Role = iota )
These constants need to be kept in sync with `v2/internal/frontend/desktop/darwin/Role.h`
type SaveFileDialogOptions ¶
type SaveFileDialogOptions struct { CanCreateDirectories bool ShowHiddenFiles bool CanSelectHiddenExtension bool AllowOtherFileTypes bool HideExtension bool TreatsFilePackagesAsDirectories bool Title string Message string Directory string Filename string ButtonText string Filters []FileFilter Window *WebviewWindow }
type SaveFileDialogStruct ¶
type SaveFileDialogStruct struct {
// contains filtered or unexported fields
}
func SaveFileDialog ¶
func SaveFileDialog() *SaveFileDialogStruct
func SaveFileDialogWithOptions ¶
func SaveFileDialogWithOptions(s *SaveFileDialogOptions) *SaveFileDialogStruct
func (*SaveFileDialogStruct) AddFilter ¶
func (d *SaveFileDialogStruct) AddFilter(displayName, pattern string) *SaveFileDialogStruct
AddFilter adds a filter to the dialog. The filter is a display name and a semicolon separated list of extensions. EG: AddFilter("Image Files", "*.jpg;*.png")
func (*SaveFileDialogStruct) AllowsOtherFileTypes ¶
func (d *SaveFileDialogStruct) AllowsOtherFileTypes(allowOtherFileTypes bool) *SaveFileDialogStruct
func (*SaveFileDialogStruct) AttachToWindow ¶
func (d *SaveFileDialogStruct) AttachToWindow(window Window) *SaveFileDialogStruct
func (*SaveFileDialogStruct) CanCreateDirectories ¶
func (d *SaveFileDialogStruct) CanCreateDirectories(canCreateDirectories bool) *SaveFileDialogStruct
func (*SaveFileDialogStruct) CanSelectHiddenExtension ¶
func (d *SaveFileDialogStruct) CanSelectHiddenExtension(canSelectHiddenExtension bool) *SaveFileDialogStruct
func (*SaveFileDialogStruct) HideExtension ¶
func (d *SaveFileDialogStruct) HideExtension(hideExtension bool) *SaveFileDialogStruct
func (*SaveFileDialogStruct) PromptForSingleSelection ¶
func (d *SaveFileDialogStruct) PromptForSingleSelection() (string, error)
func (*SaveFileDialogStruct) SetButtonText ¶
func (d *SaveFileDialogStruct) SetButtonText(text string) *SaveFileDialogStruct
func (*SaveFileDialogStruct) SetDirectory ¶
func (d *SaveFileDialogStruct) SetDirectory(directory string) *SaveFileDialogStruct
func (*SaveFileDialogStruct) SetFilename ¶
func (d *SaveFileDialogStruct) SetFilename(filename string) *SaveFileDialogStruct
func (*SaveFileDialogStruct) SetMessage ¶
func (d *SaveFileDialogStruct) SetMessage(message string) *SaveFileDialogStruct
func (*SaveFileDialogStruct) SetOptions ¶
func (d *SaveFileDialogStruct) SetOptions(options *SaveFileDialogOptions)
func (*SaveFileDialogStruct) ShowHiddenFiles ¶
func (d *SaveFileDialogStruct) ShowHiddenFiles(showHiddenFiles bool) *SaveFileDialogStruct
func (*SaveFileDialogStruct) TreatsFilePackagesAsDirectories ¶
func (d *SaveFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *SaveFileDialogStruct
type Screen ¶
type Screen struct { ID string // A unique identifier for the display Name string // The name of the display Scale float32 // The scale factor of the display X int // The x-coordinate of the top-left corner of the rectangle Y int // The y-coordinate of the top-left corner of the rectangle Size Size // The size of the display Bounds Rect // The bounds of the display WorkArea Rect // The work area of the display IsPrimary bool // Whether this is the primary display Rotation float32 // The rotation of the display }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service wraps a bound type instance. The zero value of Service is invalid. Valid values may only be obtained by calling NewService.
func NewService ¶
func NewService[T any](instance *T, options ...ServiceOptions) Service
NewService returns a Service value wrapping the given pointer. If T is not a named type, the returned value is invalid. The prefix is used if Service implements a http.Handler only one allowed
type ServiceName ¶
type ServiceName interface {
Name() string
}
type ServiceOptions ¶
type ServiceShutdown ¶
type ServiceShutdown interface {
OnShutdown() error
}
type ServiceStartup ¶
type ServiceStartup interface {
OnStartup(ctx context.Context, options ServiceOptions) error
}
type SystemTray ¶
type SystemTray struct {
// contains filtered or unexported fields
}
func (*SystemTray) AttachWindow ¶
func (s *SystemTray) AttachWindow(window *WebviewWindow) *SystemTray
AttachWindow attaches a window to the system tray. The window will be shown when the system tray icon is clicked. The window will be hidden when the system tray icon is clicked again, or when the window loses focus.
func (*SystemTray) Destroy ¶
func (s *SystemTray) Destroy()
func (*SystemTray) Label ¶
func (s *SystemTray) Label() string
func (*SystemTray) OnClick ¶
func (s *SystemTray) OnClick(handler func()) *SystemTray
func (*SystemTray) OnDoubleClick ¶
func (s *SystemTray) OnDoubleClick(handler func()) *SystemTray
func (*SystemTray) OnMouseEnter ¶
func (s *SystemTray) OnMouseEnter(handler func()) *SystemTray
func (*SystemTray) OnMouseLeave ¶
func (s *SystemTray) OnMouseLeave(handler func()) *SystemTray
func (*SystemTray) OnRightClick ¶
func (s *SystemTray) OnRightClick(handler func()) *SystemTray
func (*SystemTray) OnRightDoubleClick ¶
func (s *SystemTray) OnRightDoubleClick(handler func()) *SystemTray
func (*SystemTray) OpenMenu ¶
func (s *SystemTray) OpenMenu()
func (*SystemTray) PositionWindow ¶
func (s *SystemTray) PositionWindow(window *WebviewWindow, offset int) error
func (*SystemTray) Run ¶
func (s *SystemTray) Run()
func (*SystemTray) SetDarkModeIcon ¶
func (s *SystemTray) SetDarkModeIcon(icon []byte) *SystemTray
func (*SystemTray) SetIcon ¶
func (s *SystemTray) SetIcon(icon []byte) *SystemTray
func (*SystemTray) SetIconPosition ¶
func (s *SystemTray) SetIconPosition(iconPosition int) *SystemTray
func (*SystemTray) SetLabel ¶
func (s *SystemTray) SetLabel(label string)
func (*SystemTray) SetMenu ¶
func (s *SystemTray) SetMenu(menu *Menu) *SystemTray
func (*SystemTray) SetTemplateIcon ¶
func (s *SystemTray) SetTemplateIcon(icon []byte) *SystemTray
func (*SystemTray) WindowDebounce ¶
func (s *SystemTray) WindowDebounce(debounce time.Duration) *SystemTray
WindowDebounce is used by Windows to indicate how long to wait before responding to a mouse up event on the notification icon. This prevents the window from being hidden and then immediately shown when the user clicks on the system tray icon. See https://stackoverflow.com/questions/4585283/alternate-showing-hiding-window-when-notify-icon-is-clicked
func (*SystemTray) WindowOffset ¶
func (s *SystemTray) WindowOffset(offset int) *SystemTray
WindowOffset sets the gap in pixels between the system tray and the window
type ThemeSettings ¶
type ThemeSettings struct { DarkModeTitleBar int32 DarkModeTitleBarInactive int32 DarkModeTitleText int32 DarkModeTitleTextInactive int32 DarkModeBorder int32 DarkModeBorderInactive int32 LightModeTitleBar int32 LightModeTitleBarInactive int32 LightModeTitleText int32 LightModeTitleTextInactive int32 LightModeBorder int32 LightModeBorderInactive int32 }
ThemeSettings defines custom colours to use in dark or light mode. They may be set using the hex values: 0x00BBGGRR
type WailsEventListener ¶
type WailsEventListener interface {
DispatchWailsEvent(event *CustomEvent)
}
WailsEventListener is an interface that can be implemented to listen for Wails events It is used by the RegisterListener method of the Application.
type WebviewGpuPolicy ¶
type WebviewGpuPolicy int
WebviewGpuPolicy values used for determining the webview's hardware acceleration policy.
const ( // WebviewGpuPolicyAlways Hardware acceleration is always enabled. WebviewGpuPolicyAlways WebviewGpuPolicy = iota // WebviewGpuPolicyOnDemand Hardware acceleration is enabled/disabled as request by web contents. WebviewGpuPolicyOnDemand // WebviewGpuPolicyNever Hardware acceleration is always disabled. WebviewGpuPolicyNever )
type WebviewWindow ¶
type WebviewWindow struct {
// contains filtered or unexported fields
}
func NewWindow ¶
func NewWindow(options WebviewWindowOptions) *WebviewWindow
NewWindow creates a new window with the given options
func (*WebviewWindow) CallError ¶
func (w *WebviewWindow) CallError(callID string, result string)
func (*WebviewWindow) CallResponse ¶
func (w *WebviewWindow) CallResponse(callID string, result string)
func (*WebviewWindow) Center ¶
func (w *WebviewWindow) Center()
Center centers the window on the screen
func (*WebviewWindow) Destroy ¶
func (w *WebviewWindow) Destroy()
func (*WebviewWindow) DialogError ¶
func (w *WebviewWindow) DialogError(dialogID string, result string)
func (*WebviewWindow) DialogResponse ¶
func (w *WebviewWindow) DialogResponse(dialogID string, result string, isJSON bool)
func (*WebviewWindow) DisableSizeConstraints ¶
func (w *WebviewWindow) DisableSizeConstraints()
func (*WebviewWindow) DispatchWailsEvent ¶
func (w *WebviewWindow) DispatchWailsEvent(event *CustomEvent)
func (*WebviewWindow) EmitEvent ¶
func (w *WebviewWindow) EmitEvent(name string, data ...any)
EmitEvent emits an event from the window
func (*WebviewWindow) EnableSizeConstraints ¶
func (w *WebviewWindow) EnableSizeConstraints()
func (*WebviewWindow) Error ¶
func (w *WebviewWindow) Error(message string, args ...any)
func (*WebviewWindow) ExecJS ¶
func (w *WebviewWindow) ExecJS(js string)
ExecJS executes the given javascript in the context of the window.
func (*WebviewWindow) Flash ¶
func (w *WebviewWindow) Flash(enabled bool)
Flash flashes the window's taskbar button/icon. Useful to indicate that attention is required. Windows only.
func (*WebviewWindow) Focus ¶
func (w *WebviewWindow) Focus()
func (*WebviewWindow) ForceReload ¶
func (w *WebviewWindow) ForceReload()
ForceReload forces the window to reload the page assets
func (*WebviewWindow) Fullscreen ¶
func (w *WebviewWindow) Fullscreen() Window
Fullscreen sets the window to fullscreen mode. Min/Max size constraints are disabled.
func (*WebviewWindow) GetBorderSizes ¶
func (w *WebviewWindow) GetBorderSizes() *LRTB
func (*WebviewWindow) GetScreen ¶
func (w *WebviewWindow) GetScreen() (*Screen, error)
GetScreen returns the screen that the window is on
func (*WebviewWindow) GetZoom ¶
func (w *WebviewWindow) GetZoom() float64
GetZoom returns the current zoom level of the window.
func (*WebviewWindow) HandleDragAndDropMessage ¶
func (w *WebviewWindow) HandleDragAndDropMessage(filenames []string)
func (*WebviewWindow) HandleKeyEvent ¶
func (w *WebviewWindow) HandleKeyEvent(acceleratorString string)
func (*WebviewWindow) HandleMessage ¶
func (w *WebviewWindow) HandleMessage(message string)
func (*WebviewWindow) HandleWindowEvent ¶
func (w *WebviewWindow) HandleWindowEvent(id uint)
func (*WebviewWindow) Height ¶
func (w *WebviewWindow) Height() int
Height returns the height of the window
func (*WebviewWindow) ID ¶
func (w *WebviewWindow) ID() uint
func (*WebviewWindow) Info ¶
func (w *WebviewWindow) Info(message string, args ...any)
func (*WebviewWindow) IsFocused ¶
func (w *WebviewWindow) IsFocused() bool
IsFocused returns true if the window is currently focused
func (*WebviewWindow) IsFullscreen ¶
func (w *WebviewWindow) IsFullscreen() bool
IsFullscreen returns true if the window is fullscreen
func (*WebviewWindow) IsIgnoreMouseEvents ¶
func (w *WebviewWindow) IsIgnoreMouseEvents() bool
func (*WebviewWindow) IsMaximised ¶
func (w *WebviewWindow) IsMaximised() bool
IsMaximised returns true if the window is maximised
func (*WebviewWindow) IsMinimised ¶
func (w *WebviewWindow) IsMinimised() bool
IsMinimised returns true if the window is minimised
func (*WebviewWindow) IsVisible ¶
func (w *WebviewWindow) IsVisible() bool
IsVisible returns true if the window is visible
func (*WebviewWindow) Maximise ¶
func (w *WebviewWindow) Maximise() Window
Maximise maximises the window. Min/Max size constraints are disabled.
func (*WebviewWindow) Minimise ¶
func (w *WebviewWindow) Minimise() Window
Minimise minimises the window.
func (*WebviewWindow) Name ¶
func (w *WebviewWindow) Name() string
Name returns the name of the window
func (*WebviewWindow) NativeWindowHandle ¶
func (w *WebviewWindow) NativeWindowHandle() (uintptr, error)
NativeWindowHandle returns the platform native window handle for the window.
func (*WebviewWindow) OnWindowEvent ¶
func (w *WebviewWindow) OnWindowEvent(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
OnWindowEvent registers a callback for the given window event
func (*WebviewWindow) OpenContextMenu ¶
func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData)
func (*WebviewWindow) OpenDevTools ¶
func (w *WebviewWindow) OpenDevTools()
func (*WebviewWindow) Position ¶
func (w *WebviewWindow) Position() (int, int)
Position returns the absolute position of the window to the screen
func (*WebviewWindow) Print ¶
func (w *WebviewWindow) Print() error
func (*WebviewWindow) RegisterContextMenu ¶
func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu)
RegisterContextMenu registers a context menu and assigns it the given name.
func (*WebviewWindow) RegisterHook ¶
func (w *WebviewWindow) RegisterHook(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
RegisterHook registers a hook for the given window event
func (*WebviewWindow) RelativePosition ¶
func (w *WebviewWindow) RelativePosition() (int, int)
RelativePosition returns the relative position of the window to the screen
func (*WebviewWindow) Resizable ¶
func (w *WebviewWindow) Resizable() bool
Resizable returns true if the window is resizable.
func (*WebviewWindow) Restore ¶
func (w *WebviewWindow) Restore()
Restore restores the window to its previous state if it was previously minimised, maximised or fullscreen.
func (*WebviewWindow) Run ¶
func (w *WebviewWindow) Run()
func (*WebviewWindow) SetAlwaysOnTop ¶
func (w *WebviewWindow) SetAlwaysOnTop(b bool) Window
SetAlwaysOnTop sets the window to be always on top.
func (*WebviewWindow) SetBackgroundColour ¶
func (w *WebviewWindow) SetBackgroundColour(colour RGBA) Window
SetBackgroundColour sets the background colour of the window
func (*WebviewWindow) SetCloseButtonState ¶
func (w *WebviewWindow) SetCloseButtonState(state ButtonState) Window
func (*WebviewWindow) SetEnabled ¶
func (w *WebviewWindow) SetEnabled(enabled bool)
func (*WebviewWindow) SetFrameless ¶
func (w *WebviewWindow) SetFrameless(frameless bool) Window
SetFrameless removes the window frame and title bar
func (*WebviewWindow) SetHTML ¶
func (w *WebviewWindow) SetHTML(html string) Window
SetHTML sets the HTML of the window to the given html string.
func (*WebviewWindow) SetIgnoreMouseEvents ¶
func (w *WebviewWindow) SetIgnoreMouseEvents(ignore bool) Window
func (*WebviewWindow) SetMaxSize ¶
func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) Window
SetMaxSize sets the maximum size of the window.
func (*WebviewWindow) SetMaximiseButtonState ¶
func (w *WebviewWindow) SetMaximiseButtonState(state ButtonState) Window
func (*WebviewWindow) SetMinSize ¶
func (w *WebviewWindow) SetMinSize(minWidth, minHeight int) Window
SetMinSize sets the minimum size of the window.
func (*WebviewWindow) SetMinimiseButtonState ¶
func (w *WebviewWindow) SetMinimiseButtonState(state ButtonState) Window
func (*WebviewWindow) SetPosition ¶
func (w *WebviewWindow) SetPosition(x int, y int)
func (*WebviewWindow) SetRelativePosition ¶
func (w *WebviewWindow) SetRelativePosition(x, y int) Window
SetRelativePosition sets the position of the window.
func (*WebviewWindow) SetResizable ¶
func (w *WebviewWindow) SetResizable(b bool) Window
SetResizable sets whether the window is resizable.
func (*WebviewWindow) SetSize ¶
func (w *WebviewWindow) SetSize(width, height int) Window
SetSize sets the size of the window
func (*WebviewWindow) SetTitle ¶
func (w *WebviewWindow) SetTitle(title string) Window
SetTitle sets the title of the window
func (*WebviewWindow) SetURL ¶
func (w *WebviewWindow) SetURL(s string) Window
func (*WebviewWindow) SetZoom ¶
func (w *WebviewWindow) SetZoom(magnification float64) Window
SetZoom sets the zoom level of the window.
func (*WebviewWindow) Size ¶
func (w *WebviewWindow) Size() (int, int)
Size returns the size of the window
func (*WebviewWindow) ToggleFullscreen ¶
func (w *WebviewWindow) ToggleFullscreen()
ToggleFullscreen toggles the window between fullscreen and normal
func (*WebviewWindow) ToggleMaximise ¶
func (w *WebviewWindow) ToggleMaximise()
ToggleMaximise toggles the window between maximised and normal
func (*WebviewWindow) UnFullscreen ¶
func (w *WebviewWindow) UnFullscreen()
UnFullscreen un-fullscreens the window.
func (*WebviewWindow) UnMaximise ¶
func (w *WebviewWindow) UnMaximise()
UnMaximise un-maximises the window.
func (*WebviewWindow) UnMinimise ¶
func (w *WebviewWindow) UnMinimise()
UnMinimise un-minimises the window. Min/Max size constraints are re-enabled.
func (*WebviewWindow) Width ¶
func (w *WebviewWindow) Width() int
Width returns the width of the window
func (*WebviewWindow) Zoom ¶
func (w *WebviewWindow) Zoom()
func (*WebviewWindow) ZoomIn ¶
func (w *WebviewWindow) ZoomIn()
ZoomIn increases the zoom level of the webview content
func (*WebviewWindow) ZoomOut ¶
func (w *WebviewWindow) ZoomOut()
ZoomOut decreases the zoom level of the webview content
func (*WebviewWindow) ZoomReset ¶
func (w *WebviewWindow) ZoomReset() Window
ZoomReset resets the zoom level of the webview content to 100%
type WebviewWindowOptions ¶
type WebviewWindowOptions struct { // Name is a unique identifier that can be given to a window. Name string // Title is the title of the window. Title string // Width is the starting width of the window. Width int // Height is the starting height of the window. Height int // AlwaysOnTop will make the window float above other windows. AlwaysOnTop bool // URL is the URL to load in the window. URL string // DisableResize will disable the ability to resize the window. DisableResize bool // Frameless will remove the window frame. Frameless bool // MinWidth is the minimum width of the window. MinWidth int // MinHeight is the minimum height of the window. MinHeight int // MaxWidth is the maximum width of the window. MaxWidth int // MaxHeight is the maximum height of the window. MaxHeight int // StartState indicates the state of the window when it is first shown. // Default: WindowStateNormal StartState WindowState // Centered will center the window on the screen. Centered bool // BackgroundType is the type of background to use for the window. // Default: BackgroundTypeSolid BackgroundType BackgroundType // BackgroundColour is the colour to use for the window background. BackgroundColour RGBA // HTML is the HTML to load in the window. HTML string // JS is the JavaScript to load in the window. JS string // CSS is the CSS to load in the window. CSS string // X is the starting X position of the window. X int // Y is the starting Y position of the window. Y int // TransparentTitlebar will make the titlebar transparent. // TODO: Move to mac window options FullscreenButtonEnabled bool // Hidden will hide the window when it is first created. Hidden bool // Zoom is the zoom level of the window. Zoom float64 // ZoomControlEnabled will enable the zoom control. ZoomControlEnabled bool // EnableDragAndDrop will enable drag and drop. EnableDragAndDrop bool // OpenInspectorOnStartup will open the inspector when the window is first shown. OpenInspectorOnStartup bool // Mac options Mac MacWindow // Windows options Windows WindowsWindow // Linux options Linux LinuxWindow // Toolbar button states MinimiseButtonState ButtonState MaximiseButtonState ButtonState CloseButtonState ButtonState // ShouldClose is called when the window is about to close. // Return true to allow the window to close, or false to prevent it from closing. ShouldClose func(window *WebviewWindow) bool // If true, the window's devtools will be available (default true in builds without the `production` build tag) DevToolsEnabled bool // If true, the window's default context menu will be disabled (default false) DefaultContextMenuDisabled bool // KeyBindings is a map of key bindings to functions KeyBindings map[string]func(window *WebviewWindow) // IgnoreMouseEvents will ignore mouse events in the window (Windows + Mac only) IgnoreMouseEvents bool }
type Window ¶
type Window interface { Callback Center() Close() Destroy() DisableSizeConstraints() DispatchWailsEvent(event *CustomEvent) EmitEvent(name string, data ...any) EnableSizeConstraints() Error(message string, args ...any) ExecJS(js string) Focus() ForceReload() Fullscreen() Window GetBorderSizes() *LRTB GetScreen() (*Screen, error) GetZoom() float64 HandleDragAndDropMessage(filenames []string) HandleMessage(message string) HandleWindowEvent(id uint) Height() int Hide() Window ID() uint Info(message string, args ...any) IsFocused() bool IsFullscreen() bool IsIgnoreMouseEvents() bool IsMaximised() bool IsMinimised() bool HandleKeyEvent(acceleratorString string) Maximise() Window Minimise() Window Name() string OnWindowEvent(eventType events.WindowEventType, callback func(event *WindowEvent)) func() OpenContextMenu(data *ContextMenuData) Position() (int, int) RegisterContextMenu(name string, menu *Menu) RelativePosition() (int, int) Reload() Resizable() bool Restore() Run() SetPosition(x, y int) SetAlwaysOnTop(b bool) Window SetBackgroundColour(colour RGBA) Window SetFrameless(frameless bool) Window SetHTML(html string) Window SetMinimiseButtonState(state ButtonState) Window SetMaximiseButtonState(state ButtonState) Window SetCloseButtonState(state ButtonState) Window SetMaxSize(maxWidth, maxHeight int) Window SetMinSize(minWidth, minHeight int) Window SetRelativePosition(x, y int) Window SetResizable(b bool) Window SetIgnoreMouseEvents(ignore bool) Window SetSize(width, height int) Window SetTitle(title string) Window SetURL(s string) Window SetZoom(magnification float64) Window Show() Window Size() (width int, height int) OpenDevTools() ToggleFullscreen() ToggleMaximise() UnFullscreen() UnMaximise() UnMinimise() Width() int Zoom() ZoomIn() ZoomOut() ZoomReset() Window }
type WindowAttachConfig ¶
type WindowAttachConfig struct { // Window is the window to attach to the system tray. If it's null, the request to attach will be ignored. Window *WebviewWindow // Offset indicates the gap in pixels between the system tray and the window Offset int // Debounce is used by Windows to indicate how long to wait before responding to a mouse // up event on the notification icon. See https://stackoverflow.com/questions/4585283/alternate-showing-hiding-window-when-notify-icon-is-clicked Debounce time.Duration // contains filtered or unexported fields }
type WindowEvent ¶
type WindowEvent struct { Cancelled bool // contains filtered or unexported fields }
func NewWindowEvent ¶
func NewWindowEvent() *WindowEvent
func (*WindowEvent) Cancel ¶
func (w *WindowEvent) Cancel()
func (*WindowEvent) Context ¶
func (w *WindowEvent) Context() *WindowEventContext
type WindowEventContext ¶
type WindowEventContext struct {
// contains filtered or unexported fields
}
func (WindowEventContext) DroppedFiles ¶
func (c WindowEventContext) DroppedFiles() []string
type WindowEventListener ¶
type WindowEventListener struct {
// contains filtered or unexported fields
}
type WindowState ¶
type WindowState int
const ( WindowStateNormal WindowState = iota WindowStateMinimised WindowStateMaximised WindowStateFullscreen )
type WindowsOptions ¶
type WindowsOptions struct { // Window class name // Default: WailsWebviewWindow WndClass string // WndProcInterceptor is a function that will be called for every message sent in the application. // Use this to hook into the main message loop. This is useful for handling custom window messages. // If `shouldReturn` is `true` then `returnCode` will be returned by the main message loop. // If `shouldReturn` is `false` then returnCode will be ignored and the message will be processed by the main message loop. WndProcInterceptor func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (returnCode uintptr, shouldReturn bool) // DisableQuitOnLastWindowClosed disables the auto quit of the application if the last window has been closed. DisableQuitOnLastWindowClosed bool // Path where the WebView2 stores the user data. If empty %APPDATA%\[BinaryName.exe] will be used. // If the path is not valid, a messagebox will be displayed with the error and the app will exit with error code. WebviewUserDataPath string // Path to the directory with WebView2 executables. If empty WebView2 installed in the system will be used. WebviewBrowserPath string }
WindowsOptions contains options for Windows applications.
type WindowsWindow ¶
type WindowsWindow struct { // Select the type of translucent backdrop. Requires Windows 11 22621 or later. // Only used when window's `BackgroundType` is set to `BackgroundTypeTranslucent`. // Default: Auto BackdropType BackdropType // Disable the icon in the titlebar // Default: false DisableIcon bool // Theme (Dark / Light / SystemDefault) // Default: SystemDefault - The application will follow system theme changes. Theme Theme // Specify custom colours to use for dark/light mode // Default: nil CustomTheme *ThemeSettings // Disable all window decorations in Frameless mode, which means no "Aero Shadow" and no "Rounded Corner" will be shown. // "Rounded Corners" are only available on Windows 11. // Default: false DisableFramelessWindowDecorations bool // WindowMask is used to set the window shape. Use a PNG with an alpha channel to create a custom shape. // Default: nil WindowMask []byte // WindowMaskDraggable is used to make the window draggable by clicking on the window mask. // Default: false WindowMaskDraggable bool // WebviewGpuIsDisabled is used to enable / disable GPU acceleration for the webview // Default: false WebviewGpuIsDisabled bool // ResizeDebounceMS is the amount of time to debounce redraws of webview2 // when resizing the window // Default: 0 ResizeDebounceMS uint16 // Disable the menu bar for this window // Default: false DisableMenu bool // Event mapping for the window. This allows you to define a translation from one event to another. // Default: nil EventMapping map[events.WindowEventType]events.WindowEventType // HiddenOnTaskbar hides the window from the taskbar // Default: false HiddenOnTaskbar bool // EnableSwipeGestures enables swipe gestures for the window // Default: false EnableSwipeGestures bool // EnableFraudulentWebsiteWarnings will enable warnings for fraudulent websites. // Default: false EnableFraudulentWebsiteWarnings bool // Menu is the menu to use for the window. Menu *Menu // Drag Cursor Effects OnEnterEffect DragEffect OnOverEffect DragEffect // Permissions map for WebView2. If empty, default permissions will be granted. Permissions map[CoreWebView2PermissionKind]CoreWebView2PermissionState // ExStyle is the extended window style ExStyle int }
Source Files ¶
- application.go
- application_debug.go
- application_dev.go
- application_linux.go
- application_options.go
- bindings.go
- clipboard.go
- clipboard_linux.go
- context.go
- context_application_event.go
- context_window_event.go
- dialogs.go
- dialogs_linux.go
- environment.go
- errors.go
- events.go
- events_common_linux.go
- image.go
- keys.go
- keys_linux.go
- linux_cgo.go
- logger_dev.go
- mainthread.go
- mainthread_linux.go
- menu.go
- menu_linux.go
- menuitem.go
- menuitem_dev.go
- menuitem_linux.go
- menuitem_roles.go
- messageprocessor.go
- messageprocessor_application.go
- messageprocessor_browser.go
- messageprocessor_call.go
- messageprocessor_clipboard.go
- messageprocessor_contextmenu.go
- messageprocessor_dialog.go
- messageprocessor_events.go
- messageprocessor_params.go
- messageprocessor_screens.go
- messageprocessor_system.go
- messageprocessor_window.go
- roles.go
- roles_dev.go
- screen.go
- screen_linux.go
- services.go
- systemtray.go
- systemtray_linux.go
- webview_window.go
- webview_window_linux.go
- webview_window_linux_dev.go
- webview_window_options.go
- window.go