summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/button.go
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/andlabs/button.go')
-rw-r--r--toolkit/andlabs/button.go50
1 files changed, 50 insertions, 0 deletions
diff --git a/toolkit/andlabs/button.go b/toolkit/andlabs/button.go
new file mode 100644
index 0000000..3278c09
--- /dev/null
+++ b/toolkit/andlabs/button.go
@@ -0,0 +1,50 @@
+package toolkit
+
+import "log"
+import "os"
+
+import "github.com/andlabs/ui"
+import _ "github.com/andlabs/ui/winmanifest"
+
+// make new Group here
+func (t Toolkit) NewButton(name string) *Toolkit {
+ var newt Toolkit
+ var b *ui.Button
+
+ if (t.uiBox == nil) {
+ log.Println("gui.ToolboxNode.NewButton() node.UiBox == nil. I can't add a range UI element without a place to put it")
+ log.Println("probably could just make a box here?")
+ os.Exit(0)
+ return nil
+ }
+
+ log.Println("gui.Toolbox.NewGroup() create", name)
+ b = ui.NewButton(name)
+ newt.uiButton = b
+
+ b.OnClicked(func(*ui.Button) {
+ log.Println("TODO: IN TOOLKIT GOROUTINE. SHOULD LEAVE HERE VIA channels. button name =", name)
+ t.Dump()
+ newt.Dump()
+ log.Println("wit/gui/toolkit NewButton() Should do something here")
+ if (newt.Custom == nil) {
+ log.Println("wit/gui/toolkit NewButton() toolkit.Custom == nil")
+ } else {
+ log.Println("wit/gui/toolkit NewButton() toolkit.Custom() START")
+ newt.Custom()
+ log.Println("wit/gui/toolkit NewButton() toolkit.Custom() END")
+ }
+ if (t.Custom == nil) {
+ log.Println("wit/gui/toolkit NewButton() parent toolkit.Custom == nil")
+ } else {
+ log.Println("wit/gui/toolkit NewButton() running parent toolkit.Custom() START (IS THIS A BAD IDEA?)")
+ t.Custom()
+ log.Println("wit/gui/toolkit NewButton() running parent toolkit.Custom() END (IS THIS A BAD IDEA?)")
+ }
+ log.Println("TODO: LEFT TOOLKIT GOROUTINE button name =", name)
+ })
+
+ t.uiBox.Append(b, false)
+
+ return &newt
+}