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"
|
|
|
|
|
|
|
|
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() {
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.cloudTab.Delete(0)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-22 23:16:52 -05:00
|
|
|
log.Println("Sleep(200)")
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.smallBox = AddAccountQuestionBox(nil, buttonClick)
|
|
|
|
Data.cloudTab.InsertAt("New Account?", 0, Data.smallBox)
|
|
|
|
Data.cloudTab.SetMargined(0, true)
|
2019-05-22 22:03:17 -05:00
|
|
|
}
|
|
|
|
|
2019-05-22 20:35:00 -05:00
|
|
|
func ShowAccountTab() {
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.cloudTab.Delete(0)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 23:16:52 -05:00
|
|
|
log.Println("Sleep(200)")
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.smallBox = AddAccountBox(buttonClick)
|
|
|
|
Data.cloudTab.InsertAt("Add Account", 0, Data.smallBox)
|
|
|
|
Data.cloudTab.SetMargined(0, true)
|
2019-05-22 20:35:00 -05:00
|
|
|
}
|
|
|
|
|
2019-05-22 22:49:28 -05:00
|
|
|
func ShowMainTab() {
|
|
|
|
Data.cloudTab.Delete(0)
|
|
|
|
|
2019-05-22 23:16:52 -05:00
|
|
|
log.Println("Sleep(200)")
|
|
|
|
time.Sleep(200 * time.Millisecond)
|
2019-05-22 22:49:28 -05:00
|
|
|
|
|
|
|
Data.smallBox = makeCloudInfoBox(buttonClick)
|
|
|
|
Data.cloudTab.InsertAt("Main", 0, Data.smallBox)
|
|
|
|
Data.cloudTab.SetMargined(0, true)
|
|
|
|
}
|
|
|
|
|
2019-05-22 20:35:00 -05:00
|
|
|
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-23 15:44:53 -05:00
|
|
|
if (Data.ButtonClickNew != nil) {
|
|
|
|
log.Println("Data.ButtonClickNew() START QUIT")
|
|
|
|
Data.State = "QUIT"
|
|
|
|
Data.ButtonClickNew(nil)
|
|
|
|
}
|
|
|
|
// ui.Quit()
|
2019-05-22 20:35:00 -05:00
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
2019-05-23 15:44:53 -05:00
|
|
|
if (Data.ButtonClickNew != nil) {
|
|
|
|
log.Println("Data.ButtonClickNew() START QUIT")
|
|
|
|
Data.State = "QUIT"
|
|
|
|
Data.ButtonClickNew(nil)
|
|
|
|
}
|
|
|
|
// Data.cloudWindow.Destroy()
|
2019-05-22 20:35:00 -05:00
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.cloudTab = ui.NewTab()
|
|
|
|
Data.cloudWindow.SetChild(Data.cloudTab)
|
2019-05-22 21:05:25 -05:00
|
|
|
Data.cloudWindow.SetMargined(true)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.cloudBox = ShowSplashBox(nil, nil, buttonClick)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:30:48 -05:00
|
|
|
Data.cloudTab.Append("WIT Splash", Data.cloudBox)
|
|
|
|
Data.cloudTab.SetMargined(0, true)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
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
|
|
|
}
|