more button cleanups

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-03 00:50:05 -07:00
parent b0d0c09c21
commit 1e28641cde
2 changed files with 15 additions and 27 deletions

39
box.go
View File

@ -63,41 +63,26 @@ func add(box *GuiBox, newbox *GuiBox) {
log.Println("gui.add() END") log.Println("gui.add() END")
} }
/* func NewBox(box *GuiBox, axis int, name string) *GuiBox {
func HardHorizontalBox(gw *GuiWindow) *GuiBox {
log.Println("HardHorizontalBreak START")
box := gw.BoxMap["MAINBOX"]
if (box != nil) { HorizontalBreak(box) }
var newbox *GuiBox
newbox = new(GuiBox)
newbox.Window = gw
hbox := ui.NewVerticalBox()
hbox.SetPadded(true)
newbox.UiBox = hbox
newbox.Name = "Hbox1 HARD"
add(gw.BoxMap["MAINBOX"], newbox)
log.Println("HardHorizontalBreak END")
return newbox
}
*/
func VerticalBox(box *GuiBox, name string) *GuiBox {
log.Println("VerticalBox START") log.Println("VerticalBox START")
var newbox *GuiBox var newbox *GuiBox
newbox = new(GuiBox) newbox = new(GuiBox)
newbox.Window = box.Window newbox.Window = box.Window
newbox.Name = name newbox.Name = name
vbox := ui.NewVerticalBox() var uiBox *ui.Box
vbox.SetPadded(true) if (axis == Xaxis) {
newbox.UiBox = vbox uiBox = ui.NewHorizontalBox()
} else {
uiBox = ui.NewVerticalBox()
}
uiBox.SetPadded(true)
newbox.UiBox = uiBox
add(box, newbox) add(box, newbox)
return newbox return newbox
} }
func HardBox(gw *GuiWindow, axis int) *GuiBox { func HardBox(gw *GuiWindow, axis int, name string) *GuiBox {
log.Println("HardBox() START axis =", axis) log.Println("HardBox() START axis =", axis)
// add a Vertical Seperator if there is already a box // add a Vertical Seperator if there is already a box
@ -124,7 +109,7 @@ func HardBox(gw *GuiWindow, axis int) *GuiBox {
newbox := new(GuiBox) newbox := new(GuiBox)
newbox.Window = gw newbox.Window = gw
newbox.UiBox = uiBox newbox.UiBox = uiBox
newbox.Name = "Vbox1 HARD" newbox.Name = name
add(gw.BoxMap["MAINBOX"], newbox) add(gw.BoxMap["MAINBOX"], newbox)
@ -144,6 +129,7 @@ func VerticalBreak(box *GuiBox) {
box.UiBox.Append(tmp, false) box.UiBox.Append(tmp, false)
} }
/*
func AddGenericBox(gw *GuiWindow, name string) *GuiBox { func AddGenericBox(gw *GuiWindow, name string) *GuiBox {
log.Println("AddGenericBox() START name =", name) log.Println("AddGenericBox() START name =", name)
// create a new vertical box off of the mainbox // create a new vertical box off of the mainbox
@ -170,3 +156,4 @@ func AddGenericBox(gw *GuiWindow, name string) *GuiBox {
return newbox return newbox
} }
*/

View File

@ -80,7 +80,8 @@ type GuiWindow struct {
// There can be lots of these for each GuiWindow // There can be lots of these for each GuiWindow
type GuiBox struct { type GuiBox struct {
Name string // field for human readable name Name string // field for human readable name
Window *GuiWindow Axis int // does it add items to the X or Y axis
Window *GuiWindow // the parent Window
// andlabs/ui abstraction mapping // andlabs/ui abstraction mapping
UiBox *ui.Box UiBox *ui.Box