2019-05-22 20:35:00 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
import "time"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
|
|
|
|
2019-05-22 21:05:25 -05:00
|
|
|
// var cloudWindow *ui.Window
|
2019-05-22 20:35:00 -05:00
|
|
|
var cloudTab *ui.Tab
|
|
|
|
var cloudBox *ui.Box
|
|
|
|
var smallBox *ui.Box
|
|
|
|
var state string
|
|
|
|
|
|
|
|
func buttonClick(i int, s string) {
|
2019-05-22 21:05:25 -05:00
|
|
|
log.Println("gui.buttonClick() i, s =", i, s)
|
|
|
|
log.Println("Figure out what to do here")
|
|
|
|
log.Println("Figure out what to do here")
|
|
|
|
log.Println("Figure out what to do here")
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 21:18:55 -05:00
|
|
|
if (Data.ButtonClick != nil) {
|
|
|
|
log.Println("Data.ButtonClick() START")
|
|
|
|
Data.ButtonClick(i, s)
|
|
|
|
}
|
2019-05-22 20:35:00 -05:00
|
|
|
}
|
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
func ShowAccountQuestionTab() {
|
|
|
|
cloudTab.Delete(0)
|
|
|
|
|
|
|
|
log.Println("Sleep(1000)")
|
|
|
|
time.Sleep(1000 * time.Millisecond)
|
|
|
|
|
|
|
|
smallBox = AddAccountQuestionBox(nil, buttonClick)
|
|
|
|
cloudTab.InsertAt("New Account?", 0, smallBox)
|
|
|
|
cloudTab.SetMargined(0, true)
|
|
|
|
}
|
|
|
|
|
2019-05-22 20:35:00 -05:00
|
|
|
func ShowAccountTab() {
|
|
|
|
cloudTab.Delete(0)
|
|
|
|
|
|
|
|
log.Println("Sleep(1000)")
|
|
|
|
time.Sleep(1000 * time.Millisecond)
|
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
smallBox = AddAccountBox(buttonClick)
|
|
|
|
cloudTab.InsertAt("Add Account", 0, smallBox)
|
2019-05-22 20:35:00 -05:00
|
|
|
cloudTab.SetMargined(0, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func GoMainWindow() {
|
|
|
|
ui.Main(makeCloudWindow)
|
|
|
|
}
|
|
|
|
|
|
|
|
func makeCloudWindow() {
|
2019-05-22 21:05:25 -05:00
|
|
|
Data.cloudWindow = ui.NewWindow("", 640, 480, true)
|
2019-05-22 20:35:00 -05:00
|
|
|
// cloudWindow.SetBorderless(true)
|
2019-05-22 21:05:25 -05:00
|
|
|
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
2019-05-22 20:35:00 -05:00
|
|
|
ui.Quit()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
2019-05-22 21:05:25 -05:00
|
|
|
Data.cloudWindow.Destroy()
|
2019-05-22 20:35:00 -05:00
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
|
|
|
cloudTab = ui.NewTab()
|
2019-05-22 21:05:25 -05:00
|
|
|
Data.cloudWindow.SetChild(cloudTab)
|
|
|
|
Data.cloudWindow.SetMargined(true)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
|
|
|
cloudBox = ShowSplashBox(nil, nil, buttonClick)
|
|
|
|
|
|
|
|
cloudTab.Append("WIT Splash", cloudBox)
|
|
|
|
cloudTab.SetMargined(0, true)
|
|
|
|
|
2019-05-22 21:05:25 -05:00
|
|
|
Data.cloudWindow.Show()
|
2019-05-22 22:03:17 -05:00
|
|
|
Data.State = "splash"
|
2019-05-22 20:35:00 -05:00
|
|
|
}
|