see if an interface can store the outside values
also finally fixed the splash area logic Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
1366012bc9
commit
5536e659ae
20
area.go
20
area.go
|
@ -14,7 +14,6 @@ func makeGenericArea(gb *GuiBox, newText *ui.AttributedString, custom func(*GuiB
|
|||
newB = CreateFontButton(gb, "AREA")
|
||||
newB.Box = gb
|
||||
newB.Custom = custom
|
||||
// newB.GW = gb.Window
|
||||
|
||||
gw := gb.Window
|
||||
// initialize the GuiArea{}
|
||||
|
@ -116,10 +115,21 @@ func ShowTextBox(gw *GuiWindow, newText *ui.AttributedString, custom func(*GuiBu
|
|||
}
|
||||
log.Println("ShowTextBox() START gw =", gw)
|
||||
|
||||
box := InitGuiBox(gw, nil, ui.NewVerticalBox(), "SplashArea3")
|
||||
var newbox *GuiBox
|
||||
newbox = new(GuiBox)
|
||||
newbox.Window = gw
|
||||
newbox.Name = "Hbox1"
|
||||
hbox := ui.NewVerticalBox()
|
||||
newbox.UiBox = hbox
|
||||
|
||||
makeGenericArea(box, newText, custom)
|
||||
box.UiBox.Append(box.Window.Area.UiArea, true)
|
||||
// TODO: allow padded & axis here
|
||||
hbox.SetPadded(true)
|
||||
|
||||
return box
|
||||
add(gw.BoxMap["MAINBOX"], newbox)
|
||||
// box := InitGuiBox(gw, nil, ui.NewVerticalBox(), "SplashArea3")
|
||||
|
||||
makeGenericArea(newbox, newText, custom)
|
||||
newbox.UiBox.Append(newbox.Window.Area.UiArea, true)
|
||||
|
||||
return newbox
|
||||
}
|
||||
|
|
3
box.go
3
box.go
|
@ -5,9 +5,6 @@ import "log"
|
|||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
// import pb "git.wit.com/wit/witProtobuf"
|
||||
// import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
// add(nil, newbox, "") // use this when the Window is created. Always called 'MAINBOX'
|
||||
// add(gw.BoxMap["MAINBOX"], newbox, name) // use this to add a box off the main box
|
||||
// add(gw.BoxMap["BUTTONBOX"], newbox, name) // use this to add something to the box called 'BUTTONBOX'
|
||||
|
|
21
button.go
21
button.go
|
@ -73,6 +73,27 @@ func CreateButton(box *GuiBox, a *pb.Account, vm *pb.Event_VM, name string, acti
|
|||
return newB
|
||||
}
|
||||
|
||||
func NewCreateButton(box *GuiBox, custom func(*GuiButton), name string, values interface {}) *GuiButton {
|
||||
newUiB := ui.NewButton(name)
|
||||
newUiB.OnClicked(defaultButtonClick)
|
||||
|
||||
var newB *GuiButton
|
||||
newB = new(GuiButton)
|
||||
newB.B = newUiB
|
||||
if (box.Window == nil) {
|
||||
log.Println("CreateButton() box.Window == nil")
|
||||
panic("crap")
|
||||
}
|
||||
newB.Box = box
|
||||
newB.Custom = custom
|
||||
newB.Values = values
|
||||
|
||||
Data.AllButtons = append(Data.AllButtons, newB)
|
||||
|
||||
box.UiBox.Append(newB.B, false)
|
||||
return newB
|
||||
}
|
||||
|
||||
func CreateFontButton(box *GuiBox, action string) *GuiButton {
|
||||
// create a 'fake' button entry for the mouse clicks
|
||||
var newGB GuiButton
|
||||
|
|
1
entry.go
1
entry.go
|
@ -6,7 +6,6 @@ import "fmt"
|
|||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
import "github.com/davecgh/go-spew/spew"
|
||||
// import pb "git.wit.com/wit/witProtobuf"
|
||||
|
||||
// THIS IS CLEAN (except the 'Memory' normalization example)
|
||||
|
||||
|
|
23
gui.go
23
gui.go
|
@ -3,25 +3,20 @@ package gui
|
|||
import "log"
|
||||
import "time"
|
||||
import "regexp"
|
||||
// import "os"
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
// import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
const Xaxis = 0
|
||||
const Yaxis = 1
|
||||
|
||||
func GuiInit() {
|
||||
ui.OnShouldQuit(func() bool {
|
||||
// mouseClick(&newBM)
|
||||
ui.Quit()
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
// func InitGuiWindow(c *pb.Config, action string, maketab func(*GuiWindow) *GuiBox, uiW *ui.Window, uiT *ui.Tab) *GuiWindow {
|
||||
func InitGuiWindow(action string, gw *GuiWindow) *GuiWindow {
|
||||
log.Println("InitGuiWindow() START")
|
||||
var newGuiWindow GuiWindow
|
||||
|
@ -45,6 +40,7 @@ func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) {
|
|||
log.Println("StartNewWindow() Create a new window")
|
||||
var junk GuiWindow
|
||||
junk.MakeWindow = callback
|
||||
junk.Action = action
|
||||
window := InitGuiWindow(action, &junk)
|
||||
if (bg) {
|
||||
log.Println("StartNewWindow() START NEW GOROUTINE for ui.Main()")
|
||||
|
@ -63,19 +59,11 @@ func StartNewWindow(bg bool, action string, callback func(*GuiWindow) *GuiBox) {
|
|||
}
|
||||
|
||||
func InitTabWindow(gw *GuiWindow) {
|
||||
log.Println("InitTabWindow() THIS WINDOW IS NOT YET SHOWN")
|
||||
log.Println("InitTabWindow() START. THIS WINDOW IS NOT YET SHOWN")
|
||||
|
||||
gw.UiWindow = ui.NewWindow("", int(gw.Width), int(gw.Height), true)
|
||||
gw.UiWindow = ui.NewWindow("InitTabWindow()", int(gw.Width), int(gw.Height), true)
|
||||
gw.UiWindow.SetBorderless(false)
|
||||
|
||||
// create a 'fake' button entry for the mouse clicks
|
||||
/*
|
||||
var newBM GuiButton
|
||||
newBM.Action = "QUIT"
|
||||
newBM.GW = gw
|
||||
Data.AllButtons = append(Data.AllButtons, &newBM)
|
||||
*/
|
||||
|
||||
gw.UiWindow.OnClosing(func(*ui.Window) bool {
|
||||
log.Println("InitTabWindow() OnClosing() THIS WINDOW IS CLOSING gw=", gw)
|
||||
ui.Quit()
|
||||
|
@ -86,9 +74,10 @@ func InitTabWindow(gw *GuiWindow) {
|
|||
gw.UiWindow.SetChild(gw.UiTab)
|
||||
gw.UiWindow.SetMargined(true)
|
||||
|
||||
log.Println("InitTabWindow() gw =", gw)
|
||||
|
||||
gw.MakeWindow(gw)
|
||||
box := gw.MakeWindow(gw)
|
||||
log.Println("InitTabWindow() END box =", box)
|
||||
log.Println("InitTabWindow() END gw =", gw)
|
||||
gw.UiWindow.Show()
|
||||
}
|
||||
|
||||
|
|
17
structs.go
17
structs.go
|
@ -95,14 +95,15 @@ type GuiBox struct {
|
|||
// call this 'GuiMouseClick'
|
||||
type GuiButton struct {
|
||||
Name string // field for human readable name
|
||||
Action string // what type of button
|
||||
Box *GuiBox // what box the button click was in
|
||||
|
||||
Account *pb.Account // associated with what account?
|
||||
VM *pb.Event_VM // associated with which VM?
|
||||
|
||||
// a callback function for the main application
|
||||
Custom func (*GuiButton)
|
||||
Values interface {}
|
||||
|
||||
Action string // what type of button
|
||||
Account *pb.Account // associated with what account?
|
||||
VM *pb.Event_VM // associated with which VM?
|
||||
|
||||
// andlabs/ui abstraction mapping
|
||||
B *ui.Button
|
||||
|
@ -119,9 +120,6 @@ type GuiEntry struct {
|
|||
B *GuiButton
|
||||
Box *GuiBox
|
||||
|
||||
Account *pb.Account
|
||||
VM *pb.Event_VM
|
||||
|
||||
// andlabs/ui abstraction mapping
|
||||
UiEntry *ui.Entry
|
||||
}
|
||||
|
@ -170,7 +168,6 @@ type TableData struct {
|
|||
Cells [20]CellData
|
||||
Human [20]HumanMap
|
||||
|
||||
Account *pb.Account // what account this table is for
|
||||
Box *GuiBox
|
||||
|
||||
lastRow int
|
||||
|
@ -198,7 +195,6 @@ type HumanCellData struct {
|
|||
TextID int
|
||||
Color color.RGBA
|
||||
ColorID int
|
||||
VM *pb.Event_VM
|
||||
Button *GuiButton
|
||||
}
|
||||
|
||||
|
@ -232,9 +228,6 @@ type RowData struct {
|
|||
doubleclick func() // what function to call if the user double clicks on it
|
||||
*/
|
||||
HumanData [20]HumanCellData
|
||||
|
||||
// The VM from the protobuf
|
||||
VM *pb.Event_VM
|
||||
}
|
||||
|
||||
//
|
||||
|
|
1
table.go
1
table.go
|
@ -97,7 +97,6 @@ func InitColumns(mh *TableData, parts []TableColumnData) {
|
|||
}
|
||||
}
|
||||
|
||||
// func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData, account *pb.Account) *TableData {
|
||||
func AddTableTab(gw *GuiWindow, name string, rowcount int, parts []TableColumnData) *TableData {
|
||||
mh := new(TableData)
|
||||
|
||||
|
|
Loading…
Reference in New Issue