parent
9cd895db6e
commit
88b7c27bb9
|
@ -1,28 +1,71 @@
|
|||
package main
|
||||
|
||||
// import "os"
|
||||
// import "log"
|
||||
import "os"
|
||||
import "log"
|
||||
|
||||
import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
import "git.wit.com/wit/gui"
|
||||
import pb "git.wit.com/wit/witProtobuf"
|
||||
|
||||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
func main() {
|
||||
c := pb.MakeDefaultConfig()
|
||||
|
||||
gui.Data.MouseClick = mainMouseClick
|
||||
|
||||
for {
|
||||
gui.InitNewWindow(c, "SPLASH")
|
||||
|
||||
// aWinMap := gui.InitGUI(c)
|
||||
// aWinMap.Action = "SPLASH"
|
||||
// log.Println("main() aWinMap =", aWinMap)
|
||||
gui.ShowWindow()
|
||||
|
||||
gui.InitNewWindow(c, "BLAH")
|
||||
// log.Println("main() bWinMap =", bWinMap)
|
||||
// bWinMap.Action = "BLAH"
|
||||
gui.ShowWindow()
|
||||
}
|
||||
|
||||
// gui.Data.Window2 = aWinMap
|
||||
// gui.GoMainWindow()
|
||||
}
|
||||
|
||||
// This is the handler for all mosue clicks (buttons, areas, etc))
|
||||
//
|
||||
// This is massive for a reason. EVERY MOUSE CLICK COMES HERE
|
||||
// the 'gui' code is kinda just a holder. It will pass everything
|
||||
// here and we have to sort out what to do with the click
|
||||
// at least, that is the current design because I thought it
|
||||
// might be a good approach. Time will tell...
|
||||
//
|
||||
func mainMouseClick(b *gui.ButtonMap) {
|
||||
if (b == nil) {
|
||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (button is nil) WHY DID THIS HAPPEN?")
|
||||
os.Exit(-1)
|
||||
}
|
||||
log.Println("mainMouseClick() b.Action =", b.Action)
|
||||
log.Println("mainMouseClick() b.Action =", b.Account)
|
||||
spew.Dump(b.Account)
|
||||
|
||||
var wm *gui.WindowMap
|
||||
|
||||
wm = b.WM
|
||||
if (wm == nil) {
|
||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm is nil) WHY DID THIS HAPPEN?")
|
||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm is nil) WHY DID THIS HAPPEN?")
|
||||
os.Exit(-1)
|
||||
}
|
||||
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE wm =", wm)
|
||||
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE window wm.W =", wm.W)
|
||||
if (wm.W == nil) {
|
||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm.W is nil) WHY DID THIS HAPPEN?")
|
||||
log.Println("mainMouseClick() BACK IN MAIN CONTROL PANEL CODE (wm.W is nil) WHY DID THIS HAPPEN?")
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
if (b.Action == "NEWTEXT") {
|
||||
log.Println("mainMouseClick() NEWTEXT wm.W =", wm.W)
|
||||
} else if (b.Action == "SPLASH") {
|
||||
log.Println("mainMouseClick() SPLASH wm.W =", wm.W)
|
||||
} else if (b.Action == "AREA") {
|
||||
log.Println("mainMouseClick() AREA wm.W =", wm.W)
|
||||
wm.W.Destroy()
|
||||
ui.Quit()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue