io/semantic: [API] replace DisabledOp with EnabledOp

The double-negative DisabledOp is harder to understand than a
straightforward EnabledOp. Note that the absence of an EnabledOp
implies still means that the widget is enabled.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-10-06 18:07:22 -05:00
parent b66dcc436c
commit e1b3928819
8 changed files with 22 additions and 22 deletions
+3 -3
View File
@@ -116,14 +116,14 @@ func (e *Enum) Layout(gtx layout.Context, k string, content layout.Widget) layou
}
clk.Add(gtx.Ops)
disabled := gtx.Queue == nil
if !disabled {
enabled := gtx.Queue != nil
if enabled {
key.InputOp{Tag: &state.tag, Keys: "⏎|Space"}.Add(gtx.Ops)
} else if e.focus == k {
e.focused = false
}
semantic.SelectedOp(k == e.Value).Add(gtx.Ops)
semantic.DisabledOp(disabled).Add(gtx.Ops)
semantic.EnabledOp(enabled).Add(gtx.Ops)
c.Add(gtx.Ops)
return dims