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
	})

	tab := ui.NewTab()
	splashWin.SetChild(tab)
	splashWin.SetMargined(true)

	hbox := ui.NewHorizontalBox()
	hbox.SetPadded(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)
	}

	tab.Append("WIT Splash", hbox)
	tab.SetMargined(0, true)

	splashWin.Show()
}