mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +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"
|
||||
@@ -38,6 +39,7 @@ func RadioButton(th *Theme, group *widget.Enum, key, label string) RadioButtonSt
|
||||
func (r RadioButtonStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
hovered, hovering := r.Group.Hovered()
|
||||
return r.Group.Layout(gtx, r.Key, func(gtx layout.Context) layout.Dimensions {
|
||||
semantic.RadioButton.Add(gtx.Ops)
|
||||
return r.layout(gtx, r.Group.Value == r.Key, hovering && hovered == r.Key)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user