application

package
v3.0.0-...-2742eba Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	NSImageNone = iota
	NSImageOnly
	NSImageLeft
	NSImageRight
	NSImageBelow
	NSImageAbove
	NSImageOverlaps
	NSImageLeading
	NSImageTrailing
)

Variables

View Source
var DefaultApplicationIcon = []byte{} /* 923 elements not displayed */
View Source
var DefaultMacTemplateIcon = []byte{} /* 760 elements not displayed */
View Source
var MacTitleBarDefault = MacTitleBar{
	AppearsTransparent:   false,
	Hide:                 false,
	HideTitle:            false,
	FullSizeContent:      false,
	UseToolbar:           false,
	HideToolbarSeparator: false,
}

MacTitleBarDefault results in the default Mac MacTitleBar

View Source
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.

View Source
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.

View Source
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.

View Source
var WailsLogoBlack = []byte{} /* 5109 elements not displayed */
View Source
var WailsLogoBlackTransparent = []byte{} /* 4526 elements not displayed */
View Source
var WailsLogoWhite = []byte{} /* 5233 elements not displayed */
View Source
var WailsLogoWhiteTransparent = []byte{} /* 4454 elements not displayed */
View Source
var WebviewWindowDefaults = &WebviewWindowOptions{
	Title:  "",
	Width:  800,
	Height: 600,
	URL:    "",
}

Functions

func Fatal

func Fatal(message string, args ...interface{})

Types

type ActivationPolicy

type ActivationPolicy int
const (
	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

	Events *EventProcessor
	// contains filtered or unexported fields
}

func New

func New(appOptions Options) *App

func (*App) Clipboard

func (a *App) Clipboard() *Clipboard

func (*App) CurrentWindow

func (a *App) CurrentWindow() *WebviewWindow

func (*App) ErrorDialog

func (a *App) ErrorDialog() *MessageDialog

func (*App) GetPID

func (a *App) GetPID() int

func (*App) GetPrimaryScreen

func (a *App) GetPrimaryScreen() (*Screen, error)

func (*App) GetScreens

func (a *App) GetScreens() ([]*Screen, error)

func (*App) GetWindowByName

func (a *App) GetWindowByName(name string) *WebviewWindow

func (*App) Hide

func (a *App) Hide()

func (*App) InfoDialog

func (a *App) InfoDialog() *MessageDialog

func (*App) Log

func (a *App) Log(message *logger.Message)

func (*App) NewMenu

func (a *App) NewMenu() *Menu

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) On

func (a *App) On(eventType events.ApplicationEventType, callback func())

func (*App) OnWindowCreation

func (a *App) OnWindowCreation(callback func(window *WebviewWindow))

func (*App) OpenDirectoryDialog

func (a *App) OpenDirectoryDialog() *MessageDialog

func (*App) OpenFileDialog

func (a *App) OpenFileDialog() *OpenFileDialog

func (*App) OpenFileDialogWithOptions

func (a *App) OpenFileDialogWithOptions(options *OpenFileDialogOptions) *OpenFileDialog

func (*App) QuestionDialog

func (a *App) QuestionDialog() *MessageDialog

func (*App) Quit

func (a *App) Quit()

func (*App) RegisterContextMenu

func (a *App) RegisterContextMenu(name string, menu *Menu)

func (*App) Run

func (a *App) Run() error

func (*App) SaveFileDialog

func (a *App) SaveFileDialog() *SaveFileDialog

func (*App) SaveFileDialogWithOptions

func (a *App) SaveFileDialogWithOptions(s *SaveFileDialogOptions) *SaveFileDialog

func (*App) SetMenu

func (a *App) SetMenu(menu *Menu)

func (*App) Show

func (a *App) Show()

func (*App) ShowAboutDialog

func (a *App) ShowAboutDialog()

func (*App) WarningDialog

func (a *App) WarningDialog() *MessageDialog

type Args

type Args struct {
	// contains filtered or unexported fields
}

func (*Args) Bool

func (a *Args) Bool(s string) *bool

func (*Args) Float64

func (a *Args) Float64(s string) *float64

func (*Args) Int

func (a *Args) Int(s string) *int

func (*Args) String

func (a *Args) String(key string) *string

func (*Args) UInt

func (a *Args) UInt(s string) *uint

