application

package
v3.0.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 15 Imported by: 189

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 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 */

Functions

func Fatal

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

Types

type App

type App struct {

	// The main application menu
	ApplicationMenu *Menu
	// contains filtered or unexported fields
}

func New

func New(appOptions options.Application) *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) InfoDialog

func (a *App) InfoDialog() *MessageDialog

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 *options.WebviewWindow) *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) QuestionDialog

func (a *App) QuestionDialog() *MessageDialog

func (*App) Quit

func (a *App) Quit()

func (*App) Run

func (a *App) Run() error

func (*App) SaveFileDialog

func (a *App) SaveFileDialog() *SaveFileDialog

func (*App) SetMenu

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

func (*App) ShowAboutDialog

func (a *App) ShowAboutDialog()

func (*App) WarningDialog

func (a *App) WarningDialog() *MessageDialog

type Button

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

func (*Button) OnClick

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

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

func (c *Context) IsChecked() bool

type DialogType

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

type IconPosition

type IconPosition int
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 {
	// contains filtered or unexported fields
}

func (*MessageDialog) AddButton

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

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(title string) *MessageDialog

func (*MessageDialog) SetTitle

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

func (*MessageDialog) Show

func (d *MessageDialog) Show()

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

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

func (*SaveFileDialog) TreatsFilePackagesAsDirectories

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

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 WebviewWindow

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

func NewWindow

func NewWindow(options *options.WebviewWindow) *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) 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) On

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

func (*WebviewWindow) Position

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

func (*WebviewWindow) Reload

func (w *WebviewWindow) Reload()

func (*WebviewWindow) ResetZoom

func (w *WebviewWindow) ResetZoom() *WebviewWindow

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 *options.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) 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()

type WindowEvent

type WindowEvent struct {
	WindowID uint
	EventID  uint
}

Jump to

Keyboard shortcuts

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