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

package key

import "gioui.org/io/key"

Package key implements key and text events and operations.

The InputOp operations is used for declaring key input handlers. Use an implementation of the Queue interface from package ui to receive events.

Index

Package Files

key.go mod.go

Constants

const (
    // Names for special keys.
    NameLeftArrow      = "←"
    NameRightArrow     = "→"
    NameUpArrow        = "↑"
    NameDownArrow      = "↓"
    NameReturn         = "⏎"
    NameEnter          = "⌤"
    NameEscape         = "⎋"
    NameHome           = "⇱"
    NameEnd            = "⇲"
    NameDeleteBackward = "⌫"
    NameDeleteForward  = "⌦"
    NamePageUp         = "⇞"
    NamePageDown       = "⇟"
    NameTab            = "⇥"
)
const ModShortcut = ModCtrl

ModShortcut is the platform's shortcut modifier, usually the Ctrl key. On Apple platforms it is the Cmd key.

type EditEvent Uses

type EditEvent struct {
    Text string
}

An EditEvent is generated when text is input.

func (EditEvent) ImplementsEvent Uses

func (EditEvent) ImplementsEvent()

type Event Uses

type Event struct {
    // Name of the key. For letters, the upper case form is used.
    // Use the Name* constants for special keys suchs as the arrow
    // keys.
    Name string
    // Modifiers is the set of active modifiers when
    // the key was pressed.
    Modifiers Modifiers
}

An Event is generated when a key is pressed. For text input use EditEvent.

func (Event) ImplementsEvent Uses

func (Event) ImplementsEvent()

func (Event) String Uses

func (e Event) String() string

type FocusEvent Uses

type FocusEvent struct {
    Focus bool
}

A FocusEvent is generated when a handler gains or loses focus.

func (FocusEvent) ImplementsEvent Uses

func (FocusEvent) ImplementsEvent()

type HideInputOp Uses

type HideInputOp struct{}

HideInputOp request that any on screen text input be hidden.

func (HideInputOp) Add Uses

func (h HideInputOp) Add(o *op.Ops)

type InputOp Uses

type InputOp struct {
    Key   event.Key
    Focus bool
}

InputOp declares a handler ready for key events. Key events are in general only delivered to the focused key handler. Set the Focus flag to request the focus.

func (InputOp) Add Uses

func (h InputOp) Add(o *op.Ops)

type Modifiers Uses

type Modifiers uint32

Modifiers

const (
    // ModCtrl is the ctrl modifier key.
    ModCtrl Modifiers = 1 << iota
    // ModCommand is the command modifier key
    // found on Apple keyboards.
    ModCommand
    // ModShift is the shift modifier key.
    ModShift
    // ModAlt is the alt modifier key, or the option
    // key on Apple keyboards.
    ModAlt
    // ModSuper is the "logo" modifier key, often
    // represented by a Windows logo.
    ModSuper
)

func (Modifiers) Contain Uses

func (m Modifiers) Contain(m2 Modifiers) bool

Contain reports whether m contains all modifiers in m2.

func (Modifiers) String Uses

func (m Modifiers) String() string

Package key imports 4 packages (graph) and is imported by 6 packages. Updated 2019-11-15. Refresh now. Tools for package owners.