BOX: kill GuiBox
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
df1978e6a8
commit
d6980daa81
|
@ -50,7 +50,7 @@ func CreateFontButton(n *Node, action string) *GuiButton {
|
||||||
var newGB GuiButton
|
var newGB GuiButton
|
||||||
newGB.Name = "FONT"
|
newGB.Name = "FONT"
|
||||||
newGB.FB = ui.NewFontButton()
|
newGB.FB = ui.NewFontButton()
|
||||||
newGB.Box = n.box
|
// newGB.Box = n.box
|
||||||
Data.AllButtons = append(Data.AllButtons, &newGB)
|
Data.AllButtons = append(Data.AllButtons, &newGB)
|
||||||
|
|
||||||
newGB.FB.OnChanged(func (*ui.FontButton) {
|
newGB.FB.OnChanged(func (*ui.FontButton) {
|
||||||
|
@ -67,7 +67,7 @@ func CreateColorButton(n *Node, custom func(*GuiButton), name string, values int
|
||||||
var newCB GuiButton
|
var newCB GuiButton
|
||||||
newCB.Name = name
|
newCB.Name = name
|
||||||
newCB.CB = ui.NewColorButton()
|
newCB.CB = ui.NewColorButton()
|
||||||
newCB.Box = n.box
|
// newCB.Box = n.box
|
||||||
newCB.Custom = custom
|
newCB.Custom = custom
|
||||||
newCB.Values = values
|
newCB.Values = values
|
||||||
|
|
||||||
|
@ -83,6 +83,6 @@ func CreateColorButton(n *Node, custom func(*GuiButton), name string, values int
|
||||||
Data.MouseClick(&newCB)
|
Data.MouseClick(&newCB)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
n.box.Append(newCB.CB, false)
|
n.uiBox.Append(newCB.CB, false)
|
||||||
return &newCB
|
return &newCB
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,6 +295,7 @@ func dumpBox(s string) {
|
||||||
// log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow))
|
// log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow))
|
||||||
log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow)
|
log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow)
|
||||||
log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
||||||
|
/*
|
||||||
log.Println("gui.dumpBox() BoxMap START")
|
log.Println("gui.dumpBox() BoxMap START")
|
||||||
for name, abox := range window.BoxMap {
|
for name, abox := range window.BoxMap {
|
||||||
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||||
|
@ -307,6 +308,7 @@ func dumpBox(s string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Println("gui.dumpBox() BoxMap END")
|
log.Println("gui.dumpBox() BoxMap END")
|
||||||
|
*/
|
||||||
if window.UiTab != nil {
|
if window.UiTab != nil {
|
||||||
pages := window.UiTab.NumPages()
|
pages := window.UiTab.NumPages()
|
||||||
log.Println("gui.DumpBoxes()\tWindow.UiTab.NumPages() =", pages)
|
log.Println("gui.DumpBoxes()\tWindow.UiTab.NumPages() =", pages)
|
||||||
|
|
6
debug.go
6
debug.go
|
@ -40,10 +40,12 @@ func DumpWindows() {
|
||||||
func DumpMap() {
|
func DumpMap() {
|
||||||
for name, window := range Data.WindowMap {
|
for name, window := range Data.WindowMap {
|
||||||
log.Println("gui.DumpBoxes() MAP: ", name)
|
log.Println("gui.DumpBoxes() MAP: ", name)
|
||||||
log.Println("gui.DumpBoxes() BOXES:", name)
|
log.Println("gui.DumpBoxes() window:", window)
|
||||||
|
/*
|
||||||
for name, abox := range window.BoxMap {
|
for name, abox := range window.BoxMap {
|
||||||
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +61,7 @@ func DumpBoxes() {
|
||||||
// log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow))
|
// log.Println("gui.DumpBoxes()\tWindow.UiWindow type =", reflect.TypeOf(window.UiWindow))
|
||||||
log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow)
|
log.Println("gui.DumpBoxes()\tWindow.UiWindow =", window.UiWindow)
|
||||||
log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
||||||
|
/*
|
||||||
for name, abox := range window.BoxMap {
|
for name, abox := range window.BoxMap {
|
||||||
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
log.Printf("gui.DumpBoxes() \tBOX mapname=%-12s abox.Name=%-12s", name, abox.Name)
|
||||||
if name == "MAINBOX" {
|
if name == "MAINBOX" {
|
||||||
|
@ -68,6 +71,7 @@ func DumpBoxes() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if window.UiTab != nil {
|
if window.UiTab != nil {
|
||||||
// log.Println("gui.DumpBoxes()\tWindow.UiTab type =", reflect.TypeOf(window.UiTab))
|
// log.Println("gui.DumpBoxes()\tWindow.UiTab type =", reflect.TypeOf(window.UiTab))
|
||||||
// log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
// log.Println("gui.DumpBoxes()\tWindow.UiTab =", window.UiTab)
|
||||||
|
|
|
@ -50,7 +50,6 @@ type Node struct {
|
||||||
children []*Node
|
children []*Node
|
||||||
|
|
||||||
window *GuiWindow
|
window *GuiWindow
|
||||||
box *GuiBox
|
|
||||||
area *GuiArea
|
area *GuiArea
|
||||||
custom func(*Node)
|
custom func(*Node)
|
||||||
|
|
||||||
|
@ -85,7 +84,7 @@ func (n *Node) Dump() {
|
||||||
log.Println("gui.Node.Dump() children = ", n.children)
|
log.Println("gui.Node.Dump() children = ", n.children)
|
||||||
|
|
||||||
log.Println("gui.Node.Dump() window = ", n.window)
|
log.Println("gui.Node.Dump() window = ", n.window)
|
||||||
log.Println("gui.Node.Dump() box = ", n.box)
|
// log.Println("gui.Node.Dump() box = ", n.box)
|
||||||
|
|
||||||
log.Println("gui.Node.Dump() uiWindow = ", n.uiWindow)
|
log.Println("gui.Node.Dump() uiWindow = ", n.uiWindow)
|
||||||
log.Println("gui.Node.Dump() uiTab = ", n.uiTab)
|
log.Println("gui.Node.Dump() uiTab = ", n.uiTab)
|
||||||
|
@ -237,10 +236,12 @@ func (n *Node) AddTab(title string, uiC *ui.Box) *Node {
|
||||||
log.Println("gui.Node.AddTab() ERROR ui.Window == nil")
|
log.Println("gui.Node.AddTab() ERROR ui.Window == nil")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if parent.box == nil {
|
if parent.box == nil {
|
||||||
parent.Dump()
|
parent.Dump()
|
||||||
// panic("gui.AddTab() ERROR box == nil")
|
// panic("gui.AddTab() ERROR box == nil")
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if parent.uiTab == nil {
|
if parent.uiTab == nil {
|
||||||
inittab := ui.NewTab() // no, not that 'inittab'
|
inittab := ui.NewTab() // no, not that 'inittab'
|
||||||
parent.uiWindow.SetChild(inittab)
|
parent.uiWindow.SetChild(inittab)
|
||||||
|
|
16
structs.go
16
structs.go
|
@ -94,7 +94,7 @@ type GuiWindow struct {
|
||||||
// MakeWindow func(*GuiBox) *GuiBox
|
// MakeWindow func(*GuiBox) *GuiBox
|
||||||
|
|
||||||
// the components of the window
|
// the components of the window
|
||||||
BoxMap map[string]*GuiBox
|
// BoxMap map[string]*GuiBox
|
||||||
EntryMap map[string]*GuiEntry
|
EntryMap map[string]*GuiEntry
|
||||||
Area *GuiArea
|
Area *GuiArea
|
||||||
|
|
||||||
|
@ -112,6 +112,7 @@ func (w *GuiWindow) Dump() {
|
||||||
log.Println("gui.GuiWindow.Dump() Height = ", w.Height)
|
log.Println("gui.GuiWindow.Dump() Height = ", w.Height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
// GuiBox is any type of ui.Hbox or ui.Vbox
|
// GuiBox is any type of ui.Hbox or ui.Vbox
|
||||||
// There can be lots of these for each GuiWindow
|
// There can be lots of these for each GuiWindow
|
||||||
type GuiBox struct {
|
type GuiBox struct {
|
||||||
|
@ -124,7 +125,9 @@ type GuiBox struct {
|
||||||
// andlabs/ui abstraction mapping
|
// andlabs/ui abstraction mapping
|
||||||
UiBox *ui.Box
|
UiBox *ui.Box
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
func (b *GuiBox) Dump() {
|
func (b *GuiBox) Dump() {
|
||||||
log.Println("gui.GuiBox.Dump() Name = ", b.Name)
|
log.Println("gui.GuiBox.Dump() Name = ", b.Name)
|
||||||
log.Println("gui.GuiBox.Dump() Axis = ", b.Axis)
|
log.Println("gui.GuiBox.Dump() Axis = ", b.Axis)
|
||||||
|
@ -144,6 +147,7 @@ func (b *GuiBox) SetTitle(title string) {
|
||||||
b.Window.UiWindow.SetTitle(title)
|
b.Window.UiWindow.SetTitle(title)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (w *GuiWindow) SetNode(n *Node) {
|
func (w *GuiWindow) SetNode(n *Node) {
|
||||||
if (w.node != nil) {
|
if (w.node != nil) {
|
||||||
|
@ -157,6 +161,7 @@ func (w *GuiWindow) SetNode(n *Node) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (b *GuiBox) SetNode(n *Node) {
|
func (b *GuiBox) SetNode(n *Node) {
|
||||||
if (b.node != nil) {
|
if (b.node != nil) {
|
||||||
b.Dump()
|
b.Dump()
|
||||||
|
@ -176,6 +181,7 @@ func (b *GuiBox) Append(child ui.Control, x bool) {
|
||||||
}
|
}
|
||||||
b.UiBox.Append(child, x)
|
b.UiBox.Append(child, x)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Note: every mouse click is handled
|
// Note: every mouse click is handled
|
||||||
// as a 'Button' regardless of where
|
// as a 'Button' regardless of where
|
||||||
|
@ -183,7 +189,7 @@ func (b *GuiBox) Append(child ui.Control, x bool) {
|
||||||
// call this 'GuiMouseClick'
|
// call this 'GuiMouseClick'
|
||||||
type GuiButton struct {
|
type GuiButton struct {
|
||||||
Name string // field for human readable name
|
Name string // field for human readable name
|
||||||
Box *GuiBox // what box the button click was in
|
// box2 *GuiBox // what box the button click was in
|
||||||
|
|
||||||
// a callback function for the main application
|
// a callback function for the main application
|
||||||
Custom func(*GuiButton)
|
Custom func(*GuiButton)
|
||||||
|
@ -204,7 +210,7 @@ type GuiEntry struct {
|
||||||
Normalize func(string) string // function to 'normalize' the data
|
Normalize func(string) string // function to 'normalize' the data
|
||||||
|
|
||||||
B *GuiButton
|
B *GuiButton
|
||||||
Box *GuiBox
|
// Box *GuiBox
|
||||||
|
|
||||||
// andlabs/ui abstraction mapping
|
// andlabs/ui abstraction mapping
|
||||||
UiEntry *ui.Entry
|
UiEntry *ui.Entry
|
||||||
|
@ -217,7 +223,7 @@ type GuiEntry struct {
|
||||||
//
|
//
|
||||||
type GuiArea struct {
|
type GuiArea struct {
|
||||||
Button *GuiButton // what button handles mouse events
|
Button *GuiButton // what button handles mouse events
|
||||||
Box *GuiBox
|
// Box *GuiBox
|
||||||
|
|
||||||
UiAttrstr *ui.AttributedString
|
UiAttrstr *ui.AttributedString
|
||||||
UiArea *ui.Area
|
UiArea *ui.Area
|
||||||
|
@ -255,7 +261,7 @@ type TableData struct {
|
||||||
Cells [20]CellData
|
Cells [20]CellData
|
||||||
Human [20]HumanMap
|
Human [20]HumanMap
|
||||||
|
|
||||||
Box *GuiBox
|
// Box *GuiBox
|
||||||
n *Node
|
n *Node
|
||||||
|
|
||||||
lastRow int
|
lastRow int
|
||||||
|
|
11
window.go
11
window.go
|
@ -154,23 +154,12 @@ func mapWindow(parent *Node, window *ui.Window, title string, x int, y int) *Nod
|
||||||
newGuiWindow.Name = title
|
newGuiWindow.Name = title
|
||||||
newGuiWindow.UiWindow = window
|
newGuiWindow.UiWindow = window
|
||||||
|
|
||||||
newGuiWindow.BoxMap = make(map[string]*GuiBox)
|
|
||||||
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
newGuiWindow.EntryMap = make(map[string]*GuiEntry)
|
||||||
|
|
||||||
Data.WindowMap[newGuiWindow.Name] = &newGuiWindow
|
Data.WindowMap[newGuiWindow.Name] = &newGuiWindow
|
||||||
|
|
||||||
/*
|
|
||||||
var box GuiBox
|
|
||||||
box.Window = &newGuiWindow
|
|
||||||
box.Name = title
|
|
||||||
*/
|
|
||||||
|
|
||||||
node := makeNode(parent, title, x, y)
|
node := makeNode(parent, title, x, y)
|
||||||
node.uiWindow = window
|
node.uiWindow = window
|
||||||
// node.box = &box
|
|
||||||
// box.node = node
|
|
||||||
|
|
||||||
// newGuiWindow.BoxMap["jcarrInitTest"] = &box
|
|
||||||
|
|
||||||
return node
|
return node
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue