summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--area.go4
-rw-r--r--gui.go21
-rw-r--r--misc.go4
-rw-r--r--structs.go21
4 files changed, 27 insertions, 23 deletions
diff --git a/area.go b/area.go
index 42ea850..dd7d20a 100644
--- a/area.go
+++ b/area.go
@@ -15,7 +15,7 @@ func makeSplashArea(gb *GuiBox, newText *ui.AttributedString) {
var newB *GuiButton
newB = CreateFontButton(gb, "AREA")
newB.Box = gb
- newB.GW = gb.W
+ newB.GW = gb.Window
// initialize the GuiArea{}
gb.Area = new(GuiArea)
@@ -124,7 +124,7 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString) *GuiBox {
newbox := ui.NewVerticalBox()
newbox.SetPadded(true)
gb.UiBox = newbox
- gb.W = gw
+ gb.Window = gw
gw.BoxMap["Splash"] = gb
makeSplashArea(gb, newText)
diff --git a/gui.go b/gui.go
index d939294..42b9297 100644
--- a/gui.go
+++ b/gui.go
@@ -90,7 +90,7 @@ func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnDa
vbox := ui.NewVerticalBox()
vbox.SetPadded(true)
gb.UiBox = vbox
- gb.W = gw
+ gb.Window = gw
gw.BoxMap[name] = gb
mh.Box = gb
@@ -176,18 +176,17 @@ func CreateButton(box *GuiBox, a *pb.Account, vm *pb.Event_VM, name string, acti
var newB *GuiButton
newB = new(GuiButton)
newB.B = newUiB
- if (box.W == nil) {
- log.Println("CreateButton() box.W == nil")
+ if (box.Window == nil) {
+ log.Println("CreateButton() box.Window == nil")
panic("crap")
}
- newB.GW = box.W
+ newB.GW = box.Window
newB.Account = a
newB.VM = vm
newB.Box = box
newB.Action = action
newB.custom = custom
Data.AllButtons = append(Data.AllButtons, newB)
-
return newB
}
@@ -303,7 +302,7 @@ func AddEntry(box *GuiBox, name string) *GuiEntry {
func HardHorizontalBreak(box *GuiBox) {
log.Println("HardHorizontalBreak START")
- gw := box.W
+ gw := box.Window
mainbox := gw.mainbox
tmp := ui.NewHorizontalSeparator()
@@ -318,7 +317,7 @@ func HardHorizontalBreak(box *GuiBox) {
func HardVerticalBreak(box *GuiBox) {
log.Println("HardVerticalBreak START")
- gw := box.W
+ gw := box.Window
mainbox := gw.mainbox
tmp := ui.NewVerticalSeparator()
@@ -352,7 +351,7 @@ func AddGenericBox(gw *GuiWindow) *GuiBox {
vbox.SetPadded(true)
// gw.Box1 = vbox
gb.UiBox = vbox
- gb.W = gw
+ gb.Window = gw
hbox := ui.NewHorizontalBox()
hbox.SetPadded(true)
@@ -370,7 +369,7 @@ func CreateGenericBox(gw *GuiWindow, b *GuiButton, name string) *GuiBox{
vbox := ui.NewVerticalBox()
vbox.SetPadded(true)
box.UiBox = vbox
- box.W = gw
+ box.Window = gw
gw.BoxMap["ADD VM" + name] = box
hbox := ui.NewHorizontalBox()
@@ -395,8 +394,8 @@ func CreateBox(gw *GuiWindow, name string) *GuiBox {
log.Println("CreateVmBox() vbox =", vbox)
log.Println("CreateVmBox() box.UiBox =", box.UiBox)
box.UiBox = vbox
- log.Println("CreateVmBox() box.W =", box.W)
- box.W = gw
+ log.Println("CreateVmBox() box.Window =", box.Window)
+ box.Window = gw
log.Println("CreateVmBox() gw.BoxMap =", gw.BoxMap)
gw.BoxMap[name] = box
diff --git a/misc.go b/misc.go
index bc31844..bfc9a7d 100644
--- a/misc.go
+++ b/misc.go
@@ -42,7 +42,7 @@ func ShowMainTab(gw *GuiWindow) *GuiBox {
var box *GuiBox
box = new(GuiBox)
- box.W = gw
+ box.Window = gw
box.EntryMap = make(map[string]*GuiEntry)
box.EntryMap["test"] = nil
@@ -78,10 +78,10 @@ func StartNewWindow(c *pb.Config, bg bool, action string, maketab func(*GuiWindo
newGuiWindow.Height = int(c.Height)
newGuiWindow.Action = action
newGuiWindow.MakeWindow = maketab
+ newGuiWindow.BoxMap = make(map[string]*GuiBox)
Data.Windows = append(Data.Windows, &newGuiWindow)
// make(newGuiWindow.BoxMap)
- newGuiWindow.BoxMap = make(map[string]*GuiBox)
if (bg) {
log.Println("ShowWindow() IN NEW GOROUTINE")
diff --git a/structs.go b/structs.go
index e03145d..6c72ed3 100644
--- a/structs.go
+++ b/structs.go
@@ -49,24 +49,30 @@ type GuiData struct {
// A map of all buttons everywhere on all
// windows, all tabs, across all goroutines
// This is "GLOBAL"
+ //
+ // This has to work this way because of how
+ // andlabs/ui & andlabs/libui work
AllButtons []*GuiButton
- ButtonMap map[*GuiButton][]func (*GuiButton)
EntryNick *ui.Entry
EntryUser *ui.Entry
EntryPass *ui.Entry
}
-// stores information on 'the' window
-
+//
+// stores information on the 'window'
+//
+// This merges the concept of andlabs/ui *Window and *Tab
+//
// More than one Window is not supported in a cross platform
// sense & may never be. On Windows and MacOS, you have to have
// 'tabs'. Even under Linux, more than one Window is currently
// unstable
//
-// This code will keep track of if the windows is 'tabbed' or
-// not. You can draw one thing in the window, then destroy
-// that, then redraw the window with something else
+// This code will make a 'GuiWindow' regardless of if it is
+// a stand alone window (which is more or less working on Linux)
+// or a 'tab' inside a window (which is all that works on MacOS
+// and MSWindows.
//
// This struct keeps track of what is in the window so you
// can destroy and replace it with something else
@@ -85,7 +91,6 @@ type GuiWindow struct {
BoxMap map[string]*GuiBox
EntryMap map[string]*GuiEntry
Area *GuiArea
- ButtonMap map[*GuiButton][]func (*GuiButton)
// andlabs/ui abstraction mapping
UiWindow *ui.Window
@@ -115,7 +120,7 @@ type GuiButton struct {
}
type GuiBox struct {
- W *GuiWindow
+ Window *GuiWindow
EntryMap map[string]*GuiEntry
Area *GuiArea