Documentation
¶
Index ¶
- Constants
- Variables
- func ToARGB(img *image.RGBA) (int, int, []byte)
- type App
- func (a *App) CurrentWindow() *Window
- func (a *App) Dialog() *Dialog
- func (a *App) Handle(host string, handler http.Handler)
- func (a *App) Menu(icon []byte) *TrayMenu
- func (a *App) Notify(title, message string) *Notification
- func (a *App) Open(options WindowOptions) *Window
- func (a *App) Quit()
- func (a *App) Run() (err error)
- type AppOptions
- type Dialog
- func (d *Dialog) Ask(title string, message string, actions ...string) *MessageDialog
- func (d *Dialog) Fail(title string, message string, actions ...string) *MessageDialog
- func (d *Dialog) Info(title string, message string, actions ...string) *MessageDialog
- func (d *Dialog) Open(title string) *OpenFileDialog
- func (d *Dialog) Save(title string) *SaveFileDialog
- func (d *Dialog) Warn(title string, message string, actions ...string) *MessageDialog
- type JSObject
- type MenuItem
- func (item *MenuItem) Checked() bool
- func (item *MenuItem) Enabled() bool
- func (item *MenuItem) Hidden() bool
- func (item *MenuItem) IsCheckbox() bool
- func (item *MenuItem) IsRadio() bool
- func (item *MenuItem) IsSeparator() bool
- func (item *MenuItem) IsSubmenu() bool
- func (item *MenuItem) Label() string
- func (item *MenuItem) OnClick(f func(bool)) *MenuItem
- func (item *MenuItem) SetChecked(checked bool) *MenuItem
- func (item *MenuItem) SetDisabled(disabled bool) *MenuItem
- func (item *MenuItem) SetHidden(hidden bool) *MenuItem
- func (item *MenuItem) SetIcon(icon []byte) *MenuItem
- func (item *MenuItem) SetLabel(label string) *MenuItem
- type MessageDialog
- func (d *MessageDialog) AddButton(action string, label string) *MessageDialog
- func (d *MessageDialog) AddCancel(action string, label string) *MessageDialog
- func (d *MessageDialog) AddDefault(action string, label string) *MessageDialog
- func (d *MessageDialog) SetIcon(icon []byte) *MessageDialog
- func (d *MessageDialog) Show(callbacks ...func(int)) chan int
- type Notification
- func (n *Notification) Action(label string, callback func()) *Notification
- func (n *Notification) Closed(callback func()) *Notification
- func (n *Notification) Icon(icon []byte) *Notification
- func (n *Notification) Show() (uint32, error)
- func (n *Notification) Timeout(timeout time.Duration) *Notification
- type OpenFileDialog
- func (d *OpenFileDialog) AddFilter(displayName, pattern string) *OpenFileDialog
- func (d *OpenFileDialog) AllowsMultipleSelection(allowsMultipleSelection bool) *OpenFileDialog
- func (d *OpenFileDialog) AllowsOtherFileTypes(allowsOtherFileTypes bool) *OpenFileDialog
- func (d *OpenFileDialog) CanChooseDirectories(canChooseDirectories bool) *OpenFileDialog
- func (d *OpenFileDialog) CanChooseFiles(canChooseFiles bool) *OpenFileDialog
- func (d *OpenFileDialog) CanCreateDirectories(canCreateDirectories bool) *OpenFileDialog
- func (d *OpenFileDialog) CanSelectHiddenExtension(canSelectHiddenExtension bool) *OpenFileDialog
- func (d *OpenFileDialog) HideExtension(hideExtension bool) *OpenFileDialog
- func (d *OpenFileDialog) ResolvesAliases(resolvesAliases bool) *OpenFileDialog
- func (d *OpenFileDialog) SetButtonText(text string) *OpenFileDialog
- func (d *OpenFileDialog) SetDirectory(directory string) *OpenFileDialog
- func (d *OpenFileDialog) Show(callbacks ...func([]string)) chan []string
- func (d *OpenFileDialog) ShowHiddenFiles(showHiddenFiles bool) *OpenFileDialog
- func (d *OpenFileDialog) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *OpenFileDialog
- type SaveFileDialog
- func (d *SaveFileDialog) AddFilter(displayName, pattern string) *SaveFileDialog
- func (d *SaveFileDialog) AllowsOtherFileTypes(allowOtherFileTypes bool) *SaveFileDialog
- func (d *SaveFileDialog) CanCreateDirectories(canCreateDirectories bool) *SaveFileDialog
- func (d *SaveFileDialog) CanSelectHiddenExtension(canSelectHiddenExtension bool) *SaveFileDialog
- func (d *SaveFileDialog) HideExtension(hideExtension bool) *SaveFileDialog
- func (d *SaveFileDialog) SetButtonText(text string) *SaveFileDialog
- func (d *SaveFileDialog) SetDirectory(directory string) *SaveFileDialog
- func (d *SaveFileDialog) SetFilename(filename string) *SaveFileDialog
- func (d *SaveFileDialog) Show(callbacks ...func(string)) chan string
- func (d *SaveFileDialog) ShowHiddenFiles(showHiddenFiles bool) *SaveFileDialog
- func (d *SaveFileDialog) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *SaveFileDialog
- type TrayMenu
- func (m *TrayMenu) Add(label string) *MenuItem
- func (m *TrayMenu) AddCheckbox(label string, checked bool) *MenuItem
- func (m *TrayMenu) AddRadio(label string, checked bool) *MenuItem
- func (m *TrayMenu) AddSeparator()
- func (m *TrayMenu) AddSubmenu(label string) *TrayMenu
- func (m *TrayMenu) Item() *MenuItem
- func (m *TrayMenu) SetLabel(label string)
- func (m *TrayMenu) Update()
- type WebkitCacheModel
- type WebkitCookiePolicy
- type WebkitSettings
- type Window
- func (w *Window) AddCSS(css string)
- func (w *Window) Center()
- func (w *Window) Close()
- func (w *Window) Dialog() *Dialog
- func (w *Window) DisableSizeConstraints()
- func (w *Window) ExecJS(js string)
- func (w *Window) Focus()
- func (w *Window) Fullscreen()
- func (w *Window) GetSize() (int, int)
- func (w *Window) GetZoom() float64
- func (w *Window) Hide()
- func (w *Window) ID() uint
- func (w *Window) IsFocused() bool
- func (w *Window) IsFullscreen() bool
- func (w *Window) IsMaximised() bool
- func (w *Window) IsMinimised() bool
- func (w *Window) JSCall(js string, fn func(interface{})) func()
- func (w *Window) JSEval(js string, fn func(interface{})) func()
- func (w *Window) JSPromise(js string, fn func(interface{})) func()
- func (w *Window) Maximise()
- func (w *Window) Minimise()
- func (w *Window) Restore()
- func (w *Window) SetFrameless(frameless bool)
- func (w *Window) SetHTML(html string)
- func (w *Window) SetMaxSize(width, height int)
- func (w *Window) SetMinMaxSize(minWidth, minHeight, maxWidth, maxHeight int)
- func (w *Window) SetMinSize(width, height int)
- func (w *Window) SetOverlay(alwaysOnTop bool)
- func (w *Window) SetSize(width, height int)
- func (w *Window) SetTitle(title string)
- func (w *Window) SetURL(uri string)
- func (w *Window) SetZoom(zoom float64)
- func (w *Window) Show()
- func (w *Window) ToggleDevTools()
- func (w *Window) Unfullscreen()
- func (w *Window) Unmaximise()
- func (w *Window) Unminimise()
- func (w *Window) ZoomIn()
- func (w *Window) ZoomOut()
- func (w *Window) ZoomReset()
- type WindowOptions
- type WindowState
Constants ¶
View Source
const ( GSourceRemove int = 0 // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/gdkwindow.h#L121 GdkHintMinSize = 1 << 1 GdkHintMaxSize = 1 << 2 // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gdk/gdkevents.h#L512 GdkWindowStateIconified = 1 << 1 GdkWindowStateMaximized = 1 << 2 GdkWindowStateFullscreen = 1 << 4 // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkmessagedialog.h#L87 GtkButtonsNone int = 0 GtkButtonsOk = 1 GtkButtonsClose = 2 GtkButtonsCancel = 3 GtkButtonsYesNo = 4 GtkButtonsOkCancel = 5 // https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkdialog.h#L36 GtkDialogModal = 1 << 0 GtkDialogDestroyWithParent = 1 << 1 GtkDialogUseHeaderBar = 1 << 2 // actions in header bar instead of action area GtkOrientationVertical = 1 )
Variables ¶
View Source
var LogWriter = os.Stderr
View Source
var PanicHandler = func(v any) { panic(v) }
Functions ¶
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func New ¶
func New(options AppOptions) *App
func (*App) CurrentWindow ¶
func (*App) Notify ¶ added in v0.1.0
func (a *App) Notify(title, message string) *Notification
func (*App) Open ¶
func (a *App) Open(options WindowOptions) *Window
Open opens a new window with the given options.
type AppOptions ¶
type AppOptions struct { // ID is the unique identifier of the app in reverse domain notation. e.g. com.github.malivvan.webkitgtk ID string // Name is the name of the app. Name string // Hold the app open after the last window is closed. Hold bool // The icon of the app. Icon []byte // Ephemeral mode disables all persistent storage. Ephemeral bool // DataDir is the directory where persistent data is stored. DataDir string // CacheDir is the directory where persistent cache is stored. CacheDir string // CacheModel is the cache model used by the webview. CacheModel WebkitCacheModel // CookiePolicy is the cookie store used by the webview. CookiePolicy WebkitCookiePolicy }
type Dialog ¶ added in v0.1.0
type Dialog struct {
// contains filtered or unexported fields
}
func (*Dialog) Ask ¶ added in v0.1.0
func (d *Dialog) Ask(title string, message string, actions ...string) *MessageDialog
func (*Dialog) Fail ¶ added in v0.1.0
func (d *Dialog) Fail(title string, message string, actions ...string) *MessageDialog
func (*Dialog) Info ¶ added in v0.1.0
func (d *Dialog) Info(title string, message string, actions ...string) *MessageDialog
func (*Dialog) Open ¶ added in v0.1.0
func (d *Dialog) Open(title string) *OpenFileDialog
func (*Dialog) Save ¶ added in v0.1.0
func (d *Dialog) Save(title string) *SaveFileDialog
type MenuItem ¶ added in v0.1.0
type MenuItem struct {
// contains filtered or unexported fields
}
func (*MenuItem) IsCheckbox ¶ added in v0.1.0
func (*MenuItem) IsSeparator ¶ added in v0.1.0
func (*MenuItem) SetChecked ¶ added in v0.1.0
func (*MenuItem) SetDisabled ¶ added in v0.1.0
type MessageDialog ¶ added in v0.1.0
type MessageDialog struct {
// contains filtered or unexported fields
}
func (*MessageDialog) AddButton ¶ added in v0.1.0
func (d *MessageDialog) AddButton(action string, label string) *MessageDialog
func (*MessageDialog) AddCancel ¶ added in v0.1.0
func (d *MessageDialog) AddCancel(action string, label string) *MessageDialog
func (*MessageDialog) AddDefault ¶ added in v0.1.0
func (d *MessageDialog) AddDefault(action string, label string) *MessageDialog
func (*MessageDialog) SetIcon ¶ added in v0.1.0
func (d *MessageDialog) SetIcon(icon []byte) *MessageDialog
func (*MessageDialog) Show ¶ added in v0.1.0
func (d *MessageDialog) Show(callbacks ...func(int)) chan int
type Notification ¶ added in v0.1.0
type Notification struct {
// contains filtered or unexported fields
}
func (*Notification) Action ¶ added in v0.1.0
func (n *Notification) Action(label string, callback func()) *Notification
func (*Notification) Closed ¶ added in v0.1.0
func (n *Notification) Closed(callback func()) *Notification
func (*Notification) Icon ¶ added in v0.1.0
func (n *Notification) Icon(icon []byte) *Notification
func (*Notification) Show ¶ added in v0.1.0
func (n *Notification) Show() (uint32, error)
Show sends the information in the notification object to the server to be displayed.
func (*Notification) Timeout ¶ added in v0.1.0
func (n *Notification) Timeout(timeout time.Duration) *Notification
type OpenFileDialog ¶ added in v0.1.0
type OpenFileDialog struct {
// contains filtered or unexported fields
}
func (*OpenFileDialog) AddFilter ¶ added in v0.1.0
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) AllowsMultipleSelection ¶ added in v0.1.0
func (d *OpenFileDialog) AllowsMultipleSelection(allowsMultipleSelection bool) *OpenFileDialog
func (*OpenFileDialog) AllowsOtherFileTypes ¶ added in v0.1.0
func (d *OpenFileDialog) AllowsOtherFileTypes(allowsOtherFileTypes bool) *OpenFileDialog
func (*OpenFileDialog) CanChooseDirectories ¶ added in v0.1.0
func (d *OpenFileDialog) CanChooseDirectories(canChooseDirectories bool) *OpenFileDialog
func (*OpenFileDialog) CanChooseFiles ¶ added in v0.1.0
func (d *OpenFileDialog) CanChooseFiles(canChooseFiles bool) *OpenFileDialog
func (*OpenFileDialog) CanCreateDirectories ¶ added in v0.1.0
func (d *OpenFileDialog) CanCreateDirectories(canCreateDirectories bool) *OpenFileDialog
func (*OpenFileDialog) CanSelectHiddenExtension ¶ added in v0.1.0
func (d *OpenFileDialog) CanSelectHiddenExtension(canSelectHiddenExtension bool) *OpenFileDialog
func (*OpenFileDialog) HideExtension ¶ added in v0.1.0
func (d *OpenFileDialog) HideExtension(hideExtension bool) *OpenFileDialog
func (*OpenFileDialog) ResolvesAliases ¶ added in v0.1.0
func (d *OpenFileDialog) ResolvesAliases(resolvesAliases bool) *OpenFileDialog
func (*OpenFileDialog) SetButtonText ¶ added in v0.1.0
func (d *OpenFileDialog) SetButtonText(text string) *OpenFileDialog
func (*OpenFileDialog) SetDirectory ¶ added in v0.1.0
func (d *OpenFileDialog) SetDirectory(directory string) *OpenFileDialog
func (*OpenFileDialog) Show ¶ added in v0.1.0
func (d *OpenFileDialog) Show(callbacks ...func([]string)) chan []string
func (*OpenFileDialog) ShowHiddenFiles ¶ added in v0.1.0
func (d *OpenFileDialog) ShowHiddenFiles(showHiddenFiles bool) *OpenFileDialog
func (*OpenFileDialog) TreatsFilePackagesAsDirectories ¶ added in v0.1.0
func (d *OpenFileDialog) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *OpenFileDialog
type SaveFileDialog ¶ added in v0.1.0
type SaveFileDialog struct {
// contains filtered or unexported fields
}
func (*SaveFileDialog) AddFilter ¶ added in v0.1.0
func (d *SaveFileDialog) AddFilter(displayName, pattern string) *SaveFileDialog
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 (*SaveFileDialog) AllowsOtherFileTypes ¶ added in v0.1.0
func (d *SaveFileDialog) AllowsOtherFileTypes(allowOtherFileTypes bool) *SaveFileDialog
func (*SaveFileDialog) CanCreateDirectories ¶ added in v0.1.0
func (d *SaveFileDialog) CanCreateDirectories(canCreateDirectories bool) *SaveFileDialog
func (*SaveFileDialog) CanSelectHiddenExtension ¶ added in v0.1.0
func (d *SaveFileDialog) CanSelectHiddenExtension(canSelectHiddenExtension bool) *SaveFileDialog
func (*SaveFileDialog) HideExtension ¶ added in v0.1.0
func (d *SaveFileDialog) HideExtension(hideExtension bool) *SaveFileDialog
func (*SaveFileDialog) SetButtonText ¶ added in v0.1.0
func (d *SaveFileDialog) SetButtonText(text string) *SaveFileDialog
func (*SaveFileDialog) SetDirectory ¶ added in v0.1.0
func (d *SaveFileDialog) SetDirectory(directory string) *SaveFileDialog
func (*SaveFileDialog) SetFilename ¶ added in v0.1.0
func (d *SaveFileDialog) SetFilename(filename string) *SaveFileDialog
func (*SaveFileDialog) Show ¶ added in v0.1.0
func (d *SaveFileDialog) Show(callbacks ...func(string)) chan string
func (*SaveFileDialog) ShowHiddenFiles ¶ added in v0.1.0
func (d *SaveFileDialog) ShowHiddenFiles(showHiddenFiles bool) *SaveFileDialog
func (*SaveFileDialog) TreatsFilePackagesAsDirectories ¶ added in v0.1.0
func (d *SaveFileDialog) TreatsFilePackagesAsDirectories(treatsFilePackagesAsDirectories bool) *SaveFileDialog
type TrayMenu ¶ added in v0.1.0
type TrayMenu struct {
// contains filtered or unexported fields
}
func (*TrayMenu) AddCheckbox ¶ added in v0.1.0
func (*TrayMenu) AddSeparator ¶ added in v0.1.0
func (m *TrayMenu) AddSeparator()
func (*TrayMenu) AddSubmenu ¶ added in v0.1.0
type WebkitCacheModel ¶ added in v0.1.0
type WebkitCacheModel int
const ( CacheNone WebkitCacheModel = iota CacheLite CacheFull )
type WebkitCookiePolicy ¶ added in v0.1.0
type WebkitCookiePolicy int
const ( CookiesAcceptAll WebkitCookiePolicy = iota CookiesRejectAll CookiesNoThirdParty )
type WebkitSettings ¶
type WebkitSettings struct { EnableJavascript bool AutoLoadImages bool LoadIconsIgnoringImageLoadSetting bool EnableOfflineWebApplicationCache bool EnableHtml5LocalStorage bool EnableHtml5Database bool EnableXssAuditor bool EnableFrameFlattening bool EnablePlugins bool EnableJava bool JavascriptCanOpenWindowsAutomatically bool EnableHyperlinkAuditing bool DefaultFontFamily string MonospaceFontFamily string SerifFontFamily string SansSerifFontFamily string CursiveFontFamily string FantasyFontFamily string PictographFontFamily string DefaultFontSize uint32 DefaultMonospaceFontSize uint32 MinimumFontSize uint32 DefaultCharset string EnableDeveloperExtras bool EnableResizableTextAreas bool EnableTabsToLinks bool EnableDnsPrefetching bool EnableCaretBrowsing bool EnableFullscreen bool PrintBackgrounds bool EnableWebAudio bool EnableWebgl bool AllowModalDialogs bool ZoomTextOnly bool JavascriptCanAccessClipboard bool MediaPlaybackRequiresUserGesture bool MediaPlaybackAllowsInline bool DrawCompositingIndicators bool EnableSiteSpecificQuirks bool EnablePageCache bool UserAgent string EnableSmoothScrolling bool EnableAccelerated2DCanvas bool EnableWriteConsoleMessagesToStdout bool EnableMediaStream bool EnableMockCaptureDevices bool EnableMediaSource bool EnableEncryptedMedia bool EnableMediaCapabilities bool AllowFileAccessFromFileUrls bool AllowUniversalAccessFromFileUrls bool HardwareAccelerationPolicy int EnableJavascriptMarkup bool EnableMedia bool MediaContentTypesRequiringHardwareSupport string EnableWebRTC bool DisableWebSecurity bool }
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
func (*Window) DisableSizeConstraints ¶
func (w *Window) DisableSizeConstraints()
func (*Window) Fullscreen ¶
func (w *Window) Fullscreen()
func (*Window) IsFullscreen ¶
func (*Window) IsMaximised ¶
func (*Window) IsMinimised ¶
func (*Window) SetFrameless ¶
func (*Window) SetMaxSize ¶
func (*Window) SetMinMaxSize ¶
func (*Window) SetMinSize ¶
func (*Window) SetOverlay ¶
func (*Window) ToggleDevTools ¶
func (w *Window) ToggleDevTools()
func (*Window) Unfullscreen ¶
func (w *Window) Unfullscreen()
func (*Window) Unmaximise ¶
func (w *Window) Unmaximise()
func (*Window) Unminimise ¶
func (w *Window) Unminimise()
type WindowOptions ¶
type WindowOptions struct { // Name is a unique identifier of the window. Name string // Title is the title of the page. Title string // URL is the URL of the page to load. URL string // HTML Content to load (if URL is not set). HTML string // CSS to load after the page has loaded. CSS []string // JS to load after the page has loaded. JS []string // Define global Variables and APIs. Define map[string]interface{} // Width is the starting width of the window. Width int // Height is the starting height of the window. Height int // Overlay will make the window float above other windows. Overlay 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 // State indicates the state of the window when it is first shown. // Default: WindowStateNormal State WindowState // Centered will Center the window on the screen. Centered bool // Color specified the window color as a hex string (#RGB, #RGBA, #RRGGBB, #RRGGBBAA) Color string // X is the starting X position of the window. X int // Y is the starting Y position of the window. Y int // Hidden will Hide the window when it is first created. Hidden bool // Zoom is the initial Zoom level of the window. Zoom float64 // ZoomControlEnabled will enable the Zoom control. ZoomControlEnabled bool // OpenInspectorOnStartup will open the inspector when the window is first shown. OpenInspectorOnStartup bool // Focused indicates the window should be focused when initially shown Focused bool // If true, the window's devtools will be available DevToolsEnabled bool // HideOnClose will hide the window when it is closed instead of destroying it. HideOnClose bool // WebkitSettings exposes the underlying WebkitSettings object. WebkitSettings WebkitSettings }
type WindowState ¶
type WindowState int
const ( WindowStateNormal WindowState = iota WindowStateMinimised WindowStateMaximised WindowStateFullscreen )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.