From 522581dbafc487a8b6a049e22522233504bdf829 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 22 May 2019 18:35:00 -0700 Subject: I guess all GUI stuff must go in here. No other goroutine can ever interact with the GUI or Windows cross platform support breaks. Lame Signed-off-by: Jeff Carr --- addAccount.go | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 addAccount.go (limited to 'addAccount.go') diff --git a/addAccount.go b/addAccount.go new file mode 100644 index 0000000..e9799f6 --- /dev/null +++ b/addAccount.go @@ -0,0 +1,65 @@ +package gui + +import "log" + +import "github.com/andlabs/ui" +import _ "github.com/andlabs/ui/winmanifest" + +// import "github.com/davecgh/go-spew/spew" + +func AddAccountWindow() { + accounthWin := ui.NewWindow("Add 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() + + // START create new account button + newAccountButton := ui.NewButton("Create New Account") + newAccountButton.OnClicked(func(*ui.Button) { + log.Println("OK. Closing window.") + accounthWin.Destroy() + ui.Quit() + }) + vbox.Append(newAccountButton, false) + // END create new account button + + vbox.Append(ui.NewHorizontalSeparator(), false) + + okButton := ui.NewButton("I Have an Account") + okButton.OnClicked(func(*ui.Button) { + log.Println("OK. Closing window.") + accounthWin.Destroy() + ui.Quit() + }) + vbox.Append(okButton, false) + // END add account hbox +} + +func AddAccountBox(junk *ui.Box, custom func(int, string)) *ui.Box { + newbox := ui.NewVerticalBox() + newbox.SetPadded(true) + + // create new account button + newButton := CreateButton("Create New Account", "CLOSE", custom) + newbox.Append(newButton, false) + + newbox.Append(ui.NewHorizontalSeparator(), false) + + okButton := CreateButton("I Have an Account", "CLOSE", custom) + newbox.Append(okButton, false) + + return newbox +} -- cgit v1.2.3