ui: merge package input

Event handling is as fundamental as operations, so move the input
package declarations to package ui.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-09-24 22:11:44 +02:00
parent 2782436ffc
commit 3944ef4b2e
15 changed files with 108 additions and 122 deletions
+27
View File
@@ -80,5 +80,32 @@ size vary between platforms and displays.
To maintain a constant visual size across platforms and displays, always
use dps or sps to define user interfaces. Only use pixels for derived
values.
Events
The Queue interface is the protocol for receiving external events.
For example:
var queue ui.Queue = ...
for e, ok := queue.Next(h); ok; e, ok = queue.Next(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/ui/key
ops := new(ui.Ops)
var h *Handler = ...
key.InputOp{Key: h}.Add(ops)
*/
package ui