2024-01-18 00:08:37 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-02-01 11:59:21 -06:00
|
|
|
log "go.wit.com/log"
|
2024-01-18 04:10:08 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-18 00:08:37 -06:00
|
|
|
)
|
|
|
|
|
2024-02-01 11:59:21 -06:00
|
|
|
// redraw the checkbox
|
|
|
|
func (w *guiWidget) setCheckbox() {
|
2024-01-28 02:20:31 -06:00
|
|
|
if w.node.WidgetType != widget.Checkbox {
|
2024-02-01 11:59:21 -06:00
|
|
|
log.Log(WARN, "setCheckbox() being run on widget:", w.node.WidgetType)
|
2024-01-18 00:08:37 -06:00
|
|
|
return
|
|
|
|
}
|
2024-01-28 03:33:08 -06:00
|
|
|
if w.node.State.Label == "" {
|
|
|
|
w.node.State.Label = "BLANK"
|
|
|
|
}
|
2024-02-01 11:59:21 -06:00
|
|
|
if w.node.State.Checked {
|
|
|
|
log.Log(WARN, "setCheckbox() got true", w.node.State.Checked)
|
2024-01-28 03:33:08 -06:00
|
|
|
w.labelN = "X " + w.node.State.Label
|
2024-02-01 11:59:21 -06:00
|
|
|
// w.changed = true
|
2024-01-18 00:08:37 -06:00
|
|
|
} else {
|
2024-02-01 11:59:21 -06:00
|
|
|
log.Log(WARN, "setCheckbox() got false", w.node.State.Checked)
|
2024-01-28 03:33:08 -06:00
|
|
|
w.labelN = " " + w.node.State.Label
|
2024-02-01 11:59:21 -06:00
|
|
|
// w.changed = true
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
2024-02-01 11:59:21 -06:00
|
|
|
// t := len(w.labelN) + 3
|
|
|
|
// w.gocuiSize.w1 = w.gocuiSize.w0 + t
|
2024-01-18 00:08:37 -06:00
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
w.deleteView()
|
2024-02-05 02:22:58 -06:00
|
|
|
w.Show()
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|