make a WindowMap to track which windows exist
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7ec7fd15c0
commit
8d9f0b6a34
7
debug.go
7
debug.go
|
@ -31,10 +31,13 @@ func WatchGUI() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func DumpBoxes() {
|
func DumpBoxes() {
|
||||||
|
for name, window := range Data.WindowMap {
|
||||||
|
log.Println("gui.DumpBoxes() Data.WindowMap name =", name, "Window.Name =", window.Name)
|
||||||
|
}
|
||||||
for i, window := range Data.Windows {
|
for i, window := range Data.Windows {
|
||||||
log.Println("watchGUI() Data.Windows", i, "Name =", window.Name)
|
log.Println("gui.DumpBoxes() Data.Windows", i, "Name =", window.Name)
|
||||||
for name, abox := range window.BoxMap {
|
for name, abox := range window.BoxMap {
|
||||||
log.Printf("\twatchGUI() BOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||||
/*
|
/*
|
||||||
if (name == "DEBUG") {
|
if (name == "DEBUG") {
|
||||||
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
|
log.Println("\t\twatchGUI() BOX abox =", reflect.TypeOf(abox))
|
||||||
|
|
12
gui.go
12
gui.go
|
@ -12,6 +12,8 @@ const Yaxis = 1 // box that is vertical
|
||||||
|
|
||||||
func GuiInit() {
|
func GuiInit() {
|
||||||
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
Data.buttonMap = make(map[*ui.Button]*GuiButton)
|
||||||
|
Data.WindowMap = make(map[string]*GuiWindow)
|
||||||
|
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
ui.Quit()
|
ui.Quit()
|
||||||
return true
|
return true
|
||||||
|
@ -29,9 +31,17 @@ func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow {
|
||||||
newGuiWindow.UiTab = gw.UiTab
|
newGuiWindow.UiTab = gw.UiTab
|
||||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||||
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
||||||
newGuiWindow.EntryMap["test"] = nil
|
|
||||||
Data.Windows = append(Data.Windows, &newGuiWindow)
|
Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||||
|
|
||||||
|
if (Data.WindowMap == nil) {
|
||||||
|
log.Println("gui.InitGuiWindow() making the Data.WindowMap here")
|
||||||
|
Data.WindowMap = make(map[string]*GuiWindow)
|
||||||
|
}
|
||||||
|
Data.WindowMap[name] = &newGuiWindow
|
||||||
|
|
||||||
|
// make a blank entry for testing
|
||||||
|
// newGuiWindow.EntryMap["test"] = nil
|
||||||
|
|
||||||
if (Data.buttonMap == nil) {
|
if (Data.buttonMap == nil) {
|
||||||
GuiInit()
|
GuiInit()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ type GuiData struct {
|
||||||
// A map of all the entry boxes
|
// A map of all the entry boxes
|
||||||
AllEntries []*GuiEntry
|
AllEntries []*GuiEntry
|
||||||
Windows []*GuiWindow
|
Windows []*GuiWindow
|
||||||
|
WindowMap map[string]*GuiWindow
|
||||||
|
|
||||||
// A map of all buttons everywhere on all
|
// A map of all buttons everywhere on all
|
||||||
// windows, all tabs, across all goroutines
|
// windows, all tabs, across all goroutines
|
||||||
|
|
Loading…
Reference in New Issue