Documentation ¶
Overview ¶
Package router implements Router, a event.Queue implementation that that disambiguates and routes events to handlers declared in operation lists.
Router is used by app.Window and is otherwise only useful for using Gio with external window implementations.
Index ¶
- type EditorState
- type FocusDirection
- 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) Cursor() pointer.Cursor
- func (q *Router) EditorState() EditorState
- func (q *Router) Events(k event.Tag) []event.Event
- func (q *Router) Frame(frame *op.Ops)
- func (q *Router) MoveFocus(dir FocusDirection) bool
- func (q *Router) Profiling() bool
- func (q *Router) Queue(events ...event.Event) bool
- func (q *Router) QueueTopmost(events ...key.Event) bool
- func (q *Router) ReadClipboard() bool
- 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) TextInputHint() (key.InputHint, bool)
- func (q *Router) TextInputState() TextInputState
- func (q *Router) WakeupTime() (time.Time, bool)
- func (q *Router) WriteClipboard() (string, bool)
- type SemanticDesc
- type SemanticGestures
- type SemanticID
- type SemanticNode
- type TextInputState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 FocusDirection ¶
type FocusDirection int
const ( FocusRight FocusDirection = iota FocusLeft FocusUp FocusDown FocusForward FocusBackward )
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a Queue implementation that routes events to handlers declared in operation lists.
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) 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 replaces the declared handlers from the supplied operation list. The text input state, wakeup time and whether there are active profile handlers is also saved.
func (*Router) MoveFocus ¶
func (q *Router) MoveFocus(dir FocusDirection) bool
func (*Router) Profiling ¶
Profiling reports whether there was profile handlers in the most recent Frame call.
func (*Router) QueueTopmost ¶
Queue key events to the topmost handler.
func (*Router) ReadClipboard ¶
ReadClipboard reports if any new handler is waiting to read the clipboard.
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.
func (*Router) WriteClipboard ¶
WriteClipboard returns the most recent text to be copied to the clipboard, if any.
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 uint64
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 TextInputState ¶
type TextInputState uint8
const ( TextInputKeep TextInputState = iota TextInputClose TextInputOpen )
func (TextInputState) String ¶
func (t TextInputState) String() string