Documentation ¶
Overview ¶
Package input implements input routing and tracking of interface state for a window.
The Source is the interface between the window and the widgets of a user interface and is exposed by gioui.org/app.FrameEvent received from windows.
The Router is used by gioui.org/app.Window to track window state and route events from the platform to event handlers. It is otherwise only useful for using Gio with external window implementations.
Index ¶
- type Command
- type EditorState
- type Router
- func (q *Router) ActionAt(p f32.Point) (system.Action, bool)
- func (q *Router) AppendSemantics(nodes []SemanticNode) []SemanticNode
- func (q *Router) ClickFocus()
- func (q *Router) ClipboardRequested() bool
- func (q *Router) Cursor() pointer.Cursor
- func (q *Router) EditorState() EditorState
- func (q *Router) Event(filters ...event.Filter) (event.Event, bool)
- func (q *Router) Frame(frame *op.Ops)
- func (q *Router) MoveFocus(dir key.FocusDirection)
- func (q *Router) Queue(events ...event.Event)
- func (q *Router) RevealFocus(viewport image.Rectangle)
- func (q *Router) ScrollFocus(dist image.Point)
- func (q *Router) SemanticAt(pos f32.Point) (SemanticID, bool)
- func (q *Router) Source() Source
- func (q *Router) TextInputHint() (key.InputHint, bool)
- func (q *Router) TextInputState() TextInputState
- func (q *Router) WakeupTime() (time.Time, bool)
- func (q *Router) WriteClipboard() (mime string, content []byte, ok bool)
- type SemanticDesc
- type SemanticGestures
- type SemanticID
- type SemanticNode
- type Source
- type SystemEvent
- type TextInputState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface {
ImplementsCommand()
}
Command represents a request such as moving the focus, or initiating a clipboard read. Commands are queued by calling [Source.Queue].
type EditorState ¶
type EditorState struct { Selection struct { Transform f32.Affine2D key.Range key.Caret } Snippet key.Snippet }
EditorState represents the state of an editor needed by input handlers.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router tracks the io/event.Tag identifiers of user interface widgets and routes events to them. Source is its interface exposed to widgets.
func (*Router) AppendSemantics ¶
func (q *Router) AppendSemantics(nodes []SemanticNode) []SemanticNode
AppendSemantics appends the semantic tree to nodes, and returns the result. The root node is the first added.
func (*Router) ClickFocus ¶
func (q *Router) ClickFocus()
func (*Router) ClipboardRequested ¶
ClipboardRequested reports if any new handler is waiting to read the clipboard.
func (*Router) EditorState ¶
func (q *Router) EditorState() EditorState
EditorState returns the editor state for the focused handler, or the zero value if there is none.
func (*Router) Frame ¶
Frame completes the current frame and starts a new with the handlers from the frame argument. Remaining events are discarded, unless they were deferred by a command.
func (*Router) MoveFocus ¶
func (q *Router) MoveFocus(dir key.FocusDirection)
func (*Router) RevealFocus ¶
RevealFocus scrolls the current focus (if any) into viewport if there are scrollable parent handlers.
func (*Router) ScrollFocus ¶
ScrollFocus scrolls the focused widget, if any, by dist.
func (*Router) SemanticAt ¶
func (q *Router) SemanticAt(pos f32.Point) (SemanticID, bool)
SemanticAt returns the first semantic description under pos, if any.
func (*Router) TextInputHint ¶
TextInputHint returns the input mode from the most recent key.InputOp.
func (*Router) TextInputState ¶
func (q *Router) TextInputState() TextInputState
TextInputState returns the input state from the most recent call to Frame.
func (*Router) WakeupTime ¶
WakeupTime returns the most recent time for doing another frame, as determined from the last call to Frame.
type SemanticDesc ¶
type SemanticDesc struct { Class semantic.ClassOp Description string Label string Selected bool Disabled bool Gestures SemanticGestures Bounds image.Rectangle }
SemanticDesc provides a semantic description of a UI component.
type SemanticGestures ¶
type SemanticGestures int
SemanticGestures is a bit-set of supported gestures.
const ( ClickGesture SemanticGestures = 1 << iota ScrollGesture )
func (SemanticGestures) String ¶
func (s SemanticGestures) String() string
type SemanticID ¶
type SemanticID uint
SemanticID uniquely identifies a SemanticDescription.
By convention, the zero value denotes the non-existent ID.
type SemanticNode ¶
type SemanticNode struct { ID SemanticID ParentID SemanticID Children []SemanticNode Desc SemanticDesc // contains filtered or unexported fields }
SemanticNode represents a node in the tree describing the components contained in a frame.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source implements the interface between a Router and user interface widgets. The value Source is disabled.
func (Source) Enabled ¶
Enabled reports whether the source is enabled. Only enabled Sources deliver events and respond to commands.
type SystemEvent ¶
SystemEvent is a marker for events that have platform specific side-effects. SystemEvents are never matched by catch-all filters.
func (SystemEvent) ImplementsEvent ¶
func (SystemEvent) ImplementsEvent()
type TextInputState ¶
type TextInputState uint8
const ( TextInputKeep TextInputState = iota TextInputClose TextInputOpen )
func (TextInputState) String ¶
func (t TextInputState) String() string