gocui/checkbox.go

32 lines
702 B
Go
Raw Normal View History

package main
import (
log "go.wit.com/log"
"go.wit.com/widget"
)
// redraw the checkbox
func (w *guiWidget) setCheckbox() {
if w.node.WidgetType != widget.Checkbox {
log.Log(WARN, "setCheckbox() being run on widget:", w.node.WidgetType)
return
}
if w.node.State.Label == "" {
w.node.State.Label = "BLANK"
}
if w.node.State.Checked {
log.Log(WARN, "setCheckbox() got true", w.node.State.Checked)
w.labelN = "X " + w.node.State.Label
// w.changed = true
} else {
log.Log(WARN, "setCheckbox() got false", w.node.State.Checked)
w.labelN = " " + w.node.State.Label
// w.changed = true
}
// t := len(w.labelN) + 3
// w.gocuiSize.w1 = w.gocuiSize.w0 + t
w.Hide()
w.Show()
}