Back to

package system

v0.0.0 (278e9bc)
Latest Go to latest
Published: Jun 3, 2020 | Licenses: MIT, Unlicense | Module:


Package system contains events usually handled at the top-level program level.


type ClipboardEvent

type ClipboardEvent struct {
	Text string

ClipboardEvent is sent once for each request for the clipboard content.

func (ClipboardEvent) ImplementsEvent

func (ClipboardEvent) ImplementsEvent()

type CommandEvent

type CommandEvent struct {
	Type CommandType
	// Suppress the default action of the command.
	Cancel bool

CommandEvent is a system event.

func (*CommandEvent) ImplementsEvent

func (*CommandEvent) ImplementsEvent()

type CommandType

type CommandType uint8

CommandType is the type of a CommandEvent.

const (
	// CommandBack is the command for a back action
	// such as the Android back button.
	CommandBack CommandType = iota

type Config

type Config interface {
	// Now returns the current animation time.
	Now() time.Time


Config defines the essential properties of the environment.

type DestroyEvent

type DestroyEvent struct {
	// Err is nil for normal window closures. If a
	// window is prematurely closed, Err is the cause.
	Err error

DestroyEvent is the last event sent through a window event channel.

func (DestroyEvent) ImplementsEvent

func (DestroyEvent) ImplementsEvent()

type FrameEvent

type FrameEvent struct {
	Config Config
	// Size is the dimensions of the window.
	Size image.Point
	// Insets is the insets to apply.
	Insets Insets
	// Frame is the callback to supply the list of
	// operations to complete the FrameEvent.
	// Note that the operation list and the operations themselves
	// may not be mutated until another FrameEvent is received from
	// the same event source.
	// That means that calls to frame.Reset and changes to referenced
	// data such as ImageOp backing images should happen between
	// receiving a FrameEvent and calling Frame.
	// Example:
	//  var w *app.Window
	//  var frame *op.Ops
	//  for e := range w.Events() {
	//      if e, ok := e.(system.FrameEvent); ok {
	//          // Call frame.Reset and manipulate images for ImageOps
	//          // here.
	//          e.Frame(frame)
	//      }
	//  }
	Frame func(frame *op.Ops)
	// Queue supplies the events for event handlers.
	Queue event.Queue

A FrameEvent requests a new frame in the form of a list of operations that describes what to display and how to handle input.

func (FrameEvent) ImplementsEvent

func (FrameEvent) ImplementsEvent()

type Insets

type Insets struct {
	Top, Bottom, Left, Right unit.Value

Insets is the space taken up by system decoration such as translucent system bars and software keyboards.

type Stage

type Stage uint8

Stage of a Window.

const (
	// StagePaused is the Stage for inactive Windows.
	// Inactive Windows don't receive FrameEvents.
	StagePaused Stage = iota
	// StateRunning is for active Windows.

func (Stage) String

func (l Stage) String() string

type StageEvent

type StageEvent struct {
	Stage Stage

A StageEvent is generated whenever the stage of a Window changes.

func (StageEvent) ImplementsEvent

func (StageEvent) ImplementsEvent()
Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier