summaryrefslogtreecommitdiff
path: root/checkbox.go
blob: 221edb4b22a2ca113a0d2570adb1c18ac1914815 (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
package main

import (
	"go.wit.com/toolkits/tree"

	"go.wit.com/dev/andlabs/ui"
	_ "go.wit.com/dev/andlabs/ui/winmanifest"
)

func newCheckbox(p *tree.Node, n *tree.Node) {
	if notNew(n) {
		return
	}
	newt := new(guiWidget)

	newt.uiCheckbox = ui.NewCheckbox(n.GetLabel())
	newt.uiControl = newt.uiCheckbox

	newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) {
		n.SetValue(newt.checked())
		me.myTree.DoUserEvent(n)
	})

	n.TK = newt
	place(p, n)
}

func (t *guiWidget) checked() bool {
	return t.uiCheckbox.Checked()
}