summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--box.go32
-rw-r--r--new-structs.go4
-rw-r--r--window.go11
3 files changed, 44 insertions, 3 deletions
diff --git a/box.go b/box.go
index fffb463..10fb1bc 100644
--- a/box.go
+++ b/box.go
@@ -64,6 +64,38 @@ func add(box *GuiBox, newbox *GuiBox) {
log.Println("gui.add() END")
}
+func (n *Node) NewBox(axis int, name string) *Node {
+ var newBox *GuiBox
+ var newNode *Node = n
+
+ newBox = new(GuiBox)
+ // newBox.Window = newNode.uiWindow
+ newBox.Name = name
+
+ if (n.box == nil) {
+ panic("node.newBox() box == nil")
+ }
+ if (n.box == nil) {
+ // add a box here
+ newBox.node = n
+ n.box = newBox
+ } else {
+ // make a new box & a new node
+ newNode = makeNode(n, name, 111, 112)
+ }
+
+ var uiBox *ui.Box
+ if (axis == Xaxis) {
+ uiBox = ui.NewHorizontalBox()
+ } else {
+ uiBox = ui.NewVerticalBox()
+ }
+ uiBox.SetPadded(true)
+ newBox.UiBox = uiBox
+ add(n.box, newBox)
+ return newNode
+}
+
func NewBox(box *GuiBox, axis int, name string) *GuiBox {
log.Println("gui.NewBox() START")
n := box.FindNode()
diff --git a/new-structs.go b/new-structs.go
index 2f006ef..aa86ef9 100644
--- a/new-structs.go
+++ b/new-structs.go
@@ -2,7 +2,7 @@ package gui
import (
"log"
- "time"
+ // "time"
// "github.com/davecgh/go-spew/spew"
@@ -88,7 +88,7 @@ func (n *Node) Append(child *Node) {
child.Dump()
log.Println("parent node:")
n.Dump()
- time.Sleep(3 * time.Second)
+ // time.Sleep(3 * time.Second)
}
func (n *Node) List() {
diff --git a/window.go b/window.go
index 649f02b..518b92c 100644
--- a/window.go
+++ b/window.go
@@ -96,9 +96,11 @@ func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
newGuiWindow.UiWindow.SetMargined(true)
tmp := 0
newGuiWindow.TabNumber = &tmp
+ node.uiTab = newGuiWindow.UiTab
} else {
newGuiWindow.UiWindow = gw.UiWindow
newGuiWindow.UiTab = gw.UiTab
+ node.uiTab = newGuiWindow.UiTab
}
newGuiWindow.BoxMap = make(map[string]*GuiBox)
@@ -111,6 +113,9 @@ func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
} else {
tabnum := newGuiWindow.UiTab.NumPages()
newGuiWindow.TabNumber = &tabnum
+ if (node.uiTab == nil) {
+ node.uiTab = newGuiWindow.UiTab
+ }
}
Data.WindowMap[newGuiWindow.Name] = newGuiWindow
@@ -158,7 +163,10 @@ func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
log.Println("InitWindow() node.box != box. Hmmm....")
panic(-1)
}
- // panic("InitWindow")
+ if (node.uiTab == nil) {
+ // DebugNodeChildren()
+ // panic("node.uiTab = nil")
+ }
return node
}
@@ -316,6 +324,7 @@ func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Nod
// func makeNode(parent *Node, title string, x int, y int) *Node {
node := makeNode(parent, title, x, y)
node.box = &box
+ node.uiWindow = window
box.node = node
newGuiWindow.BoxMap["jcarrInitTest"] = &box