widget: add semantic descriptions

Some semantic information is automatically extracted, but some must be
provided by UI components. This change enriches the generic and material
widgets with such information.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-12-01 13:12:00 +01:00
parent 8a90074d04
commit 6b1ca4ca7e
10 changed files with 97 additions and 5 deletions
+3
View File
@@ -6,6 +6,7 @@ import (
"image"
"gioui.org/gesture"
"gioui.org/io/semantic"
"gioui.org/layout"
"gioui.org/op"
"gioui.org/op/clip"
@@ -76,6 +77,8 @@ func (e *Enum) Layout(gtx layout.Context, key string, content layout.Widget) lay
}
clk.Add(gtx.Ops)
}
semantic.SelectedOp(key == e.Value).Add(gtx.Ops)
semantic.DisabledOp(gtx.Queue == nil).Add(gtx.Ops)
c.Add(gtx.Ops)
return dims