gocui/checkbox.go

32 lines
581 B
Go

package main
import (
"go.wit.com/widget"
)
func (w *guiWidget) setCheckbox(b any) {
if w.node.WidgetType != widget.Checkbox {
return
}
if widget.GetBool(b) {
w.checked = widget.GetBool(b)
w.label = "X " + w.label
} else {
w.checked = widget.GetBool(b)
w.label = " " + w.label
}
t := len(w.label) + 1
w.gocuiSize.w1 = w.gocuiSize.w0 + t
// w.realWidth = w.gocuiSize.Width() + me.PadW
// w.realHeight = w.gocuiSize.Height() + me.PadH
// if w.frame {
// w.realWidth += me.FramePadW
// w.realHeight += me.FramePadH
// }
w.deleteView()
w.showView()
}