summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/checkbox.go
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/andlabs/checkbox.go')
-rw-r--r--toolkit/andlabs/checkbox.go41
1 files changed, 38 insertions, 3 deletions
diff --git a/toolkit/andlabs/checkbox.go b/toolkit/andlabs/checkbox.go
index b4b1524..5466d17 100644
--- a/toolkit/andlabs/checkbox.go
+++ b/toolkit/andlabs/checkbox.go
@@ -1,12 +1,12 @@
package main
-import "log"
+import "git.wit.org/wit/gui/toolkit"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
-func (t andlabsT) NewCheckbox(name string) *andlabsT {
- log.Println("gui.Toolkit.NewCheckbox()", name)
+func (t andlabsT) NewCheckbox(name string, f func()) *andlabsT {
+ log(debugToolkit, "gui.Toolkit.NewCheckbox()", name)
var newt andlabsT
if t.broken() {
@@ -17,9 +17,20 @@ func (t andlabsT) NewCheckbox(name string) *andlabsT {
newt.uiCheckbox = c
newt.uiBox = t.uiBox
t.uiBox.Append(c, stretchy)
+ // newt.Custom = f
c.OnToggled(func(spin *ui.Checkbox) {
+ // log(debugToolkit, "gui.Toolkit.NewCheckbox() clicked", name)
newt.commonChange("Checkbox")
+ /*
+ if (f != nil) {
+ log(debugToolkit, "Run custom() here", f)
+ log(SPEW, f)
+ f()
+ } else {
+ log(debugToolkit, "No custom() function here")
+ }
+ */
})
return &newt
@@ -32,3 +43,27 @@ func (t andlabsT) Checked() bool {
return t.uiCheckbox.Checked()
}
+
+func NewCheckbox(parentW *toolkit.Widget, w *toolkit.Widget) {
+ log(debugToolkit, "gui.andlabs.NewCheckbox()", w.Name)
+
+ t := mapToolkits[parentW]
+ if (t == nil) {
+ listMap()
+ }
+ newt := t.NewCheckbox(w.Name, w.Custom)
+ newt.Custom = w.Custom
+ /*
+ if (w.Custom != nil) {
+ log(true, "go.andlabs.NewCheckbox() toolkit struct == nil. name=", parentW.Name, w.Name)
+ log(true, "Run custom() START here", w.Custom)
+ w.Custom()
+ log(true, "Run custom() END")
+ // exit("ran it here")
+ } else {
+ log(true, "No custom() function here")
+ // exit("nothing here")
+ }
+ */
+ mapWidgetsToolkits(w, newt)
+}