func (*Args) UInt8

func (a *Args) UInt8(s string) *uint8

type AssetOptions

type AssetOptions struct {
	// FS defines the static assets to be used. A GET request is first tried to be served from this FS. If the FS returns
	// `os.ErrNotExist` for that file, the request handling will fallback to the Handler and tries to serve the GET
	// request from it.
	//
	// If set to nil, all GET requests will be forwarded to Handler.
	FS fs.FS

	// Handler will be called for every GET request that can't be served from FS, due to `os.ErrNotExist`. Furthermore all
	// non GET requests will always be served from this Handler.
	//
	// If not defined, the result is the following in cases where the Handler would have been called:
	//   GET request:   `http.StatusNotFound`
	//   Other request: `http.StatusMethodNotAllowed`
	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.
	//
	// If not defined, the default AssetServer request chain is executed.
	//
	// Multiple Middlewares can be chained together with:
	//   ChainMiddleware(middleware ...Middleware) Middleware
	Middleware Middleware
}

AssetOptions defines the configuration of the AssetServer.

type Bindings

type Bindings struct {
	// contains filtered or unexported fields
}

func NewBindings

func NewBindings(bindings []any) (*Bindings, error)

func (*Bindings) Add

func (b *Bindings) Add(structPtr interface{}) error

Add the given struct methods to the Bindings

func (*Bindings) AddPlugins

func (b *Bindings) AddPlugins(plugins map[string]Plugin) error

func (*Bindings) Get

func (b *Bindings) Get(options *CallOptions) *BoundMethod

type BoundMethod

type BoundMethod struct {
	Name        string        `json:"name"`
	Inputs      []*Parameter  `json:"inputs,omitempty"`
	Outputs     []*Parameter  `json:"outputs,omitempty"`
	Comments    string        `json:"comments,omitempty"`
	Method      reflect.Value `json:"-"`
	PackageName string
	StructName  string
	PackagePath string
}

BoundMethod defines all the data related to a Go method that is bound to the Wails application

func (*BoundMethod) Call

func (b *BoundMethod) Call(args []interface{}) (interface{}, error)

Call will attempt to call this bound method with the given args

type Button

type Button struct {
	Label     string
	IsCancel  bool
	IsDefault bool
	// contains filtered or unexported fields
}

func (*Button) OnClick

func (b *Button) OnClick(callback func())

type CallOptions

type CallOptions struct {
	PackageName string `json:"packageName"`
	StructName  string `json:"structName"`
	MethodName  string `json:"methodName"`
	Args        []any  `json:"args"`
}

type Clipboard

type Clipboard struct {
	// contains filtered or unexported fields
}

func (*Clipboard) SetText

func (c *Clipboard) SetText(text string) bool

func (*Clipboard) Text

func (c *Clipboard) Text() string

type Context

type Context struct {
	// contains filtered or unexported fields
}

func (*Context) ClickedMenuItem

func (c *Context) ClickedMenuItem() *MenuItem

func (*Context) ContextMenuData

func (c *Context) ContextMenuData() any

func (*Context) IsChecked

func (c *Context) IsChecked() bool

type ContextMenuData

type ContextMenuData struct {
	Id   string `json:"id"`
	X    int    `json:"x"`
	Y    int    `json:"y"`
	Data any    `json:"data"`
}

type DialogType

type DialogType int
const (
	InfoDialog DialogType = iota
	QuestionDialog
	WarningDialog
	ErrorDialog
	OpenDirectoryDialog
)

type EventProcessor

type EventProcessor struct {
	// contains filtered or unexported fields
}

EventProcessor handles custom events

func NewWailsEventProcessor

func NewWailsEventProcessor(dispatchEventToWindows func(*WailsEvent)) *EventProcessor

func (*EventProcessor) Emit

func (e *EventProcessor) Emit(thisEvent *WailsEvent)

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 *WailsEvent)) func()

On is the equivalent of Javascript's `addEventListener`

func (*EventProcessor) OnMultiple

func (e *EventProcessor) OnMultiple(eventName string, callback func(event *WailsEvent), counter int) func()

OnMultiple is the same as `On` but will unregister after `count` events

func (*EventProcessor) Once

func (e *EventProcessor) Once(eventName string, callback func(event *WailsEvent)) func()

