summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
Diffstat (limited to 'window.go')
-rw-r--r--window.go57
1 files changed, 35 insertions, 22 deletions
diff --git a/window.go b/window.go
index 06db292..99e5880 100644
--- a/window.go
+++ b/window.go
@@ -4,7 +4,7 @@ import (
"log"
)
-import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
+//import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
// This routine creates a blank window with a Title and size (W x H)
//
@@ -13,33 +13,46 @@ import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
// cross platform, must pass UI changes into the OS threads (that is
// my guess).
func NewWindow() *Node {
- var n *Node
- var t *toolkit.Toolkit
+ var newNode *Node
+// var t *toolkit.Toolkit
title := Config.Title
- w := Config.Width
- h := Config.Height
- // f := Config.Exit
-
// Windows are created off of the master node of the Binary Tree
- n = Config.master.New(title)
+ newNode = Config.master.New(title)
- n.OnChanged = Config.Exit
+ newNode.Widget.Name = title
+ newNode.Widget.Width = Config.Width
+ newNode.Widget.Height = Config.Height
- t = toolkit.NewWindow(title, w, h)
- t.Custom = func () {
- if (Config.Options.Debug) {
- log.Println("Got to wit/gui Window Close START user defined close()")
+ if (Config.Exit != nil) {
+ newNode.custom = func() {
+ Config.Exit(newNode)
}
- if (n.OnChanged != nil) {
- if (Config.Options.Debug) {
- log.Println("Got to wit/gui Window Close SKIP node.custom() == nil")
- }
- n.OnChanged(n)
- return
+ }
+
+ if (newNode.custom == nil) {
+ newNode.custom = func () {StandardExit(newNode)}
+ }
+
+ newNode.Widget.Custom = newNode.custom
+
+ log.Println("gui.Node.Window()", title)
+
+ // t = toolkit.NewWindow(title, w, h)
+ // n.toolkit = t
+
+ for _, aplug := range allPlugins {
+ log.Println("gui.Node.NewWindow() toolkit plugin =", aplug.name)
+ if (aplug.NewWindow == nil) {
+ log.Println("gui.Node.NewWindow() is nil")
+ continue
}
- StandardExit(n)
+ aplug.NewWindow(&newNode.Widget)
}
- n.toolkit = t
- return n
+
+ // TODO: this is still confusing and probably wrong. This needs to communicate through a channel
+ // newNode.toolkit = n.toolkit.NewButton(name)
+ // newNode.toolkit.Custom = newNode.Widget.Custom
+
+ return newNode
}