forked from joejulian/gio
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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user