diff options
| author | Jeff Carr <[email protected]> | 2019-06-04 00:56:58 -0700 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2019-06-04 00:56:58 -0700 |
| commit | d29532d07802da2ace0c73fc8d445843a3136594 (patch) | |
| tree | d08d0054a7c0eb9057acf4e1d3517c7a6c641123 | |
| parent | 63f607beb6f0b7ac8374e311fe817e20c541639a (diff) | |
finally fix the window and tab names
Signed-off-by: Jeff Carr <[email protected]>
| -rw-r--r-- | structs.go | 1 | ||||
| -rw-r--r-- | window.go | 18 |
2 files changed, 12 insertions, 7 deletions
@@ -63,6 +63,7 @@ type GuiWindow struct { Name string // field for human readable name Width int Height int + Axis int // does it add items to the X or Y axis // the callback function to make the window contents MakeWindow func(*GuiWindow) *GuiBox @@ -7,15 +7,18 @@ import "time" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow { +func InitGuiWindow(gw *GuiWindow) *GuiWindow { log.Println("InitGuiWindow() START") var newGuiWindow GuiWindow newGuiWindow.Width = Config.Width newGuiWindow.Height = Config.Height - newGuiWindow.Name = name + + newGuiWindow.Axis = gw.Axis newGuiWindow.MakeWindow = gw.MakeWindow newGuiWindow.UiWindow = gw.UiWindow newGuiWindow.UiTab = gw.UiTab + newGuiWindow.Name = gw.Name + newGuiWindow.BoxMap = make(map[string]*GuiBox) newGuiWindow.EntryMap = make(map[string]*GuiEntry) newGuiWindow.EntryMap["test"] = nil @@ -25,7 +28,7 @@ func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow { log.Println("gui.InitGuiWindow() making the Data.WindowMap here") Data.WindowMap = make(map[string]*GuiWindow) } - Data.WindowMap[name] = &newGuiWindow + Data.WindowMap[newGuiWindow.Name] = &newGuiWindow if (Data.buttonMap == nil) { GuiInit() @@ -35,11 +38,13 @@ func InitGuiWindow(name string, gw *GuiWindow) *GuiWindow { } -func StartNewWindow(bg bool, name string, callback func(*GuiWindow) *GuiBox) { +func StartNewWindow(bg bool, name string, axis int, callback func(*GuiWindow) *GuiBox) { log.Println("StartNewWindow() Create a new window") var junk GuiWindow junk.MakeWindow = callback - window := InitGuiWindow(name, &junk) + junk.Name = name + junk.Axis = axis + window := InitGuiWindow(&junk) if (bg) { log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()") go ui.Main(func() { @@ -59,7 +64,7 @@ func StartNewWindow(bg bool, name string, callback func(*GuiWindow) *GuiBox) { func InitTabWindow(gw *GuiWindow) { log.Println("InitTabWindow() START. THIS WINDOW IS NOT YET SHOWN") - gw.UiWindow = ui.NewWindow("InitTabWindow()", int(gw.Width), int(gw.Height), true) + gw.UiWindow = ui.NewWindow(gw.Name, int(gw.Width), int(gw.Height), true) gw.UiWindow.SetBorderless(false) gw.UiWindow.OnClosing(func(*ui.Window) bool { @@ -72,7 +77,6 @@ func InitTabWindow(gw *GuiWindow) { gw.UiWindow.SetChild(gw.UiTab) gw.UiWindow.SetMargined(true) - box := gw.MakeWindow(gw) log.Println("InitTabWindow() END box =", box) log.Println("InitTabWindow() END gw =", gw) |