Once is the same as `On` but will unregister after the first event

type FileFilter

type FileFilter struct {
	DisplayName string // Filter information EG: "Image Files (*.jpg, *.png)"
	Pattern     string // semicolon separated list of extensions, EG: "*.jpg;*.png"
}

type IconPosition

type IconPosition int

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
const (
	MacBackdropNormal MacBackdrop = iota
	MacBackdropTransparent
	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
}

type MacTitleBar

type MacTitleBar struct {
	AppearsTransparent   bool
	Hide                 bool
	HideTitle            bool
	FullSizeContent      bool
	UseToolbar           bool
	HideToolbarSeparator bool
	ToolbarStyle         MacToolbarStyle
}

MacTitleBar contains options for the Mac titlebar

type MacToolbarStyle

type MacToolbarStyle int
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 MacWindow

type MacWindow struct {
	Backdrop                MacBackdrop
	TitleBar                MacTitleBar
	Appearance              MacAppearanceType
	InvisibleTitleBarHeight int
}

MacWindow contains macOS specific options

type Menu struct {
	// contains filtered or unexported fields
}

func NewMenu

func NewMenu() *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) SetLabel(label string)
func (m *Menu) Update()
type MenuItem struct {
	// contains filtered or unexported fields
}
func (m *MenuItem) Checked() bool
func (m *MenuItem) Enabled() bool
func (m *MenuItem) Label() string
func (m *MenuItem) OnClick(f func(*Context)) *MenuItem
func (m *MenuItem) SetAccelerator(shortcut string) *MenuItem
func (m *MenuItem) SetChecked(checked bool) *MenuItem
func (m *MenuItem) SetEnabled(enabled bool) *MenuItem
func (m *MenuItem) SetLabel(s string) *MenuItem
func (m *MenuItem) SetTooltip(s string) *MenuItem
func (m *MenuItem) Tooltip() string

type MessageDialog

type MessageDialog struct {
	MessageDialogOptions
	// contains filtered or unexported fields
}

func (*MessageDialog) AddButton

func (d *MessageDialog) AddButton(s string) *Button

func (*MessageDialog) AddButtons

func (d *MessageDialog) AddButtons(buttons []*Button) *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
}

type MessageProcessor

type MessageProcessor struct {
	// contains filtered or unexported fields
}

func NewMessageProcessor

func NewMessageProcessor() *MessageProcessor

func (*MessageProcessor) Error

func (m *MessageProcessor) Error(message string, args ...any)

func (*MessageProcessor) HandleRuntimeCall

func (m *MessageProcessor) HandleRuntimeCall(rw http.ResponseWriter, r *http.Request)

func (*MessageProcessor) Info

func (m *MessageProcessor) Info(message string, args ...any)

type Middleware

type Middleware func(next http.Handler) http.Handler

Middleware defines a 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 OpenFileDialog

type OpenFileDialog struct {
	// contains filtered or unexported fields
}

func (*OpenFileDialog) AddFilter

func (d *OpenFileDialog) AddFilter(displayName, pattern string) *OpenFileDialog

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 (*OpenFileDialog) AllowsOtherFileTypes

func (d *OpenFileDialog) AllowsOtherFileTypes(allowsOtherFileTypes bool) *OpenFileDialog

func (*OpenFileDialog) AttachToWindow

func (d *OpenFileDialog) AttachToWindow(window *WebviewWindow) *OpenFileDialog

func (*OpenFileDialog) CanChooseDirectories

func (d *OpenFileDialog) CanChooseDirectories(canChooseDirectories bool) *OpenFileDialog

func (*OpenFileDialog) CanChooseFiles

func (d *OpenFileDialog) CanChooseFiles(canChooseFiles bool) *OpenFileDialog

func (*OpenFileDialog) CanCreateDirectories

func (d *OpenFileDialog) CanCreateDirectories(canCreateDirectories bool) *OpenFileDialog

func (*OpenFileDialog) CanSelectHiddenExtension

func (d *OpenFileDialog) CanSelectHiddenExtension(canSelectHiddenExtension bool) *OpenFileDialog

func (*OpenFileDialog) HideExtension

func (d *OpenFileDialog) HideExtension(hideExtension bool) *OpenFileDialog

