NODE: going down a rabbit hole
This commit is contained in:
parent
3cdc585913
commit
7d5b353f0d
32
box.go
32
box.go
|
@ -64,6 +64,38 @@ func add(box *GuiBox, newbox *GuiBox) {
|
||||||
log.Println("gui.add() END")
|
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 {
|
func NewBox(box *GuiBox, axis int, name string) *GuiBox {
|
||||||
log.Println("gui.NewBox() START")
|
log.Println("gui.NewBox() START")
|
||||||
n := box.FindNode()
|
n := box.FindNode()
|
||||||
|
|
|
@ -2,7 +2,7 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"time"
|
// "time"
|
||||||
|
|
||||||
// "github.com/davecgh/go-spew/spew"
|
// "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ func (n *Node) Append(child *Node) {
|
||||||
child.Dump()
|
child.Dump()
|
||||||
log.Println("parent node:")
|
log.Println("parent node:")
|
||||||
n.Dump()
|
n.Dump()
|
||||||
time.Sleep(3 * time.Second)
|
// time.Sleep(3 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) List() {
|
func (n *Node) List() {
|
||||||
|
|
11
window.go
11
window.go
|
@ -96,9 +96,11 @@ func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
|
||||||
newGuiWindow.UiWindow.SetMargined(true)
|
newGuiWindow.UiWindow.SetMargined(true)
|
||||||
tmp := 0
|
tmp := 0
|
||||||
newGuiWindow.TabNumber = &tmp
|
newGuiWindow.TabNumber = &tmp
|
||||||
|
node.uiTab = newGuiWindow.UiTab
|
||||||
} else {
|
} else {
|
||||||
newGuiWindow.UiWindow = gw.UiWindow
|
newGuiWindow.UiWindow = gw.UiWindow
|
||||||
newGuiWindow.UiTab = gw.UiTab
|
newGuiWindow.UiTab = gw.UiTab
|
||||||
|
node.uiTab = newGuiWindow.UiTab
|
||||||
}
|
}
|
||||||
|
|
||||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||||
|
@ -111,6 +113,9 @@ func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
|
||||||
} else {
|
} else {
|
||||||
tabnum := newGuiWindow.UiTab.NumPages()
|
tabnum := newGuiWindow.UiTab.NumPages()
|
||||||
newGuiWindow.TabNumber = &tabnum
|
newGuiWindow.TabNumber = &tabnum
|
||||||
|
if (node.uiTab == nil) {
|
||||||
|
node.uiTab = newGuiWindow.UiTab
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Data.WindowMap[newGuiWindow.Name] = newGuiWindow
|
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....")
|
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||||
panic(-1)
|
panic(-1)
|
||||||
}
|
}
|
||||||
// panic("InitWindow")
|
if (node.uiTab == nil) {
|
||||||
|
// DebugNodeChildren()
|
||||||
|
// panic("node.uiTab = nil")
|
||||||
|
}
|
||||||
return node
|
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 {
|
// func makeNode(parent *Node, title string, x int, y int) *Node {
|
||||||
node := makeNode(parent, title, x, y)
|
node := makeNode(parent, title, x, y)
|
||||||
node.box = &box
|
node.box = &box
|
||||||
|
node.uiWindow = window
|
||||||
box.node = node
|
box.node = node
|
||||||
|
|
||||||
newGuiWindow.BoxMap["jcarrInitTest"] = &box
|
newGuiWindow.BoxMap["jcarrInitTest"] = &box
|
||||||
|
|
Loading…
Reference in New Issue