summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/box.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-10-19 13:23:22 -0500
committerJeff Carr <[email protected]>2022-10-19 13:23:22 -0500
commitf3af1f5b7ff78b3f73d7510622fc9633dec36d35 (patch)
treee4868584d5e19942938aaa122b2e1cab377db000 /toolkit/andlabs/box.go
parentf7b1036e544238d65b0e3ad46d08075aa4177032 (diff)
Refactor to 'gui/toolkit/'
* add a example cmds/consolemouse uses a console button to launch the andlabs/ui * fix wrong return value in toolkit/NewLabel() * redirect STDIN output to a file * wonderful fix of Window() exit * finally remove the ancient stupid variables x & y * phase out struct 'box' and use 'node' instead * better names for things: use NewFoo() and NewBar()
Diffstat (limited to 'toolkit/andlabs/box.go')
-rw-r--r--toolkit/andlabs/box.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/toolkit/andlabs/box.go b/toolkit/andlabs/box.go
new file mode 100644
index 0000000..548c90a
--- /dev/null
+++ b/toolkit/andlabs/box.go
@@ -0,0 +1,49 @@
+package toolkit
+
+import "log"
+
+import "github.com/andlabs/ui"
+import _ "github.com/andlabs/ui/winmanifest"
+
+// create a new box
+func (t *Toolkit) GetBox() *ui.Box {
+ return t.uiBox
+}
+
+// create a new box
+func (t *Toolkit) NewBox() *Toolkit {
+ log.Println("gui.Toolbox.NewBox() START create default")
+ t.Dump()
+ if (t.uiGroup != nil) {
+ log.Println("gui.Toolbox.NewBox() is a Group")
+ var newTK Toolkit
+
+ vbox := ui.NewVerticalBox()
+ vbox.SetPadded(true)
+ t.uiGroup.SetChild(vbox)
+ newTK.uiBox = vbox
+
+ return &newTK
+ }
+ if (t.uiBox != nil) {
+ log.Println("gui.Toolbox.NewBox() is a Box")
+ // return t
+ }
+ log.Println("gui.Toolbox.NewBox() FAILED. Couldn't figure out where to make a box")
+ t.Dump()
+ return nil
+}
+
+// Make a new box
+func MakeBox(name string) *Toolkit {
+ var newt Toolkit
+
+ vbox := ui.NewVerticalBox()
+ vbox.SetPadded(border)
+ newt.uiBox = vbox
+ newt.Name = name
+
+ log.Println("gui.Toolbox.MakeBox() name =", name)
+ newt.Dump()
+ return &newt
+}