func (*OpenFileDialog) PromptForMultipleSelection

func (d *OpenFileDialog) PromptForMultipleSelection() ([]string, error)

func (*OpenFileDialog) PromptForSingleSelection

func (d *OpenFileDialog) PromptForSingleSelection() (string, error)

func (*OpenFileDialog) ResolvesAliases

func (d *OpenFileDialog) ResolvesAliases(resolvesAliases bool) *OpenFileDialog

func (*OpenFileDialog) SetButtonText

func (d *OpenFileDialog) SetButtonText(text string) *OpenFileDialog

func (*OpenFileDialog) SetDirectory

func (d *OpenFileDialog) SetDirectory(directory string) *OpenFileDialog

func (*OpenFileDialog) SetMessage

func (d *OpenFileDialog) SetMessage(message string) *OpenFileDialog

func (*OpenFileDialog) SetOptions

func (d *OpenFileDialog) SetOptions(options *OpenFileDialogOptions)

func (*OpenFileDialog) SetTitle

func (d *OpenFileDialog) SetTitle(title string) *OpenFileDialog

func (*OpenFileDialog) ShowHiddenFiles

func (d *OpenFileDialog) ShowHiddenFiles(showHiddenFiles bool) *OpenFileDialog

func (*OpenFileDialog) TreatsFilePackagesAsDirectories

func (d *OpenFileDialog) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *OpenFileDialog

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

	Title      string
	Message    string
	ButtonText string
	Directory  string
}

type Options

type Options struct {
	Name        string
	Description string
	Icon        []byte
	Mac         MacOptions
	Bind        []any
	Logger      struct {
		Silent        bool
		CustomLoggers []logger.Output
	}
	Assets  AssetOptions
	Plugins map[string]Plugin
}

type Parameter

type Parameter struct {
	Name        string `json:"name,omitempty"`
	TypeName    string `json:"type"`
	ReflectType reflect.Type
}

Parameter defines a Go method parameter

func (*Parameter) IsError

func (p *Parameter) IsError() bool

IsError returns true if the parameter type is an error

func (*Parameter) IsType

func (p *Parameter) IsType(typename string) bool

IsType returns true if the given

type Plugin

type Plugin interface {
	Name() string
	Init(app *App) error
	Shutdown()
	CallableByJS() []string
	InjectJS() string
}

type PluginCallOptions

type PluginCallOptions struct {
	Name string `json:"name"`
	Args []any  `json:"args"`
}

type PluginManager

type PluginManager struct {
	// contains filtered or unexported fields
}

func NewPluginManager

func NewPluginManager(plugins map[string]Plugin, assetServer *assetserver.AssetServer) *PluginManager

func (*PluginManager) Init

func (p *PluginManager) Init() error

func (*PluginManager) Shutdown

func (p *PluginManager) Shutdown()

type QueryParams

type QueryParams map[string][]string

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 RGBA

type RGBA struct {
	Red, Green, Blue, Alpha uint8
}

type Rect

type Rect struct {
	X      int
	Y      int
	Width  int
	Height int
}

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
	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
	Close              Role = iota
	Reload             Role = iota
	ForceReload        Role = iota
	ToggleDevTools     Role = iota
	ResetZoom          Role = iota
	ZoomIn             Role = iota
	ZoomOut            Role = iota
	ToggleFullscreen   Role = iota

	Minimize Role = iota
	Zoom     Role = iota
)

These constants need to be kept in sync with `v2/internal/frontend/desktop/darwin/Role.h`

type SaveFileDialog

type SaveFileDialog struct {
	// contains filtered or unexported fields
}

func (*SaveFileDialog) AllowsOtherFileTypes

func (d *SaveFileDialog) AllowsOtherFileTypes(allowOtherFileTypes bool) *SaveFileDialog

func (*SaveFileDialog) AttachToWindow

func (d *SaveFileDialog) AttachToWindow(window *WebviewWindow) *SaveFileDialog

func (*SaveFileDialog) CanCreateDirectories

func (d *SaveFileDialog) CanCreateDirectories(canCreateDirectories bool) *SaveFileDialog

func (*SaveFileDialog) CanSelectHiddenExtension

func (d *SaveFileDialog) CanSelectHiddenExtension(canSelectHiddenExtension bool) *SaveFileDialog

