2024-01-01 16:11:54 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
// "github.com/awesome-gocui/gocui"
|
2024-01-05 13:35:01 -06:00
|
|
|
"go.wit.com/gui/widget"
|
2024-01-01 16:11:54 -06:00
|
|
|
)
|
|
|
|
|
2024-01-11 19:10:24 -06:00
|
|
|
func (n *node) setCheckbox(b any) {
|
2024-01-01 16:11:54 -06:00
|
|
|
w := n.tk
|
2024-01-05 13:35:01 -06:00
|
|
|
if (n.WidgetType != widget.Checkbox) {
|
2024-01-01 16:11:54 -06:00
|
|
|
return
|
|
|
|
}
|
2024-01-11 19:10:24 -06:00
|
|
|
if widget.GetBool(b) {
|
|
|
|
n.value = b
|
|
|
|
n.tk.label = "X " + n.label
|
2024-01-01 16:11:54 -06:00
|
|
|
} else {
|
2024-01-11 19:10:24 -06:00
|
|
|
n.value = b
|
|
|
|
n.tk.label = " " + n.label
|
2024-01-01 16:11:54 -06:00
|
|
|
}
|
2024-01-11 19:10:24 -06:00
|
|
|
t := len(n.tk.label) + 1
|
2024-01-01 16:11:54 -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
|
|
|
|
// }
|
|
|
|
|
|
|
|
n.deleteView()
|
|
|
|
n.showView()
|
|
|
|
}
|