summaryrefslogtreecommitdiff
path: root/andlabs/checkbox.go
blob: 49f9045569dcad39f35cfd1ef03b9b3db6073ddd (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 (
	"github.com/andlabs/ui"
	_ "github.com/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()
}