application

package
v3.0.0-...-c98e9ca Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 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) GetPrimaryScreen

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

func (*App) GetScreens

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

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) 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 to use for loading assets from
	FS fs.FS
	// Handler is a custom handler to use for serving assets. If this is set, the `URL` and `FS` fields are ignored.
	Handler http.Handler
	// Middleware is a custom middleware to use for serving assets. If this is set, the `URL` and `FS` fields are ignored.
	Middleware func(http.Handler) http.Handler
}

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

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

func (CustomEvent) ToJSON

func (e CustomEvent) ToJSON() string

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 NewCustomEventProcessor

func NewCustomEventProcessor(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 `On` 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 `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(w *WebviewWindow) *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)

func (*MessageProcessor) ProcessMessage

func (m *MessageProcessor) ProcessMessage(message string)

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
	}
}

type Parameter

type Parameter struct {
	Name     string `json:"name,omitempty"`
	TypeName string `json:"type"`
	// contains filtered or unexported fields
}

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 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 `json:"x,omitempty"`
	Y      int `json:"y,omitempty"`
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`
}

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  `json:"id,omitempty"`         // A unique identifier for the display
	Name      string  `json:"name,omitempty"`       // The name of the display
	Scale     float32 `json:"scale,omitempty"`      // The scale factor of the display
	X         int     `json:"x,omitempty"`          // The x-coordinate of the top-left corner of the rectangle
	Y         int     `json:"y,omitempty"`          // The y-coordinate of the top-left corner of the rectangle
	Size      Size    `json:"size"`                 // The size of the display
	Bounds    Rect    `json:"bounds"`               // The bounds of the display
	WorkArea  Rect    `json:"work_area"`            // The work area of the display
	IsPrimary bool    `json:"is_primary,omitempty"` // Whether this is the primary display
	Rotation  float32 `json:"rotation,omitempty"`   // The rotation of the display
}

type Size

type Size struct {
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`
}

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 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
	Assets                          AssetOptions
	HTML                            string
	JS                              string
	CSS                             string
	X                               int
	Y                               int
	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