cloud-control-panel/example-splash/splash.go

62 lines
1.2 KiB
Go
Raw Normal View History

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
})
// Make this window a 'tabbed' window
// tab := ui.NewTab()
hbox := ui.NewHorizontalBox()
hbox.SetPadded(true)
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)
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)
}
}