2019-05-17 13:35:03 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
// import "time"
|
|
|
|
import "log"
|
|
|
|
// import "fmt"
|
|
|
|
import "runtime"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
func showSplash() {
|
|
|
|
splashWin := ui.NewWindow("Splash Screen", 640, 480, false)
|
|
|
|
splashWin.OnClosing(func(*ui.Window) bool {
|
|
|
|
ui.Quit()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
|
|
|
splashWin.Destroy()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
2019-05-17 13:52:40 -05:00
|
|
|
// Make this window a 'tabbed' window
|
|
|
|
// tab := ui.NewTab()
|
2019-05-17 13:35:03 -05:00
|
|
|
|
|
|
|
hbox := ui.NewHorizontalBox()
|
|
|
|
hbox.SetPadded(true)
|
2019-05-17 13:52:40 -05:00
|
|
|
splashWin.SetChild(hbox)
|
|
|
|
splashWin.SetMargined(true)
|
|
|
|
|
|
|
|
// This displays the window
|
|
|
|
splashWin.Show()
|
|
|
|
|
|
|
|
// tab is ready so now display it
|
|
|
|
// tab.Append("WIT Splash", hbox)
|
|
|
|
// tab.SetMargined(0, true)
|
2019-05-17 13:35:03 -05:00
|
|
|
|
|
|
|
group := ui.NewGroup("Numbers")
|
|
|
|
group.SetMargined(true)
|
|
|
|
hbox.Append(group, true)
|
|
|
|
|
|
|
|
vbox = ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
|
|
|
group.SetChild(vbox)
|
|
|
|
|
|
|
|
okButton := ui.NewButton("OK")
|
|
|
|
okButton.OnClicked(func(*ui.Button) {
|
|
|
|
log.Println("OK. Closing window.")
|
|
|
|
splashWin.Destroy()
|
|
|
|
ui.Quit()
|
|
|
|
})
|
|
|
|
vbox.Append(okButton, false)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|