From 2ccc1b518ddc404a4dbdc41971005cf04cc06e66 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 6 Oct 2021 14:32:07 -0500 Subject: [PATCH] REFACTOR: things are back to working as they were Signed-off-by: Jeff Carr --- structs.go | 12 +++++++----- window.go | 7 ++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/structs.go b/structs.go index 71921bd..ad3307b 100644 --- a/structs.go +++ b/structs.go @@ -122,7 +122,8 @@ func (s GuiBox) Append(child ui.Control, x bool) { s.UiBox.Append(child, x) } -func (w GuiWindow) InitBox(title string) *GuiBox { +/* +func (w GuiWindow) InitWindow(title string) *GuiBox { if w.UiWindow == nil { log.Println("gui.InitBox() THIS SHOULD NEVER HAPPEN. Window doesn't exist", w) return nil @@ -131,14 +132,15 @@ func (w GuiWindow) InitBox(title string) *GuiBox { w.UiWindow.SetChild(tab) w.UiWindow.SetMargined(true) - tab.Append(title, initBlankWindow()) + tab.Append(title, InitBlankWindow()) tab.SetMargined(0, true) w.UiTab = tab return nil } +*/ -func (s GuiBox) InitTab(title string) *ui.Tab { +func (s GuiBox) InitTab(title string, custom func() ui.Control) *ui.Tab { if s.Window == nil { return nil } @@ -151,7 +153,7 @@ func (s GuiBox) InitTab(title string) *ui.Tab { window.SetChild(tab) window.SetMargined(true) - tab.Append(title, initBlankWindow()) + tab.Append(title, custom()) tab.SetMargined(0, true) // tab.SetMargined(1, true) @@ -187,7 +189,7 @@ func (s GuiBox) AddTab2(title string, custom ui.Control) *ui.Tab { } func (s GuiBox) AddBoxTab(title string) *GuiBox { - uiTab := s.AddTab2(title, initBlankWindow()) + uiTab := s.AddTab2(title, InitBlankWindow()) tabSetMargined(uiTab) var box *GuiBox diff --git a/window.go b/window.go index 24bd879..2b615b5 100644 --- a/window.go +++ b/window.go @@ -146,7 +146,7 @@ func DeleteWindow(name string) { func CreateWindow(title string, tabname string, x int, y int, custom func() ui.Control) *GuiBox { box := CreateBlankWindow(title, x, y) - box.InitTab(title) + box.InitTab(title, custom) return box } @@ -173,7 +173,7 @@ func CreateBlankWindow(title string, x int, y int) *GuiBox { return box } -func initBlankWindow() ui.Control { +func InitBlankWindow() ui.Control { hbox := ui.NewHorizontalBox() hbox.SetPadded(true) @@ -215,7 +215,7 @@ func mapWindow(window *ui.Window, title string, x int, y int) *GuiBox { return &box } -func NewWindow(title string, x int, y int) { +func NewWindow(title string, x int, y int) *GuiBox { box := mapWindow(nil, title, x, y) log.Println("gui.NewWindow() title = box.Name =", box.Name) @@ -235,4 +235,5 @@ func NewWindow(title string, x int, y int) { window.Show() box.Window.UiWindow = window + return box }