diff --git a/addAccount.go b/addAccount.go index 6a5a4ad..297924c 100644 --- a/addAccount.go +++ b/addAccount.go @@ -35,7 +35,7 @@ func AddAccountQuestionBox(gw *GuiWindow) *GuiBox { vbox := ui.NewVerticalBox() vbox.SetPadded(true) - gw.Box1 = vbox + // gw.Box1 = vbox gb.UiBox = vbox hbox := ui.NewHorizontalBox() @@ -91,7 +91,7 @@ func AddAccountBox(gw *GuiWindow) *GuiBox { vbox := ui.NewVerticalBox() vbox.SetPadded(true) - gw.Box1 = vbox + // gw.Box1 = vbox gb.UiBox = vbox hboxAccount := ui.NewHorizontalBox() diff --git a/gui.go b/gui.go index 8f3019f..ec276e8 100644 --- a/gui.go +++ b/gui.go @@ -218,12 +218,12 @@ func CreateButton(gw *GuiWindow, a *pb.Account, vm *pb.Event_VM, newUiB.OnClicked(defaultButtonClick) var newB *GuiButton - newB = new(GuiButton) - newB.B = newUiB - newB.T = gw.T + newB = new(GuiButton) + newB.B = newUiB + newB.T = gw.UiTab newB.Account = a - newB.VM = vm - newB.WM = gw + newB.VM = vm + newB.WM = gw newB.Action = action newB.custom = custom Data.AllButtons = append(Data.AllButtons, newB) diff --git a/mainCloudBox.go b/mainCloudBox.go index df85b0a..80163fa 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -13,9 +13,17 @@ import pb "git.wit.com/wit/witProtobuf" // import "github.com/davecgh/go-spew/spew" -func makeCloudInfoBox(gw *GuiWindow) *ui.Box { +func makeCloudInfoBox(gw *GuiWindow) *GuiBox { + var gb *GuiBox + gb = new(GuiBox) + + gb.EntryMap = make(map[string]*GuiEntry) + gb.EntryMap["test"] = nil + hbox := ui.NewHorizontalBox() hbox.SetPadded(true) + // gw.Box1 = hbox + gb.UiBox = hbox if (Data.Debug) { log.Println("makeCloudInfoBox() add debugging buttons") @@ -90,7 +98,7 @@ func makeCloudInfoBox(gw *GuiWindow) *ui.Box { agrid.Append(q.B, 5, row, 1, 1, true, ui.AlignFill, false, ui.AlignFill) vbox.Append(agrid, false) - return hbox + return gb } // @@ -156,26 +164,26 @@ func AddVmsTab(gw *GuiWindow, name string, count int, a *pb.Account) *TableData parts = append(parts, tmp) human += 1 - mh := AddTableTab(gw, gw.T, 1, name, count, parts, a) + mh := AddTableTab(gw, gw.UiTab, 1, name, count, parts, a) return mh } func ShowAccountQuestionTab(gw *GuiWindow) { log.Println("ShowAccountQuestionTab() gw =", gw) - if (gw.T == nil) { - log.Println("ShowAccountQuestionTab() gw.T = nil THIS IS BAD") + if (gw.UiTab == nil) { + log.Println("ShowAccountQuestionTab() gw.UiTab = nil THIS IS BAD") os.Exit(-1) } - gw.T.Delete(0) + gw.UiTab.Delete(0) log.Println("Sleep(200)") time.Sleep(200 * time.Millisecond) abox := AddAccountQuestionBox(gw) - gw.BoxMap["MAIN"] = abox + gw.BoxMap["Box2"] = abox // gw.Box2 = AddAccountQuestionBox(gw) - gw.T.InsertAt("New Account?", 0, abox.UiBox) - gw.T.SetMargined(0, true) + gw.UiTab.InsertAt("New Account?", 0, abox.UiBox) + gw.UiTab.SetMargined(0, true) } func ShowAccountTab(gw *GuiWindow, i int) { @@ -188,33 +196,34 @@ func ShowAccountTab(gw *GuiWindow, i int) { abox := AddAccountBox(gw) // Set the parents and data structure links - // aTab.me = gw.T + // aTab.me = gw.UiTab // aTab.parentWindow = Data.Window1.W // aTab.tabOffset = 0 if (i >= 0) { log.Println("ShowAccountTab() InsertAt i=", i) - gw.T.Delete(0) - gw.T.InsertAt("Add Account", i, abox.UiBox) - gw.T.SetMargined(0, true) + gw.UiTab.Delete(0) + gw.UiTab.InsertAt("Add Account", i, abox.UiBox) + gw.UiTab.SetMargined(0, true) } else { // TODO: After append try to discover the tab index # log.Println("ShowAccountTab() Append") - AddBoxToTab("Create New Account", gw.T, abox.UiBox) + AddBoxToTab("Create New Account", gw.UiTab, abox.UiBox) } } func ShowMainTab(gw *GuiWindow) { log.Println("ShowMainTab() gw =", gw) - log.Println("ShowMainTab() gw.T =", gw.T) - gw.T.Delete(0) + log.Println("ShowMainTab() gw.UiTab =", gw.UiTab) + gw.UiTab.Delete(0) log.Println("Sleep(200)") time.Sleep(200 * time.Millisecond) - gw.Box2 = makeCloudInfoBox(gw) - gw.T.InsertAt("Main", 0, gw.Box2) - gw.T.SetMargined(0, true) + abox := makeCloudInfoBox(gw) + gw.BoxMap["Box3"] = abox + gw.UiTab.InsertAt("Main", 0, abox.UiBox) + gw.UiTab.SetMargined(0, true) } func GuiInit() { @@ -277,8 +286,8 @@ func InitWindow(gw *GuiWindow) { return true }) - gw.T = ui.NewTab() - gw.W.SetChild(gw.T) + gw.UiTab = ui.NewTab() + gw.W.SetChild(gw.UiTab) gw.W.SetMargined(true) log.Println("InitWindow() gw =", gw) @@ -289,10 +298,10 @@ func InitWindow(gw *GuiWindow) { damnit := "click" + string(c.Hostname) tmp := getSplashText(damnit) log.Println("InitWindow() TRYING SPLASH tmp =", tmp) - gw.Box1 = ShowSplashBox(gw, tmp) + abox := ShowSplashBox(gw, tmp) - gw.T.Append("WIT Splash", gw.Box1) - gw.T.SetMargined(0, true) + gw.UiTab.Append("WIT Splash", abox.UiBox) + gw.UiTab.SetMargined(0, true) } Data.State = "splash" diff --git a/splash.go b/splash.go index 397430e..f6ad7e2 100644 --- a/splash.go +++ b/splash.go @@ -11,7 +11,7 @@ import "runtime" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box { +func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *GuiBox { log.Println("ShowSplashBox() START") log.Println("ShowSplashBox() START wm =", wm) if (wm == nil) { @@ -19,14 +19,23 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box { os.Exit(0) return nil } + var gb *GuiBox + gb = new(GuiBox) + + gb.EntryMap = make(map[string]*GuiEntry) + gb.EntryMap["test"] = nil + newbox := ui.NewVerticalBox() newbox.SetPadded(true) + // gw.Box1 = hbox + gb.UiBox = newbox // initialize the GuiArea{} wm.Area = new(GuiArea) wm.Area.Window = wm wm.Area.UiAttrstr = newText makeSplashArea(wm, wm.Area) + gb.Area = wm.Area newbox.Append(wm.Area.UiArea, true) @@ -65,5 +74,5 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box { newbox.Append(okButton.B, false) // os.Exit(0) - return newbox + return gb } diff --git a/structs.go b/structs.go index 16e0291..929ad17 100644 --- a/structs.go +++ b/structs.go @@ -76,10 +76,10 @@ type GuiWindow struct { C *pb.Config W *ui.Window - T *ui.Tab // if this != nil, the window is 'tabbed' + UiTab *ui.Tab // if this != nil, the window is 'tabbed' BoxMap map[string]*GuiBox - Box1 *ui.Box - Box2 *ui.Box +// Box1 *ui.Box +// Box2 *ui.Box } diff --git a/vmBox.go b/vmBox.go index 2f811e9..60d5af6 100644 --- a/vmBox.go +++ b/vmBox.go @@ -11,7 +11,7 @@ import pb "git.wit.com/wit/witProtobuf" import "github.com/davecgh/go-spew/spew" func AddVmConfigureTab(wm *GuiWindow, name string, pbVM *pb.Event_VM) { - CreateVmBox(wm, wm.T, pbVM) + CreateVmBox(wm, wm.UiTab, pbVM) } func CreateVmBox(wm *GuiWindow, tab *ui.Tab, vm *pb.Event_VM) {