parent
2efce7f0cb
commit
20a402f106
4
area.go
4
area.go
|
@ -15,7 +15,7 @@ func makeSplashArea(gb *GuiBox, newText *ui.AttributedString) {
|
||||||
var newB *GuiButton
|
var newB *GuiButton
|
||||||
newB = CreateFontButton(gb, "AREA")
|
newB = CreateFontButton(gb, "AREA")
|
||||||
newB.Box = gb
|
newB.Box = gb
|
||||||
newB.GW = gb.W
|
newB.GW = gb.Window
|
||||||
|
|
||||||
// initialize the GuiArea{}
|
// initialize the GuiArea{}
|
||||||
gb.Area = new(GuiArea)
|
gb.Area = new(GuiArea)
|
||||||
|
@ -124,7 +124,7 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString) *GuiBox {
|
||||||
newbox := ui.NewVerticalBox()
|
newbox := ui.NewVerticalBox()
|
||||||
newbox.SetPadded(true)
|
newbox.SetPadded(true)
|
||||||
gb.UiBox = newbox
|
gb.UiBox = newbox
|
||||||
gb.W = gw
|
gb.Window = gw
|
||||||
gw.BoxMap["Splash"] = gb
|
gw.BoxMap["Splash"] = gb
|
||||||
|
|
||||||
makeSplashArea(gb, newText)
|
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 := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
gb.UiBox = vbox
|
gb.UiBox = vbox
|
||||||
gb.W = gw
|
gb.Window = gw
|
||||||
gw.BoxMap[name] = gb
|
gw.BoxMap[name] = gb
|
||||||
mh.Box = 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
|
var newB *GuiButton
|
||||||
newB = new(GuiButton)
|
newB = new(GuiButton)
|
||||||
newB.B = newUiB
|
newB.B = newUiB
|
||||||
if (box.W == nil) {
|
if (box.Window == nil) {
|
||||||
log.Println("CreateButton() box.W == nil")
|
log.Println("CreateButton() box.Window == nil")
|
||||||
panic("crap")
|
panic("crap")
|
||||||
}
|
}
|
||||||
newB.GW = box.W
|
newB.GW = box.Window
|
||||||
newB.Account = a
|
newB.Account = a
|
||||||
newB.VM = vm
|
newB.VM = vm
|
||||||
newB.Box = box
|
newB.Box = box
|
||||||
newB.Action = action
|
newB.Action = action
|
||||||
newB.custom = custom
|
newB.custom = custom
|
||||||
Data.AllButtons = append(Data.AllButtons, newB)
|
Data.AllButtons = append(Data.AllButtons, newB)
|
||||||
|
|
||||||
return newB
|
return newB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +302,7 @@ func AddEntry(box *GuiBox, name string) *GuiEntry {
|
||||||
|
|
||||||
func HardHorizontalBreak(box *GuiBox) {
|
func HardHorizontalBreak(box *GuiBox) {
|
||||||
log.Println("HardHorizontalBreak START")
|
log.Println("HardHorizontalBreak START")
|
||||||
gw := box.W
|
gw := box.Window
|
||||||
mainbox := gw.mainbox
|
mainbox := gw.mainbox
|
||||||
|
|
||||||
tmp := ui.NewHorizontalSeparator()
|
tmp := ui.NewHorizontalSeparator()
|
||||||
|
@ -318,7 +317,7 @@ func HardHorizontalBreak(box *GuiBox) {
|
||||||
|
|
||||||
func HardVerticalBreak(box *GuiBox) {
|
func HardVerticalBreak(box *GuiBox) {
|
||||||
log.Println("HardVerticalBreak START")
|
log.Println("HardVerticalBreak START")
|
||||||
gw := box.W
|
gw := box.Window
|
||||||
mainbox := gw.mainbox
|
mainbox := gw.mainbox
|
||||||
|
|
||||||
tmp := ui.NewVerticalSeparator()
|
tmp := ui.NewVerticalSeparator()
|
||||||
|
@ -352,7 +351,7 @@ func AddGenericBox(gw *GuiWindow) *GuiBox {
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
// gw.Box1 = vbox
|
// gw.Box1 = vbox
|
||||||
gb.UiBox = vbox
|
gb.UiBox = vbox
|
||||||
gb.W = gw
|
gb.Window = gw
|
||||||
|
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
@ -370,7 +369,7 @@ func CreateGenericBox(gw *GuiWindow, b *GuiButton, name string) *GuiBox{
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
box.UiBox = vbox
|
box.UiBox = vbox
|
||||||
box.W = gw
|
box.Window = gw
|
||||||
gw.BoxMap["ADD VM" + name] = box
|
gw.BoxMap["ADD VM" + name] = box
|
||||||
|
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
|
@ -395,8 +394,8 @@ func CreateBox(gw *GuiWindow, name string) *GuiBox {
|
||||||
log.Println("CreateVmBox() vbox =", vbox)
|
log.Println("CreateVmBox() vbox =", vbox)
|
||||||
log.Println("CreateVmBox() box.UiBox =", box.UiBox)
|
log.Println("CreateVmBox() box.UiBox =", box.UiBox)
|
||||||
box.UiBox = vbox
|
box.UiBox = vbox
|
||||||
log.Println("CreateVmBox() box.W =", box.W)
|
log.Println("CreateVmBox() box.Window =", box.Window)
|
||||||
box.W = gw
|
box.Window = gw
|
||||||
log.Println("CreateVmBox() gw.BoxMap =", gw.BoxMap)
|
log.Println("CreateVmBox() gw.BoxMap =", gw.BoxMap)
|
||||||
gw.BoxMap[name] = box
|
gw.BoxMap[name] = box
|
||||||
|
|
||||||
|
|
4
misc.go
4
misc.go
|
@ -42,7 +42,7 @@ func ShowMainTab(gw *GuiWindow) *GuiBox {
|
||||||
|
|
||||||
var box *GuiBox
|
var box *GuiBox
|
||||||
box = new(GuiBox)
|
box = new(GuiBox)
|
||||||
box.W = gw
|
box.Window = gw
|
||||||
|
|
||||||
box.EntryMap = make(map[string]*GuiEntry)
|
box.EntryMap = make(map[string]*GuiEntry)
|
||||||
box.EntryMap["test"] = nil
|
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.Height = int(c.Height)
|
||||||
newGuiWindow.Action = action
|
newGuiWindow.Action = action
|
||||||
newGuiWindow.MakeWindow = maketab
|
newGuiWindow.MakeWindow = maketab
|
||||||
|
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
||||||
Data.Windows = append(Data.Windows, &newGuiWindow)
|
Data.Windows = append(Data.Windows, &newGuiWindow)
|
||||||
|
|
||||||
// make(newGuiWindow.BoxMap)
|
// make(newGuiWindow.BoxMap)
|
||||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
|
||||||
|
|
||||||
if (bg) {
|
if (bg) {
|
||||||
log.Println("ShowWindow() IN NEW GOROUTINE")
|
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
|
// A map of all buttons everywhere on all
|
||||||
// windows, all tabs, across all goroutines
|
// windows, all tabs, across all goroutines
|
||||||
// This is "GLOBAL"
|
// This is "GLOBAL"
|
||||||
|
//
|
||||||
|
// This has to work this way because of how
|
||||||
|
// andlabs/ui & andlabs/libui work
|
||||||
AllButtons []*GuiButton
|
AllButtons []*GuiButton
|
||||||
ButtonMap map[*GuiButton][]func (*GuiButton)
|
|
||||||
|
|
||||||
EntryNick *ui.Entry
|
EntryNick *ui.Entry
|
||||||
EntryUser *ui.Entry
|
EntryUser *ui.Entry
|
||||||
EntryPass *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
|
// More than one Window is not supported in a cross platform
|
||||||
// sense & may never be. On Windows and MacOS, you have to have
|
// sense & may never be. On Windows and MacOS, you have to have
|
||||||
// 'tabs'. Even under Linux, more than one Window is currently
|
// 'tabs'. Even under Linux, more than one Window is currently
|
||||||
// unstable
|
// unstable
|
||||||
//
|
//
|
||||||
// This code will keep track of if the windows is 'tabbed' or
|
// This code will make a 'GuiWindow' regardless of if it is
|
||||||
// not. You can draw one thing in the window, then destroy
|
// a stand alone window (which is more or less working on Linux)
|
||||||
// that, then redraw the window with something else
|
// 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
|
// This struct keeps track of what is in the window so you
|
||||||
// can destroy and replace it with something else
|
// can destroy and replace it with something else
|
||||||
|
@ -85,7 +91,6 @@ type GuiWindow struct {
|
||||||
BoxMap map[string]*GuiBox
|
BoxMap map[string]*GuiBox
|
||||||
EntryMap map[string]*GuiEntry
|
EntryMap map[string]*GuiEntry
|
||||||
Area *GuiArea
|
Area *GuiArea
|
||||||
ButtonMap map[*GuiButton][]func (*GuiButton)
|
|
||||||
|
|
||||||
// andlabs/ui abstraction mapping
|
// andlabs/ui abstraction mapping
|
||||||
UiWindow *ui.Window
|
UiWindow *ui.Window
|
||||||
|
@ -115,7 +120,7 @@ type GuiButton struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type GuiBox struct {
|
type GuiBox struct {
|
||||||
W *GuiWindow
|
Window *GuiWindow
|
||||||
EntryMap map[string]*GuiEntry
|
EntryMap map[string]*GuiEntry
|
||||||
Area *GuiArea
|
Area *GuiArea
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue