From 7d72ca3561fefd4c89f553448810eee545a47880 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 1 Jun 2019 13:41:45 -0700 Subject: start handling 'Guiwindow' correctly Signed-off-by: Jeff Carr --- area.go | 17 +++++++++-------- gui.go | 2 +- misc.go | 6 +++++- structs.go | 1 - 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/area.go b/area.go index dd7d20a..7087534 100644 --- a/area.go +++ b/area.go @@ -17,18 +17,19 @@ func makeSplashArea(gb *GuiBox, newText *ui.AttributedString) { newB.Box = gb newB.GW = gb.Window + gw := gb.Window // initialize the GuiArea{} - gb.Area = new(GuiArea) - gb.Area.Button = newB - gb.Area.Box = gb - gb.Area.UiAttrstr = newText - gb.Area.UiArea = ui.NewArea(gb.Area) + gw.Area = new(GuiArea) + gw.Area.Button = newB + gw.Area.Box = gb + gw.Area.UiAttrstr = newText + gw.Area.UiArea = ui.NewArea(gw.Area) if (Data.Debug) { - spew.Dump(gb.Area.UiArea) + spew.Dump(gw.Area.UiArea) log.Println("DEBUGGING", Data.Debug) } else { - log.Println("NOT DEBUGGING AREA mhAH.Button =", gb.Area.Button) + log.Println("NOT DEBUGGING AREA mhAH.Button =", gw.Area.Button) } } @@ -128,7 +129,7 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString) *GuiBox { gw.BoxMap["Splash"] = gb makeSplashArea(gb, newText) - newbox.Append(gb.Area.UiArea, true) + newbox.Append(gw.Area.UiArea, true) return gb } diff --git a/gui.go b/gui.go index 42b9297..f60fee1 100644 --- a/gui.go +++ b/gui.go @@ -197,7 +197,7 @@ func CreateFontButton(box *GuiBox, action string) *GuiButton { newGB.Action = action newGB.FB = ui.NewFontButton() newGB.Box = box - newGB.Area = box.Area + newGB.Area = box.Window.Area Data.AllButtons = append(Data.AllButtons, &newGB) newGB.FB.OnChanged(func (*ui.FontButton) { diff --git a/misc.go b/misc.go index bfc9a7d..6a617e8 100644 --- a/misc.go +++ b/misc.go @@ -36,10 +36,14 @@ func GuiInit() { }) } -func ShowMainTab(gw *GuiWindow) *GuiBox { +func AddMainTab(gw *GuiWindow) *GuiBox { log.Println("ShowMainTab() gw =", gw) log.Println("ShowMainTab() gw.UiTab =", gw.UiTab) + newWindow := new(GuiWindow) + newWindow.UiWindow = gw.UiWindow + Data.Windows = append(Data.Windows, newWindow) + var box *GuiBox box = new(GuiBox) box.Window = gw diff --git a/structs.go b/structs.go index 6c72ed3..6370705 100644 --- a/structs.go +++ b/structs.go @@ -122,7 +122,6 @@ type GuiButton struct { type GuiBox struct { Window *GuiWindow EntryMap map[string]*GuiEntry - Area *GuiArea // andlabs/ui abstraction mapping UiBox *ui.Box -- cgit v1.2.3