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

56 lines
1.2 KiB
Go

package main
import "log"
import "runtime"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
// import "github.com/davecgh/go-spew/spew"
func addAccountWindow() {
accounthWin := ui.NewWindow("Create New Account", 400, 300, false)
accounthWin.OnClosing(func(*ui.Window) bool {
ui.Quit()
return true
})
ui.OnShouldQuit(func() bool {
accounthWin.Destroy()
return true
})
vbox := ui.NewVerticalBox()
vbox.SetPadded(true)
accounthWin.SetChild(vbox)
accounthWin.SetMargined(true)
// This displays the window
accounthWin.Show()
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)
}
vbox.Append(ui.NewLabel("Version: v0.3"), false)
okButton := ui.NewButton("Add Account")
okButton.OnClicked(func(*ui.Button) {
log.Println("OK. Closing window.")
accounthWin.Destroy()
ui.Quit()
})
vbox.Append(okButton, false)
newAccountButton := ui.NewButton("Create New Account")
newAccountButton.OnClicked(func(*ui.Button) {
log.Println("OK. Closing window.")
accounthWin.Destroy()
ui.Quit()
})
vbox.Append(newAccountButton, false)
}