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
+6 -6
View File
@@ -36,8 +36,8 @@ const (
// boolean state.
type SelectedOp bool
// DisabledOp describes the disabled state.
type DisabledOp bool
// EnabledOp describes the enabled state.
type EnabledOp bool
func (l LabelOp) Add(o *op.Ops) {
data := ops.Write1String(&o.Internal, ops.TypeSemanticLabelLen, string(l))
@@ -63,10 +63,10 @@ func (s SelectedOp) Add(o *op.Ops) {
}
}
func (d DisabledOp) Add(o *op.Ops) {
data := ops.Write(&o.Internal, ops.TypeSemanticDisabledLen)
data[0] = byte(ops.TypeSemanticDisabled)
if d {
func (e EnabledOp) Add(o *op.Ops) {
data := ops.Write(&o.Internal, ops.TypeSemanticEnabledLen)
data[0] = byte(ops.TypeSemanticEnabled)
if e {
data[1] = 1
}
}