parent
2efce7f0cb
commit
20a402f106
4
area.go
4
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)
|
||||
|
|
21
gui.go
21
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
|
||||
|
||||
|
|
4
misc.go
4
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")
|
||||
|
|
21
structs.go
21
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue