89 lines
2.5 KiB
Go
89 lines
2.5 KiB
Go
package main
|
|
|
|
import "os"
|
|
import "log"
|
|
import "fmt"
|
|
|
|
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() {
|
|
var c *pb.Config
|
|
c = pb.MakeDefaultConfig()
|
|
|
|
gui.Data.MouseClick = mainMouseClick
|
|
|
|
i := 1
|
|
|
|
c.Width += int32(100 * i)
|
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
|
gui.StartNewWindow(c, true, "SPLASH")
|
|
|
|
i += 1
|
|
c.Width += int32(100 * i)
|
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
|
gui.StartNewWindow(c, true, "BLAH")
|
|
|
|
for {
|
|
i += 1
|
|
c.Width += int32(100 * i)
|
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
|
gui.StartNewWindow(c, false, "SPLASH")
|
|
|
|
i += 1
|
|
c.Width += int32(100 * i)
|
|
c.Hostname = fmt.Sprintf("splash %d", i)
|
|
gui.StartNewWindow(c, false, "BLAH")
|
|
}
|
|
}
|
|
|
|
// 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.GuiButton) {
|
|
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.GuiWindow
|
|
|
|
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()
|
|
}
|
|
}
|