Documentation
¶
Overview ¶
Package app provides a platform-independent interface to operating system functionality for running graphical user interfaces.
See https://gioui.org for instructions to set up and run Gio programs.
Windows ¶
Create a new Window by calling NewWindow. On mobile platforms or when Gio is embedded in another project, NewWindow merely connects with a previously created window.
A Window is run by receiving events from its Events channel. The most important event is FrameEvent that prompts an update of the window contents and state.
For example:
import "github.com/gop9/olt/gio/unit" w := app.NewWindow() for e := range w.Events() { if e, ok := e.(app.FrameEvent); ok { ops.Reset() // Add operations to ops. ... // Completely replace the window contents and state. e.Frame(ops) } }
A program must keep receiving events from the event channel until DestroyEvent is received.
Main ¶
The Main function must be called from a program's main function, to hand over control of the main thread to operating systems that need it.
Because Main is also blocking on some platforms, the event loop of a Window must run in a goroutine.
For example, to display a blank but otherwise functional window:
package main import "github.com/gop9/olt/gio/app" func main() { go func() { w := app.NewWindow() for range w.Events() { } }() app.Main() }
Event queue ¶
A Window's Queue method returns an event.Queue implementation that distributes incoming events to the event handlers declared in the latest frame. See the gioui.org/io/event package for more information about event handlers.
Permissions ¶
The packages under gioui.org/app/permission should be imported by a Gio program or by one of its dependencies to indicate that specific operating-system permissions are required. Please see documentation for package gioui.org/app/permission for more information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue is an event.Queue implementation that distributes system events to the input handlers declared in the most recent frame.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents an operating system window.
func NewWindow ¶
NewWindow creates a new window for a set of window options. The options are hints; the platform is free to ignore or adjust them.
If opts are nil, a set of sensible defaults are used.
If the current program is running on iOS and Android, NewWindow returns the window previously created by the platform.
BUG: Calling NewWindow more than once is not yet supported.
func (*Window) Invalidate ¶
func (w *Window) Invalidate()
Invalidate the window such that a FrameEvent will be generated immediately. If the window is inactive, the event is sent when the window becomes active. Invalidate is safe for concurrent use.
Directories
¶
Path | Synopsis |
---|---|
Package headless implements headless windows for rendering an operation list to an image.
|
Package headless implements headless windows for rendering an operation list to an image. |
internal
|
|
log
Package points standard output, standard error and the standard library package log to the platform logger.
|
Package points standard output, standard error and the standard library package log to the platform logger. |
window
Package window implements platform specific windows and GPU contexts.
|
Package window implements platform specific windows and GPU contexts. |
xkb
Package xkb implements a Go interface for the X Keyboard Extension library.
|
Package xkb implements a Go interface for the X Keyboard Extension library. |
Package permission includes sub-packages that should be imported by a Gio program or by one of its dependencies to indicate that specific operating-system permissions are required.
|
Package permission includes sub-packages that should be imported by a Gio program or by one of its dependencies to indicate that specific operating-system permissions are required. |
bluetooth
Package bluetooth implements permissions to access Bluetooth and Bluetooth Low Energy hardware, including the ability to discover and pair devices.
|
Package bluetooth implements permissions to access Bluetooth and Bluetooth Low Energy hardware, including the ability to discover and pair devices. |
storage
Package storage implements read and write storage permissions on mobile devices.
|
Package storage implements read and write storage permissions on mobile devices. |