2024-01-18 00:08:37 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-18 04:10:08 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-18 00:08:37 -06:00
|
|
|
)
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
func (w *guiWidget) setCheckbox(b any) {
|
|
|
|
if w.node.WidgetType != widget.Checkbox {
|
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-01-18 00:08:37 -06:00
|
|
|
if widget.GetBool(b) {
|
2024-01-28 02:20:31 -06:00
|
|
|
w.checked = widget.GetBool(b)
|
2024-01-28 03:33:08 -06:00
|
|
|
w.labelN = "X " + w.node.State.Label
|
2024-01-18 00:08:37 -06:00
|
|
|
} else {
|
2024-01-28 02:20:31 -06:00
|
|
|
w.checked = widget.GetBool(b)
|
2024-01-28 03:33:08 -06:00
|
|
|
w.labelN = " " + w.node.State.Label
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
2024-01-28 03:33:08 -06:00
|
|
|
t := len(w.labelN) + 1
|
2024-01-18 00:08:37 -06:00
|
|
|
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
|
|
|
|
// }
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
w.deleteView()
|
|
|
|
w.showView()
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|