Documentation
¶
Index ¶
- type ActionOpenWindow
- type Options
- type Service
- type WindowConfig
- type WindowOption
- func WithAlwaysOnTop(alwaysOnTop bool) WindowOption
- func WithCloseButtonState(state application.ButtonState) WindowOption
- func WithFrameless(frameless bool) WindowOption
- func WithHeight(height int) WindowOption
- func WithHidden(hidden bool) WindowOption
- func WithMaximiseButtonState(state application.ButtonState) WindowOption
- func WithMinimiseButtonState(state application.ButtonState) WindowOption
- func WithName(name string) WindowOption
- func WithTitle(title string) WindowOption
- func WithURL(url string) WindowOption
- func WithWidth(width int) WindowOption
- type WindowOptionFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionOpenWindow ¶
type ActionOpenWindow struct {
application.WebviewWindowOptions
}
ActionOpenWindow is an IPC message used to request a new window. It contains the options for the new window.
example:
action := display.ActionOpenWindow{
WebviewWindowOptions: application.WebviewWindowOptions{
Name: "my-window",
Title: "My Window",
Width: 800,
Height: 600,
},
}
type Options ¶
type Options struct{}
Options holds configuration for the display service. This struct is used to configure the display service at startup.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages windowing, dialogs, and other visual elements. It is the primary interface for interacting with the UI.
func New ¶
New is the constructor for the display service. It creates a new Service and returns it.
example:
displayService, err := display.New()
if err != nil {
log.Fatal(err)
}
func (*Service) OpenWindow ¶
func (s *Service) OpenWindow(opts ...WindowOption) error
OpenWindow creates a new window with the given options. If no options are provided, it will use the default options.
example:
err := displayService.OpenWindow(
display.WithName("my-window"),
display.WithTitle("My Window"),
display.WithWidth(800),
display.WithHeight(600),
)
if err != nil {
log.Fatal(err)
}
func (*Service) ShowEnvironmentDialog ¶
func (s *Service) ShowEnvironmentDialog()
ShowEnvironmentDialog displays a dialog containing detailed information about the application's runtime environment. This is useful for debugging and understanding the context in which the application is running.
example:
displayService.ShowEnvironmentDialog()
type WindowConfig ¶
type WindowConfig struct {
Name string
Title string
Width int
Height int
URL string
AlwaysOnTop bool
Hidden bool
MinimiseButtonState application.ButtonState
MaximiseButtonState application.ButtonState
CloseButtonState application.ButtonState
Frameless bool
}
WindowConfig holds the configuration for a window. This struct is used to create a new window with the specified options.
type WindowOption ¶
type WindowOption interface {
Apply(*WindowConfig)
}
WindowOption is an interface for applying configuration options to a WindowConfig.
func WithAlwaysOnTop ¶
func WithAlwaysOnTop(alwaysOnTop bool) WindowOption
WithAlwaysOnTop sets the window to always be on top of other windows.
func WithCloseButtonState ¶
func WithCloseButtonState(state application.ButtonState) WindowOption
WithCloseButtonState sets the state of the close button.
func WithFrameless ¶
func WithFrameless(frameless bool) WindowOption
WithFrameless sets the window to be frameless.
func WithHeight ¶
func WithHeight(height int) WindowOption
WithHeight sets the height of the window.
func WithHidden ¶
func WithHidden(hidden bool) WindowOption
WithHidden sets the window to be hidden when it is created.
func WithMaximiseButtonState ¶
func WithMaximiseButtonState(state application.ButtonState) WindowOption
WithMaximiseButtonState sets the state of the maximise button.
func WithMinimiseButtonState ¶
func WithMinimiseButtonState(state application.ButtonState) WindowOption
WithMinimiseButtonState sets the state of the minimise button.
func WithURL ¶
func WithURL(url string) WindowOption
WithURL sets the URL that the window will load.
type WindowOptionFunc ¶
type WindowOptionFunc func(*WindowConfig)
WindowOptionFunc is a function that implements the WindowOption interface. This allows us to use ordinary functions as window options.
func (WindowOptionFunc) Apply ¶
func (f WindowOptionFunc) Apply(c *WindowConfig)
Apply calls the underlying function to apply the configuration.