mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user