mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
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:
@@ -3,6 +3,7 @@
|
||||
package material
|
||||
|
||||
import (
|
||||
"gioui.org/io/semantic"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/unit"
|
||||
"gioui.org/widget"
|
||||
@@ -32,6 +33,7 @@ func CheckBox(th *Theme, checkBox *widget.Bool, label string) CheckBoxStyle {
|
||||
// Layout updates the checkBox and displays it.
|
||||
func (c CheckBoxStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
return c.CheckBox.Layout(gtx, func(gtx layout.Context) layout.Dimensions {
|
||||
semantic.CheckBox.Add(gtx.Ops)
|
||||
return c.layout(gtx, c.CheckBox.Value, c.CheckBox.Hovered())
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user