func (*SaveFileDialog) HideExtension

func (d *SaveFileDialog) HideExtension(hideExtension bool) *SaveFileDialog

func (*SaveFileDialog) PromptForSingleSelection

func (d *SaveFileDialog) PromptForSingleSelection() (string, error)

func (*SaveFileDialog) SetButtonText

func (d *SaveFileDialog) SetButtonText(text string) *SaveFileDialog

func (*SaveFileDialog) SetDirectory

func (d *SaveFileDialog) SetDirectory(directory string) *SaveFileDialog

func (*SaveFileDialog) SetFilename

func (d *SaveFileDialog) SetFilename(filename string) *SaveFileDialog

func (*SaveFileDialog) SetMessage

func (d *SaveFileDialog) SetMessage(message string) *SaveFileDialog

func (*SaveFileDialog) SetOptions

func (d *SaveFileDialog) SetOptions(options *SaveFileDialogOptions)

func (*SaveFileDialog) ShowHiddenFiles

func (d *SaveFileDialog) ShowHiddenFiles(showHiddenFiles bool) *SaveFileDialog

func (*SaveFileDialog) TreatsFilePackagesAsDirectories

func (d *SaveFileDialog) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *SaveFileDialog

type SaveFileDialogOptions

type SaveFileDialogOptions struct {
	CanCreateDirectories            bool
	ShowHiddenFiles                 bool
	CanSelectHiddenExtension        bool
	AllowOtherFileTypes             bool
	HideExtension                   bool
	TreatsFilePackagesAsDirectories bool
	Message                         string
	Directory                       string
	Filename                        string
	ButtonText                      string
}

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 Size

type Size struct {
	Width  int
	Height int
}

type SystemTray

type SystemTray struct {
	// contains filtered or unexported fields
}

func NewSystemTray

func NewSystemTray(id uint) *SystemTray

func (*SystemTray) Destroy

func (s *SystemTray) Destroy()

func (*SystemTray) Label

func (s *SystemTray) Label() string

func (*SystemTray) Run

func (s *SystemTray) Run()

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

type WailsEvent

type WailsEvent struct {
	Name   string `json:"name"`
	Data   any    `json:"data"`
	Sender string `json:"sender"`
}

func (WailsEvent) ToJSON

func (e WailsEvent) ToJSON() string

type WebviewWindow

type WebviewWindow struct {
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(options *WebviewWindowOptions) *WebviewWindow

func (*WebviewWindow) Center

func (w *WebviewWindow) Center()

func (*WebviewWindow) Close

func (w *WebviewWindow) Close()

func (*WebviewWindow) Destroy

func (w *WebviewWindow) Destroy()

func (*WebviewWindow) ExecJS

func (w *WebviewWindow) ExecJS(js string)

func (*WebviewWindow) ForceReload

func (w *WebviewWindow) ForceReload()

func (*WebviewWindow) Fullscreen

func (w *WebviewWindow) Fullscreen() *WebviewWindow

func (*WebviewWindow) GetScreen

func (w *WebviewWindow) GetScreen() (*Screen, error)

func (*WebviewWindow) GetZoom

func (w *WebviewWindow) GetZoom() float64

func (*WebviewWindow) Height

func (w *WebviewWindow) Height() int

func (*WebviewWindow) Hide

func (w *WebviewWindow) Hide() *WebviewWindow

func (*WebviewWindow) IsFullscreen

func (w *WebviewWindow) IsFullscreen() bool

IsFullscreen returns true if the window is fullscreen

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) Maximise

func (w *WebviewWindow) Maximise() *WebviewWindow

func (*WebviewWindow) Minimise

func (w *WebviewWindow) Minimise() *WebviewWindow

func (*WebviewWindow) Minimize

func (w *WebviewWindow) Minimize()

func (*WebviewWindow) Name

func (w *WebviewWindow) Name() string

func (*WebviewWindow) On

func (w *WebviewWindow) On(eventType events.WindowEventType, callback func(ctx *WindowEventContext))

func (*WebviewWindow) Position

func (w *WebviewWindow) Position() (int, int)

func (*WebviewWindow) RegisterContextMenu

func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu)

func (*WebviewWindow) Reload

func (w *WebviewWindow) Reload()

