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:
@@ -6,6 +6,7 @@ import (
|
||||
"image/color"
|
||||
|
||||
"gioui.org/internal/f32color"
|
||||
"gioui.org/io/semantic"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/paint"
|
||||
@@ -59,6 +60,7 @@ func (e EditorStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
gtx.Constraints.Min.Y = h
|
||||
}
|
||||
dims = e.Editor.Layout(gtx, e.shaper, e.Font, e.TextSize, func(gtx layout.Context) layout.Dimensions {
|
||||
semantic.Editor.Add(gtx.Ops)
|
||||
disabled := gtx.Queue == nil
|
||||
if e.Editor.Len() > 0 {
|
||||
paint.ColorOp{Color: blendDisabledColor(disabled, e.SelectionColor)}.Add(gtx.Ops)
|
||||
|
||||
Reference in New Issue
Block a user