summaryrefslogtreecommitdiff
path: root/checkbox.go
blob: 1ca0a9a995818d0c3685a19f3f87c56d0e795a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main

import (
	//	"github.com/awesome-gocui/gocui"
	"go.wit.com/widget"
)

func (n *node) setCheckbox(b any) {
	w := n.tk
	if n.WidgetType != widget.Checkbox {
		return
	}
	if widget.GetBool(b) {
		n.value = b
		n.tk.label = "X " + n.label
	} else {
		n.value = b
		n.tk.label = "  " + n.label
	}
	t := len(n.tk.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
	//	}

	n.deleteView()
	n.showView()
}