NODE: going down a rabbit hole
This commit is contained in:
parent
f83ab4577d
commit
3cdc585913
4
box.go
4
box.go
|
@ -93,6 +93,10 @@ func NewBox(box *GuiBox, axis int, name string) *GuiBox {
|
||||||
func HardBox(gw *GuiWindow, axis int, name string) *GuiBox {
|
func HardBox(gw *GuiWindow, axis int, name string) *GuiBox {
|
||||||
log.Println("HardBox() START axis =", axis)
|
log.Println("HardBox() START axis =", axis)
|
||||||
|
|
||||||
|
if (gw.node == nil) {
|
||||||
|
gw.Dump()
|
||||||
|
panic("gui.HardBox() gw.node == nil")
|
||||||
|
}
|
||||||
// add a Vertical Seperator if there is already a box
|
// add a Vertical Seperator if there is already a box
|
||||||
// Is this right?
|
// Is this right?
|
||||||
box := gw.BoxMap["MAINBOX"]
|
box := gw.BoxMap["MAINBOX"]
|
||||||
|
|
2
debug.go
2
debug.go
|
@ -178,7 +178,7 @@ func DebugNodeChildren() {
|
||||||
}
|
}
|
||||||
log.Println("Dumping Data.NodeMap:")
|
log.Println("Dumping Data.NodeMap:")
|
||||||
for name, node := range Data.NodeMap {
|
for name, node := range Data.NodeMap {
|
||||||
log.Println("\tData.NodeMap name =", node.Width, node.Height, name)
|
log.Println("\tData.NodeMap name =", node.id, node.Width, node.Height, name)
|
||||||
// node.Dump()
|
// node.Dump()
|
||||||
node.ListChildren()
|
node.ListChildren()
|
||||||
// node.SetName("yahoo")
|
// node.SetName("yahoo")
|
||||||
|
|
2
gui.go
2
gui.go
|
@ -19,6 +19,8 @@ func init() {
|
||||||
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
||||||
Data.WindowMap = make(map[string]*GuiWindow)
|
Data.WindowMap = make(map[string]*GuiWindow)
|
||||||
Data.NodeMap = make(map[string]*Node)
|
Data.NodeMap = make(map[string]*Node)
|
||||||
|
|
||||||
|
Config.counter = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func GuiInit() {
|
func GuiInit() {
|
||||||
|
|
6
main.go
6
main.go
|
@ -31,7 +31,8 @@ func ExampleWindow() {
|
||||||
log.Println("START gui.ExampleWindow()")
|
log.Println("START gui.ExampleWindow()")
|
||||||
|
|
||||||
title := "Test Window"
|
title := "Test Window"
|
||||||
box := InitWindow(nil, title, 0)
|
node := InitWindow(nil, nil, title, 0)
|
||||||
|
box := node.box
|
||||||
window := box.Window
|
window := box.Window
|
||||||
log.Println("box =", box)
|
log.Println("box =", box)
|
||||||
log.Println("window =", window)
|
log.Println("window =", window)
|
||||||
|
@ -44,7 +45,8 @@ func DebugWindow() {
|
||||||
log.Println("START gui.ExampleWindow()")
|
log.Println("START gui.ExampleWindow()")
|
||||||
|
|
||||||
title := "Debug Window"
|
title := "Debug Window"
|
||||||
box := InitWindow(nil, title, 0)
|
node := InitWindow(nil, nil, title, 0)
|
||||||
|
box := node.box
|
||||||
window := box.Window
|
window := box.Window
|
||||||
log.Println("box =", box)
|
log.Println("box =", box)
|
||||||
log.Println("window =", window)
|
log.Println("window =", window)
|
||||||
|
|
|
@ -2,7 +2,9 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"time"
|
||||||
|
|
||||||
|
// "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
"github.com/andlabs/ui"
|
"github.com/andlabs/ui"
|
||||||
_ "github.com/andlabs/ui/winmanifest"
|
_ "github.com/andlabs/ui/winmanifest"
|
||||||
|
@ -45,6 +47,9 @@ func (n *Node) Dump() {
|
||||||
log.Println("gui.Node.Dump() uiControl = ", n.uiControl)
|
log.Println("gui.Node.Dump() uiControl = ", n.uiControl)
|
||||||
log.Println("gui.Node.Dump() uiWindow = ", n.uiWindow)
|
log.Println("gui.Node.Dump() uiWindow = ", n.uiWindow)
|
||||||
log.Println("gui.Node.Dump() uiTab = ", n.uiTab)
|
log.Println("gui.Node.Dump() uiTab = ", n.uiTab)
|
||||||
|
if (n.id == "") {
|
||||||
|
panic("gui.Node.Dump() id == nil")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,13 +68,13 @@ func (n *Node) FindTab() *ui.Tab {
|
||||||
return n.uiTab
|
return n.uiTab
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (n *Node) FindBox() *GuiBox {
|
||||||
|
return n.box
|
||||||
|
}
|
||||||
|
|
||||||
func (n *Node) FindWindowBox() *GuiBox {
|
func (n *Node) FindWindowBox() *GuiBox {
|
||||||
if (n.box == nil) {
|
if (n.box == nil) {
|
||||||
log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()")
|
panic("SERIOUS ERROR n.box == nil in FindWindowBox()")
|
||||||
log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()")
|
|
||||||
log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()")
|
|
||||||
log.Println("SERIOUS ERROR n.box == nil in FindWindowBox()")
|
|
||||||
os.Exit(-1)
|
|
||||||
}
|
}
|
||||||
return n.box
|
return n.box
|
||||||
}
|
}
|
||||||
|
@ -79,6 +84,11 @@ func (n *Node) Append(child *Node) {
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
n.children = append(n.children, child)
|
n.children = append(n.children, child)
|
||||||
|
log.Println("child node:")
|
||||||
|
child.Dump()
|
||||||
|
log.Println("parent node:")
|
||||||
|
n.Dump()
|
||||||
|
time.Sleep(3 * time.Second)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) List() {
|
func (n *Node) List() {
|
||||||
|
@ -86,20 +96,28 @@ func (n *Node) List() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *Node) ListChildren() {
|
func (n *Node) ListChildren() {
|
||||||
log.Println("gui.Node.ListChildren() node =", n.Name, n)
|
log.Println("\tListChildren() node =", n.id, n.Name, n.Width, n.Height)
|
||||||
|
|
||||||
if len(n.children) == 0 {
|
if len(n.children) == 0 {
|
||||||
|
log.Println("\t\t\tparent =",n.parent.id)
|
||||||
log.Println("\t\tNo children START")
|
log.Println("\t\tNo children START")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// if len(n.children) > 0 {
|
// spew.Dump(n)
|
||||||
for _, child := range n.children {
|
for _, child := range n.children {
|
||||||
log.Println("gui.Node.ListChildren() child =", child.Name, child)
|
log.Println("\t\tListChildren() child =",child.id, child.Name, child.Width, child.Height)
|
||||||
if (child.children == nil) {
|
if (child.parent != nil) {
|
||||||
log.Println("\t\tNo children END")
|
log.Println("\t\t\tparent =",child.parent.id)
|
||||||
break
|
} else {
|
||||||
|
log.Println("\t\t\tno parent")
|
||||||
|
panic("no parent")
|
||||||
}
|
}
|
||||||
log.Println("\t\tHas children:", child.children)
|
// child.Dump()
|
||||||
|
if (child.children == nil) {
|
||||||
|
log.Println("\t\t\tNo children END")
|
||||||
|
// break
|
||||||
|
}
|
||||||
|
log.Println("\t\t\tHas children:", child.children)
|
||||||
child.ListChildren()
|
child.ListChildren()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -145,14 +163,12 @@ func findByName(node *Node, name string) *Node {
|
||||||
|
|
||||||
func (n *Node) InitTab(title string, custom func() ui.Control) *Node {
|
func (n *Node) InitTab(title string, custom func() ui.Control) *Node {
|
||||||
if n.uiWindow == nil {
|
if n.uiWindow == nil {
|
||||||
log.Println("gui.InitTab() ERROR ui.Window == nil")
|
|
||||||
n.Dump()
|
n.Dump()
|
||||||
os.Exit(-1)
|
panic("gui.InitTab() ERROR ui.Window == nil")
|
||||||
}
|
}
|
||||||
if n.box != nil {
|
if n.box == nil {
|
||||||
log.Println("gui.InitTab() ERROR box already exists title =", title)
|
|
||||||
n.Dump()
|
n.Dump()
|
||||||
// os.Exit(-1)
|
panic("gui.InitTab() ERROR box == nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
tab := ui.NewTab()
|
tab := ui.NewTab()
|
||||||
|
@ -162,17 +178,7 @@ func (n *Node) InitTab(title string, custom func() ui.Control) *Node {
|
||||||
tab.Append(title, custom())
|
tab.Append(title, custom())
|
||||||
tab.SetMargined(0, true)
|
tab.SetMargined(0, true)
|
||||||
|
|
||||||
var newNode Node
|
newNode := makeNode(n, title, 555, 666)
|
||||||
newNode.Name = title
|
|
||||||
newNode.parent = n
|
|
||||||
n.Append(&newNode)
|
|
||||||
newNode.uiTab = tab
|
newNode.uiTab = tab
|
||||||
/*
|
return newNode
|
||||||
if boxs.node == nil {
|
|
||||||
log.Println("gui.InitTab() 4 Fuck node = ", n)
|
|
||||||
n.Dump()
|
|
||||||
os.Exit(-1)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return &newNode
|
|
||||||
}
|
}
|
||||||
|
|
31
structs.go
31
structs.go
|
@ -27,6 +27,7 @@ type GuiConfig struct {
|
||||||
Exit func(*GuiWindow)
|
Exit func(*GuiWindow)
|
||||||
|
|
||||||
depth int
|
depth int
|
||||||
|
counter int // used to make unique ID's
|
||||||
}
|
}
|
||||||
|
|
||||||
type GuiData struct {
|
type GuiData struct {
|
||||||
|
@ -97,6 +98,13 @@ type GuiWindow struct {
|
||||||
UiTab *ui.Tab // if this != nil, the window is 'tabbed'
|
UiTab *ui.Tab // if this != nil, the window is 'tabbed'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (gw *GuiWindow) Dump() {
|
||||||
|
log.Println("gui.GuiWindow.Dump() Name = ", gw.Name)
|
||||||
|
log.Println("gui.GuiWindow.Dump() node = ", gw.node)
|
||||||
|
log.Println("gui.GuiWindow.Dump() Width = ", gw.Width)
|
||||||
|
log.Println("gui.GuiWindow.Dump() Height = ", gw.Height)
|
||||||
|
}
|
||||||
|
|
||||||
// GuiBox is any type of ui.Hbox or ui.Vbox
|
// GuiBox is any type of ui.Hbox or ui.Vbox
|
||||||
// There can be lots of these for each GuiWindow
|
// There can be lots of these for each GuiWindow
|
||||||
type GuiBox struct {
|
type GuiBox struct {
|
||||||
|
@ -130,19 +138,32 @@ func (s GuiBox) SetTitle(title string) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *GuiWindow) SetNode(n *Node) {
|
||||||
|
if (w.node != nil) {
|
||||||
|
w.Dump()
|
||||||
|
panic("gui.SetNode() Error not nil")
|
||||||
|
}
|
||||||
|
w.node = n
|
||||||
|
if (w.node == nil) {
|
||||||
|
w.Dump()
|
||||||
|
panic("gui.SetNode() node == nil")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (b *GuiBox) SetNode(n *Node) {
|
func (b *GuiBox) SetNode(n *Node) {
|
||||||
if (b.node != nil) {
|
if (b.node != nil) {
|
||||||
b.Dump()
|
b.Dump()
|
||||||
log.Println("gui.SetNode() Error not nil")
|
panic("gui.SetNode() Error not nil")
|
||||||
os.Exit(-1)
|
|
||||||
}
|
}
|
||||||
b.node = n
|
b.node = n
|
||||||
if (b.node == nil) {
|
if (b.node == nil) {
|
||||||
b.Dump()
|
b.Dump()
|
||||||
log.Println("gui.SetNode() node == nil")
|
panic("gui.SetNode() node == nil")
|
||||||
os.Exit(-1)
|
|
||||||
}
|
}
|
||||||
b.Dump()
|
}
|
||||||
|
|
||||||
|
func (w *GuiWindow) FindNode() *Node {
|
||||||
|
return w.node
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *GuiBox) FindNode() *Node {
|
func (b *GuiBox) FindNode() *Node {
|
||||||
|
|
4
table.go
4
table.go
|
@ -98,9 +98,9 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData) *TableData {
|
func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData) *TableData {
|
||||||
box := InitWindow(gw, name, Yaxis)
|
node := InitWindow(nil, gw, name, Yaxis)
|
||||||
|
|
||||||
return AddTableBox(box, name, rowcount, parts)
|
return AddTableBox(node.box, name, rowcount, parts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddTableBox(box *GuiBox, name string, rowcount int, parts []TableColumnData) *TableData {
|
func AddTableBox(box *GuiBox, name string, rowcount int, parts []TableColumnData) *TableData {
|
||||||
|
|
|
@ -145,7 +145,7 @@ func makeWindowDebug() ui.Control {
|
||||||
DebugDataNodeChildren()
|
DebugDataNodeChildren()
|
||||||
})
|
})
|
||||||
|
|
||||||
n3 := addButton(vbox, "DebugNodeChildren()")
|
n3 := addButton(vbox, "Node.ListChildren()")
|
||||||
n3.OnClicked(func(*ui.Button) {
|
n3.OnClicked(func(*ui.Button) {
|
||||||
DebugNodeChildren()
|
DebugNodeChildren()
|
||||||
})
|
})
|
||||||
|
|
108
window.go
108
window.go
|
@ -2,7 +2,6 @@ package gui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -17,7 +16,8 @@ func initUI(name string, callback func(*GuiBox) *GuiBox) {
|
||||||
ui.Main(func() {
|
ui.Main(func() {
|
||||||
log.Println("gui.initUI() inside ui.Main()")
|
log.Println("gui.initUI() inside ui.Main()")
|
||||||
|
|
||||||
box := InitWindow(nil, "StartNewWindow"+name, 0)
|
node := InitWindow(nil, nil, "StartNewWindow"+name, 0)
|
||||||
|
box := node.box
|
||||||
box = callback(box)
|
box = callback(box)
|
||||||
window := box.Window
|
window := box.Window
|
||||||
log.Println("StartNewWindow() box =", box)
|
log.Println("StartNewWindow() box =", box)
|
||||||
|
@ -50,14 +50,18 @@ func ErrorWindow(gw *GuiWindow, msg1 string, msg2 string) {
|
||||||
// This is this way because on Linux you can have more than one
|
// This is this way because on Linux you can have more than one
|
||||||
// actual window but that does not appear to work on the MacOS or Windows
|
// actual window but that does not appear to work on the MacOS or Windows
|
||||||
//
|
//
|
||||||
func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox {
|
func InitWindow(parent *Node, gw *GuiWindow, name string, axis int) *Node {
|
||||||
log.Println("gui.InitWindow() START")
|
log.Println("gui.InitWindow() START")
|
||||||
|
|
||||||
var box *GuiBox
|
var box *GuiBox
|
||||||
|
var node *Node
|
||||||
|
|
||||||
if gw == nil {
|
if gw == nil {
|
||||||
box = mapWindow(nil, name, Config.Width, Config.Height)
|
node = mapWindow(parent, nil, name, Config.Width, Config.Height)
|
||||||
|
box = node.box
|
||||||
} else {
|
} else {
|
||||||
box = mapWindow(gw.UiWindow, name, Config.Width, Config.Height)
|
node = mapWindow(parent, gw.UiWindow, name, Config.Width, Config.Height)
|
||||||
|
box = node.box
|
||||||
}
|
}
|
||||||
|
|
||||||
// box.Window = &newGuiWindow
|
// box.Window = &newGuiWindow
|
||||||
|
@ -66,12 +70,12 @@ func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox {
|
||||||
// This is the first window. One must create it here
|
// This is the first window. One must create it here
|
||||||
if gw == nil {
|
if gw == nil {
|
||||||
log.Println("gui.initWindow() ADDING ui.NewWindow()")
|
log.Println("gui.initWindow() ADDING ui.NewWindow()")
|
||||||
n := uiNewWindow(name, Config.Width, Config.Height)
|
node = uiNewWindow(node, name, Config.Width, Config.Height)
|
||||||
box.node = n
|
box.node = node
|
||||||
if (n.box == nil) {
|
if (node.box == nil) {
|
||||||
n.box = box
|
node.box = box
|
||||||
}
|
}
|
||||||
w := n.uiWindow
|
w := node.uiWindow
|
||||||
newGuiWindow.UiWindow = w
|
newGuiWindow.UiWindow = w
|
||||||
|
|
||||||
// newGuiWindow.UiWindow.SetTitle("test")
|
// newGuiWindow.UiWindow.SetTitle("test")
|
||||||
|
@ -126,17 +130,36 @@ func InitWindow(gw *GuiWindow, name string, axis int) *GuiBox {
|
||||||
log.Println("InitWindow() box has a FUCKING nil node")
|
log.Println("InitWindow() box has a FUCKING nil node")
|
||||||
fn := FindNode("full initTab")
|
fn := FindNode("full initTab")
|
||||||
log.Println("InitWindow() fn =", fn)
|
log.Println("InitWindow() fn =", fn)
|
||||||
os.Exit(-1)
|
panic(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newGuiWindow.node == nil) {
|
if (newGuiWindow.node == nil) {
|
||||||
DebugNodeChildren()
|
DebugNodeChildren()
|
||||||
log.Println("InitWindow() newGuiWindow has a FUCKING nil node")
|
log.Println("InitWindow() newGuiWindow has a FUCKING nil node")
|
||||||
// os.Exit(-1)
|
// panic(-1)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("InitWindow() END *GuiWindow =", newGuiWindow)
|
log.Println("InitWindow() END *GuiWindow =", newGuiWindow)
|
||||||
return box
|
if (box.node == nil) {
|
||||||
|
box.Dump()
|
||||||
|
panic(-1)
|
||||||
|
}
|
||||||
|
box.Dump()
|
||||||
|
box.node.Dump()
|
||||||
|
if (box.node != node) {
|
||||||
|
log.Println("InitWindow() box.node != node. Hmmm....")
|
||||||
|
log.Println("InitWindow() box.node != node. Hmmm....")
|
||||||
|
log.Println("InitWindow() box.node != node. Hmmm....")
|
||||||
|
panic(-1)
|
||||||
|
}
|
||||||
|
if (node.box != box) {
|
||||||
|
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||||
|
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||||
|
log.Println("InitWindow() node.box != box. Hmmm....")
|
||||||
|
panic(-1)
|
||||||
|
}
|
||||||
|
// panic("InitWindow")
|
||||||
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
func DeleteWindow(name string) {
|
func DeleteWindow(name string) {
|
||||||
|
@ -186,17 +209,40 @@ func CreateWindow(title string, tabname string, x int, y int, custom func() ui.C
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
func uiNewWindow(title string, x int, y int) *Node {
|
//
|
||||||
|
// Create a new node
|
||||||
|
// if parent == nil, that means it is a new window and needs to be put
|
||||||
|
// in the window map (aka Data.NodeMap)
|
||||||
|
//
|
||||||
|
func makeNode(parent *Node, title string, x int, y int) *Node {
|
||||||
var node Node
|
var node Node
|
||||||
node.Name = title
|
node.Name = title
|
||||||
node.Width = x
|
node.Width = x
|
||||||
node.Height = y
|
node.Height = y
|
||||||
if (Data.NodeMap[title] != nil) {
|
|
||||||
log.Println("Duplicate uiNewWindow() name =", title)
|
id := "jwc" + strconv.Itoa(Config.counter)
|
||||||
// TODO: just change the 'title' to something unique
|
Config.counter += 1
|
||||||
return nil
|
node.id = id
|
||||||
|
|
||||||
|
if (parent == nil) {
|
||||||
|
if (Data.NodeMap[title] != nil) {
|
||||||
|
log.Println("Duplicate uiNewWindow() name =", title)
|
||||||
|
// TODO: just change the 'title' to something unique
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Data.NodeMap[title] = &node
|
||||||
|
return &node
|
||||||
|
} else {
|
||||||
|
parent.Append(&node)
|
||||||
|
}
|
||||||
|
node.parent = parent
|
||||||
|
return &node
|
||||||
|
}
|
||||||
|
|
||||||
|
func uiNewWindow(node *Node, title string, x int, y int) *Node {
|
||||||
|
if (node == nil) {
|
||||||
|
node = makeNode(nil, title, x, y)
|
||||||
}
|
}
|
||||||
Data.NodeMap[title] = &node
|
|
||||||
|
|
||||||
w := ui.NewWindow(title, x, y, false)
|
w := ui.NewWindow(title, x, y, false)
|
||||||
w.SetBorderless(false)
|
w.SetBorderless(false)
|
||||||
|
@ -208,16 +254,15 @@ func uiNewWindow(title string, x int, y int) *Node {
|
||||||
w.Show()
|
w.Show()
|
||||||
node.uiWindow = w
|
node.uiWindow = w
|
||||||
// w.node = &node
|
// w.node = &node
|
||||||
return &node
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateBlankWindow(title string, x int, y int) *Node {
|
func CreateBlankWindow(title string, x int, y int) *Node {
|
||||||
box := mapWindow(nil, title, x, y)
|
n := mapWindow(nil, nil, title, x, y)
|
||||||
|
box := n.box
|
||||||
log.Println("gui.CreateBlankWindow() title = box.Name =", box.Name)
|
log.Println("gui.CreateBlankWindow() title = box.Name =", box.Name)
|
||||||
|
|
||||||
n := uiNewWindow(box.Name, x, y)
|
n = uiNewWindow(n, box.Name, x, y)
|
||||||
box.node = n
|
|
||||||
n.box = box
|
|
||||||
window := n.uiWindow
|
window := n.uiWindow
|
||||||
|
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
|
@ -239,7 +284,7 @@ func InitBlankWindow() ui.Control {
|
||||||
|
|
||||||
var master = 0
|
var master = 0
|
||||||
|
|
||||||
func mapWindow(window *ui.Window, title string, x int, y int) *GuiBox {
|
func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Node {
|
||||||
log.Println("gui.WindowMap START title =", title)
|
log.Println("gui.WindowMap START title =", title)
|
||||||
if Data.WindowMap[title] != nil {
|
if Data.WindowMap[title] != nil {
|
||||||
log.Println("Data.WindowMap[title] already exists title =", title)
|
log.Println("Data.WindowMap[title] already exists title =", title)
|
||||||
|
@ -268,17 +313,22 @@ func mapWindow(window *ui.Window, title string, x int, y int) *GuiBox {
|
||||||
box.Window = &newGuiWindow
|
box.Window = &newGuiWindow
|
||||||
box.Name = title
|
box.Name = title
|
||||||
|
|
||||||
|
// func makeNode(parent *Node, title string, x int, y int) *Node {
|
||||||
|
node := makeNode(parent, title, x, y)
|
||||||
|
node.box = &box
|
||||||
|
box.node = node
|
||||||
|
|
||||||
newGuiWindow.BoxMap["jcarrInitTest"] = &box
|
newGuiWindow.BoxMap["jcarrInitTest"] = &box
|
||||||
|
|
||||||
return &box
|
return node
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWindow(title string, x int, y int) *GuiBox {
|
func NewWindow(title string, x int, y int) *GuiBox {
|
||||||
box := mapWindow(nil, title, x, y)
|
n := mapWindow(nil, nil, title, x, y)
|
||||||
|
box := n.box
|
||||||
log.Println("gui.NewWindow() title = box.Name =", box.Name)
|
log.Println("gui.NewWindow() title = box.Name =", box.Name)
|
||||||
|
|
||||||
n := uiNewWindow(box.Name, x, y)
|
n = uiNewWindow(n, box.Name, x, y)
|
||||||
box.node = n
|
|
||||||
window := n.uiWindow
|
window := n.uiWindow
|
||||||
|
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
|
|
Loading…
Reference in New Issue