func (*WebviewWindow) Resizable

func (w *WebviewWindow) Resizable() bool

func (*WebviewWindow) Restore

func (w *WebviewWindow) Restore()

func (*WebviewWindow) SetAlwaysOnTop

func (w *WebviewWindow) SetAlwaysOnTop(b bool) *WebviewWindow

func (*WebviewWindow) SetBackgroundColour

func (w *WebviewWindow) SetBackgroundColour(colour *RGBA) *WebviewWindow

func (*WebviewWindow) SetFrameless

func (w *WebviewWindow) SetFrameless(frameless bool) *WebviewWindow

func (*WebviewWindow) SetFullscreenButtonEnabled

func (w *WebviewWindow) SetFullscreenButtonEnabled(enabled bool) *WebviewWindow

func (*WebviewWindow) SetHTML

func (w *WebviewWindow) SetHTML(html string) *WebviewWindow

func (*WebviewWindow) SetMaxSize

func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) *WebviewWindow

func (*WebviewWindow) SetMinSize

func (w *WebviewWindow) SetMinSize(minWidth, minHeight int) *WebviewWindow

func (*WebviewWindow) SetPosition

func (w *WebviewWindow) SetPosition(x, y int) *WebviewWindow

func (*WebviewWindow) SetResizable

func (w *WebviewWindow) SetResizable(b bool) *WebviewWindow

func (*WebviewWindow) SetSize

func (w *WebviewWindow) SetSize(width, height int) *WebviewWindow

func (*WebviewWindow) SetTitle

func (w *WebviewWindow) SetTitle(title string) *WebviewWindow

func (*WebviewWindow) SetURL

func (w *WebviewWindow) SetURL(s string) *WebviewWindow

func (*WebviewWindow) SetZoom

func (w *WebviewWindow) SetZoom(magnification float64) *WebviewWindow

func (*WebviewWindow) Show

func (w *WebviewWindow) Show() *WebviewWindow

func (*WebviewWindow) Size

func (w *WebviewWindow) Size() (width int, height int)

Size returns the size of the window

func (*WebviewWindow) ToggleDevTools

func (w *WebviewWindow) ToggleDevTools()

func (*WebviewWindow) ToggleFullscreen

func (w *WebviewWindow) ToggleFullscreen()

func (*WebviewWindow) UnFullscreen

func (w *WebviewWindow) UnFullscreen()

func (*WebviewWindow) UnMaximise

func (w *WebviewWindow) UnMaximise()

func (*WebviewWindow) UnMinimise

func (w *WebviewWindow) UnMinimise()

func (*WebviewWindow) Width

func (w *WebviewWindow) Width() int

func (*WebviewWindow) Zoom

func (w *WebviewWindow) Zoom()

func (*WebviewWindow) ZoomIn

func (w *WebviewWindow) ZoomIn()

func (*WebviewWindow) ZoomOut

func (w *WebviewWindow) ZoomOut()

func (*WebviewWindow) ZoomReset

func (w *WebviewWindow) ZoomReset() *WebviewWindow

type WebviewWindowOptions

type WebviewWindowOptions struct {
	Name                            string
	Title                           string
	Width, Height                   int
	AlwaysOnTop                     bool
	URL                             string
	DisableResize                   bool
	Frameless                       bool
	MinWidth                        int
	MinHeight                       int
	MaxWidth                        int
	MaxHeight                       int
	StartState                      WindowState
	Mac                             MacWindow
	BackgroundColour                *RGBA
	HTML                            string
	JS                              string
	CSS                             string
	X                               int
	Y                               int
	HideOnClose                     bool
	FullscreenButtonEnabled         bool
	Hidden                          bool
	EnableFraudulentWebsiteWarnings bool
	Zoom                            float64
	EnableDragAndDrop               bool
}

type WindowEvent

type WindowEvent struct {
	WindowID uint
	EventID  uint
}

type WindowEventContext

type WindowEventContext struct {
	// contains filtered or unexported fields
}

func (WindowEventContext) DroppedFiles

func (c WindowEventContext) DroppedFiles() []string

type WindowState

type WindowState int
const (
	WindowStateNormal WindowState = iota
	WindowStateMinimised
	WindowStateMaximised
	WindowStateFullscreen
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL