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

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

func (p *node) newCheckbox(n *node) {
	newt := new(guiWidget)

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

	newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) {
		n.value = newt.checked()
		n.doUserEvent()
	})

	n.tk = newt
	p.place(n)
}

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