2019-05-17 13:35:03 -05:00
|
|
|
package main
|
|
|
|
|
2019-05-17 16:25:40 -05:00
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
2019-05-17 13:35:03 -05:00
|
|
|
// import "time"
|
|
|
|
// import "fmt"
|
2019-05-17 16:25:40 -05:00
|
|
|
|
|
|
|
import "log"
|
2019-05-17 13:35:03 -05:00
|
|
|
import "runtime"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
2019-05-17 16:25:40 -05:00
|
|
|
var splashWin *ui.Window
|
2019-05-17 14:54:35 -05:00
|
|
|
|
2019-05-17 13:35:03 -05:00
|
|
|
func showSplash() {
|
2019-05-19 21:21:35 -05:00
|
|
|
splashWin = ui.NewWindow("", 640, 480, true)
|
|
|
|
splashWin.SetBorderless(true)
|
2019-05-17 13:35:03 -05:00
|
|
|
splashWin.OnClosing(func(*ui.Window) bool {
|
|
|
|
ui.Quit()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
|
|
|
splashWin.Destroy()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
2019-05-17 16:25:40 -05:00
|
|
|
vbox := ui.NewVerticalBox()
|
2019-05-17 15:07:45 -05:00
|
|
|
vbox.SetPadded(true)
|
|
|
|
splashWin.SetChild(vbox)
|
2019-05-17 13:52:40 -05:00
|
|
|
splashWin.SetMargined(true)
|
|
|
|
|
|
|
|
// This displays the window
|
|
|
|
splashWin.Show()
|
|
|
|
|
2019-05-17 14:54:35 -05:00
|
|
|
makeAttributedString()
|
2019-05-17 15:07:45 -05:00
|
|
|
myArea := makeSplashArea()
|
2019-05-17 14:54:35 -05:00
|
|
|
|
2019-05-17 15:07:45 -05:00
|
|
|
vbox.Append(myArea, true)
|
2019-05-17 13:35:03 -05:00
|
|
|
|
|
|
|
if runtime.GOOS == "linux" {
|
|
|
|
vbox.Append(ui.NewLabel("OS: Linux"), false)
|
|
|
|
} else if runtime.GOOS == "windows" {
|
|
|
|
vbox.Append(ui.NewLabel("OS: Windows"), false)
|
|
|
|
} else {
|
|
|
|
vbox.Append(ui.NewLabel("OS: " + runtime.GOOS), false)
|
|
|
|
}
|
|
|
|
|
2019-05-17 14:54:35 -05:00
|
|
|
vbox.Append(ui.NewLabel("Version: v0.3"), false)
|
|
|
|
|
|
|
|
okButton := ui.NewButton("OK")
|
|
|
|
okButton.OnClicked(func(*ui.Button) {
|
|
|
|
log.Println("OK. Closing window.")
|
|
|
|
splashWin.Destroy()
|
|
|
|
ui.Quit()
|
|
|
|
})
|
|
|
|
vbox.Append(okButton, false)
|
|
|
|
}
|