gioui.org: gioui.org/io/event Index | Files

package event

import "gioui.org/io/event"

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{Key: h}.Add(ops)

Index

Package Files

event.go

type Event Uses

type Event interface {
    ImplementsEvent()
}

Event is the marker interface for events.

type Key Uses

type Key interface{}

Key is the stable identifier for an event handler. For a handler h, the key is typically &h.

type Queue Uses

type Queue interface {
    // Events returns the available events for a
    // Key.
    Events(k Key) []Event
}

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

Package event is imported by 12 packages. Updated 2019-11-19. Refresh now. Tools for package owners.