NODE: climbing up the rabbit hole
This commit is contained in:
parent
da16b8106c
commit
b3e00c173b
|
@ -70,7 +70,11 @@ func (n *Node) Dump() {
|
|||
log.Println("gui.Node.Dump() Width = ", n.Width)
|
||||
log.Println("gui.Node.Dump() Height = ", n.Height)
|
||||
|
||||
log.Println("gui.Node.Dump() parent = ", n.parent)
|
||||
if (n.parent == nil) {
|
||||
log.Println("gui.Node.Dump() parent = nil")
|
||||
} else {
|
||||
log.Println("gui.Node.Dump() parent = ", n.parent.id)
|
||||
}
|
||||
log.Println("gui.Node.Dump() children = ", n.children)
|
||||
|
||||
log.Println("gui.Node.Dump() window = ", n.window)
|
||||
|
@ -204,7 +208,7 @@ func findByName(node *Node, name string) *Node {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (parent *Node) AddTab(title string) *Node {
|
||||
func (parent *Node) AddTab(title string, uiC ui.Control) *Node {
|
||||
if parent.uiWindow == nil {
|
||||
parent.Dump()
|
||||
panic("gui.AddTab() ERROR ui.Window == nil")
|
||||
|
@ -226,7 +230,10 @@ func (parent *Node) AddTab(title string) *Node {
|
|||
tab := parent.uiTab
|
||||
parent.uiWindow.SetMargined(true)
|
||||
|
||||
tab.Append(title, initBlankWindow())
|
||||
if (uiC == nil) {
|
||||
uiC = parent.initBlankWindow()
|
||||
}
|
||||
tab.Append(title, uiC)
|
||||
tab.SetMargined(0, true)
|
||||
|
||||
newNode := parent.makeNode(title, 555, 600 + Config.counter)
|
||||
|
|
|
@ -200,6 +200,7 @@ func (s *GuiBox) AddTab(title string, custom ui.Control) *ui.Tab {
|
|||
return tab
|
||||
}
|
||||
|
||||
/*
|
||||
func (s GuiBox) AddBoxTab(title string) *GuiBox {
|
||||
uiTab := s.AddTab(title, initBlankWindow())
|
||||
tabSetMargined(uiTab)
|
||||
|
@ -209,10 +210,12 @@ func (s GuiBox) AddBoxTab(title string) *GuiBox {
|
|||
box.Window.UiTab = uiTab
|
||||
return box
|
||||
}
|
||||
*/
|
||||
|
||||
func (s GuiBox) AddDemoTab(title string) {
|
||||
uiTab := s.AddTab(title, makeWindowTemplate())
|
||||
tabSetMargined(uiTab)
|
||||
func (n *Node) AddDemoTab(title string) {
|
||||
newNode := n.AddTab(title, makeWindowTemplate())
|
||||
newNode.Dump()
|
||||
tabSetMargined(newNode.uiTab)
|
||||
}
|
||||
|
||||
func (s GuiBox) AddDebugTab(title string) {
|
||||
|
|
|
@ -187,6 +187,17 @@ func makeWindowDebug() ui.Control {
|
|||
Data.ListChildren(true)
|
||||
})
|
||||
|
||||
n1 = addButton(vbox, "Node.Dump()")
|
||||
n1.OnClicked(func(*ui.Button) {
|
||||
y := nodeCombo.Selected()
|
||||
log.Println("y =", y)
|
||||
log.Println("nodeNames[y] =", nodeNames[y])
|
||||
node := Data.findId(nodeNames[y])
|
||||
if (node != nil) {
|
||||
node.Dump()
|
||||
}
|
||||
})
|
||||
|
||||
n1 = addButton(vbox, "Node.ListChildren(false)")
|
||||
n1.OnClicked(func(*ui.Button) {
|
||||
y := nodeCombo.Selected()
|
||||
|
@ -269,7 +280,10 @@ func FindBox(s string) *GuiBox {
|
|||
}
|
||||
|
||||
func dumpBox(s string) {
|
||||
for name, window := range Data.WindowMap {
|
||||
var name string
|
||||
var window *GuiWindow
|
||||
|
||||
for name, window = range Data.WindowMap {
|
||||
if name != s {
|
||||
continue
|
||||
}
|
||||
|
@ -286,6 +300,7 @@ func dumpBox(s string) {
|
|||
log.Println("gui.dumpBox() BoxMap START")
|
||||
for name, abox := range window.BoxMap {
|
||||
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||
abox.Dump()
|
||||
if name == "MAINBOX" {
|
||||
if Config.Debug {
|
||||
scs := spew.ConfigState{MaxDepth: 1}
|
||||
|
|
|
@ -214,7 +214,7 @@ func CreateWindow(title string, tabname string, x int, y int, custom func() ui.C
|
|||
log.Println("SERIOUS ERROR n.box == nil in CreateWindow()")
|
||||
log.Println("SERIOUS ERROR n.box == nil in CreateWindow()")
|
||||
}
|
||||
n.AddTab(title)
|
||||
n.AddTab(title, custom())
|
||||
// TODO: run custom() here // Oct 9
|
||||
return n
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ func CreateBlankWindow(title string, x int, y int) *Node {
|
|||
return node
|
||||
}
|
||||
|
||||
func initBlankWindow() ui.Control {
|
||||
func (n *Node) initBlankWindow() ui.Control {
|
||||
hbox := ui.NewHorizontalBox()
|
||||
hbox.SetPadded(true)
|
||||
|
||||
|
|
Loading…
Reference in New Issue