Documentation ¶
Overview ¶
Package window provides types for manipulating Gio windows within skel.
Deprecated: This package should be avoided in favor of the approach implemented by package stream.
Primarily, this package provides Windower, a type that can supervise the creation/destruction of application windows by listening for requests on the application bus.
Index ¶
- func NewWindow(conn bus.Connection, fn WindowFunc, opt ...app.Option)
- func NewWindowForBus(bus bus.Bus, fn WindowFunc, opt ...app.Option)
- func Update(win *app.Window, event any)
- type CreateWindowRequest
- type InvalidateWindowRequest
- type WindowCloseEvent
- type WindowCreateEvent
- type WindowFunc
- type Windower
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWindow ¶
func NewWindow(conn bus.Connection, fn WindowFunc, opt ...app.Option)
NewWindow creates a new OS window with provided options and executes the window handler against it.
func NewWindowForBus ¶
func NewWindowForBus(bus bus.Bus, fn WindowFunc, opt ...app.Option)
NewWindowForBus creates a new OS window with provided options and executes the window handler against it. This helper takes care of creating a temporary bus channel on which to send the request.
Types ¶
type CreateWindowRequest ¶
type CreateWindowRequest struct { Options []app.Option WindowFunc }
CreateWindowRequest signals for the application to create a new window with the provided options and handler function.
type InvalidateWindowRequest ¶
type InvalidateWindowRequest struct{}
InvalidateWindowRequest signals for any window that receives it to invalidate itself.
type WindowCloseEvent ¶
WindowCloseEvent indicates that an application window closed and provides the error from its closing (if any).
type WindowCreateEvent ¶
WindowCreateEvent indicates that the application has started creating a new window with the given handle. From the time that this event is issued, it is guaranteed that the window will recieve all bus events, though its actual event loop may not yet be running at the time of this event.
type WindowFunc ¶
type WindowFunc func(win *app.Window, bus bus.Connection) error
WindowFunc is a function that runs the event loop for a window using the provided window handle and bus.
Consume window events to react to user inputs and subscribe to the bus to receive events from the rest of the application.
for { select { case event := <-win.Events(): // handle window events case update := <-bus.Output(): // handle application events win.Invalidate() } }
type Windower ¶
type Windower struct {
// contains filtered or unexported fields
}
Windower wraps a bus and handles the creation and destruction of windows via that bus.
func NewWindower ¶
NewWindower creates and starts a Windower on the provided bus. The windower will listen on the provided connection, and will use the bus reference to create new connections for new windows.