gocui/checkbox.go

35 lines
671 B
Go
Raw Normal View History

package main
import (
"go.wit.com/widget"
)
func (w *guiWidget) setCheckbox(b any) {
if w.node.WidgetType != widget.Checkbox {
return
}
if w.node.State.Label == "" {
w.node.State.Label = "BLANK"
}
if widget.GetBool(b) {
w.checked = widget.GetBool(b)
w.labelN = "X " + w.node.State.Label
} else {
w.checked = widget.GetBool(b)
w.labelN = " " + w.node.State.Label
}
t := len(w.labelN) + 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()
}