event

package
v1.0.1-0...-f69c2a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2021 License: MIT, Unlicense Imports: 0 Imported by: 0

Documentation

Overview

Package event contains the types for event handling.

The Queue interface is the protocol for receiving external events.

For example:

var queue event.Queue = ...

for _, e := range queue.Events(h) {
	switch e.(type) {
		...
	}
}

In general, handlers must be declared before events become available. Other packages such as pointer and key provide the means for declaring handlers for specific event types.

The following example declares a handler ready for key input:

import gioui.org/io/key

ops := new(op.Ops)
var h *Handler = ...
key.InputOp{Tag: h}.Add(ops)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	ImplementsEvent()
}

Event is the marker interface for events.

type Queue

type Queue interface {
	// Events returns the available events for an
	// event handler tag.
	Events(t Tag) []Event
}

Queue maps an event handler key to the events available to the handler.

type Tag

type Tag interface{}

Tag is the stable identifier for an event handler. For a handler h, the tag is typically &h.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL