summaryrefslogtreecommitdiff
path: root/toolkit/andlabs2/checkbox.go
blob: b4b15244222647e2aa7aa94af0d4a1616687d507 (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
34
package main

import "log"

import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"

func (t andlabsT) NewCheckbox(name string) *andlabsT {
	log.Println("gui.Toolkit.NewCheckbox()", name)
	var newt andlabsT

	if t.broken() {
		return nil
	}

	c := ui.NewCheckbox(name)
	newt.uiCheckbox = c
	newt.uiBox = t.uiBox
	t.uiBox.Append(c, stretchy)

	c.OnToggled(func(spin *ui.Checkbox) {
		newt.commonChange("Checkbox")
	})

	return &newt
}

func (t andlabsT) Checked() bool {
	if t.broken() {
		return false
	}

	return t.uiCheckbox.Checked()
}