2019-05-22 20:35:00 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
2019-05-24 03:51:37 -05:00
|
|
|
func AddAccountQuestionBox(junk *ui.Box, custom func(*ButtonMap, string)) *ui.Box {
|
2019-05-22 22:03:17 -05:00
|
|
|
newbox := ui.NewVerticalBox()
|
|
|
|
newbox.SetPadded(true)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-23 13:03:26 -05:00
|
|
|
newButton := CreateButton("Create New Account", "DONE", custom)
|
2019-05-22 22:03:17 -05:00
|
|
|
newbox.Append(newButton, false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
newbox.Append(ui.NewHorizontalSeparator(), false)
|
|
|
|
|
2019-05-23 13:03:26 -05:00
|
|
|
okButton := CreateButton("I Have an Account", "DONE", custom)
|
2019-05-22 22:03:17 -05:00
|
|
|
newbox.Append(okButton, false)
|
|
|
|
|
|
|
|
return newbox
|
|
|
|
}
|
|
|
|
|
2019-05-24 03:51:37 -05:00
|
|
|
func AddAccountBox(custom func(*ButtonMap, string)) *ui.Box {
|
2019-05-22 20:35:00 -05:00
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
2019-05-22 22:03:17 -05:00
|
|
|
|
|
|
|
hboxAccount := ui.NewHorizontalBox()
|
|
|
|
hboxAccount.SetPadded(true)
|
|
|
|
vbox.Append(hboxAccount, false)
|
|
|
|
|
|
|
|
// Start 'Provider' vertical box
|
|
|
|
vboxC := ui.NewVerticalBox()
|
|
|
|
vboxC.SetPadded(true)
|
|
|
|
vboxC.Append(ui.NewLabel("Cloud Provider:"), false)
|
|
|
|
|
|
|
|
cbox := ui.NewCombobox()
|
|
|
|
cbox.Append("WIT")
|
|
|
|
cbox.Append("Evocative")
|
|
|
|
vboxC.Append(cbox, false)
|
|
|
|
cbox.SetSelected(0)
|
|
|
|
|
|
|
|
cbox.OnSelected(func(*ui.Combobox) {
|
|
|
|
log.Println("OK. Selected Cloud Provider =", cbox.Selected())
|
2019-05-22 20:35:00 -05:00
|
|
|
})
|
2019-05-22 22:03:17 -05:00
|
|
|
hboxAccount.Append(vboxC, false)
|
|
|
|
// End 'Cloud Provider' vertical box
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
// Start 'Region' vertical box
|
|
|
|
vboxR := ui.NewVerticalBox()
|
|
|
|
vboxR.SetPadded(true)
|
|
|
|
vboxR.Append(ui.NewLabel("Region:"), false)
|
|
|
|
|
|
|
|
regbox := ui.NewCombobox()
|
|
|
|
regbox.Append("Any")
|
|
|
|
regbox.Append("SF")
|
|
|
|
vboxR.Append(regbox, false)
|
|
|
|
regbox.SetSelected(0)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
regbox.OnSelected(func(*ui.Combobox) {
|
|
|
|
log.Println("OK. Selected something =", regbox.Selected())
|
2019-05-22 20:35:00 -05:00
|
|
|
})
|
2019-05-22 22:03:17 -05:00
|
|
|
hboxAccount.Append(vboxR, false)
|
|
|
|
// End 'Region' vertical box
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
// Start 'Nickname' vertical box
|
|
|
|
vboxN := ui.NewVerticalBox()
|
|
|
|
vboxN.SetPadded(true)
|
|
|
|
vboxN.Append(ui.NewLabel("Account Nickname:"), false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
entryNick := ui.NewEntry()
|
|
|
|
entryNick.SetReadOnly(false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
vboxN.Append(entryNick, false)
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
entryNick.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. nickname =", entryNick.Text())
|
2019-05-23 12:50:37 -05:00
|
|
|
Data.AccNick = entryNick.Text()
|
2019-05-22 22:03:17 -05:00
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxN, false)
|
|
|
|
// End 'Nickname' vertical box
|
2019-05-22 20:35:00 -05:00
|
|
|
|
2019-05-22 22:03:17 -05:00
|
|
|
// Start 'Username' vertical box
|
|
|
|
vboxU := ui.NewVerticalBox()
|
|
|
|
vboxU.SetPadded(true)
|
|
|
|
vboxU.Append(ui.NewLabel("Account Username:"), false)
|
|
|
|
|
|
|
|
entryUser := ui.NewEntry()
|
|
|
|
entryUser.SetReadOnly(false)
|
|
|
|
|
|
|
|
vboxU.Append(entryUser, false)
|
|
|
|
|
|
|
|
entryUser.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. username =", entryUser.Text())
|
2019-05-23 12:50:37 -05:00
|
|
|
Data.AccUser = entryUser.Text()
|
2019-05-22 22:03:17 -05:00
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxU, false)
|
|
|
|
// End 'Username' vertical box
|
|
|
|
|
|
|
|
// Start 'Password' vertical box
|
|
|
|
vboxP := ui.NewVerticalBox()
|
|
|
|
vboxP.SetPadded(true)
|
|
|
|
vboxP.Append(ui.NewLabel("Account Password:"), false)
|
|
|
|
|
|
|
|
entryPass := ui.NewEntry()
|
|
|
|
entryPass.SetReadOnly(false)
|
|
|
|
|
|
|
|
vboxP.Append(entryPass, false)
|
|
|
|
|
|
|
|
entryPass.OnChanged(func(*ui.Entry) {
|
|
|
|
log.Println("OK. password =", entryPass.Text())
|
2019-05-23 12:50:37 -05:00
|
|
|
Data.AccPass = entryPass.Text()
|
2019-05-22 22:03:17 -05:00
|
|
|
})
|
|
|
|
hboxAccount.Append(vboxP, false)
|
|
|
|
// End 'Password' vertical box
|
|
|
|
|
|
|
|
vbox.Append(ui.NewHorizontalSeparator(), false)
|
|
|
|
|
|
|
|
hboxButtons := ui.NewHorizontalBox()
|
|
|
|
hboxButtons.SetPadded(true)
|
|
|
|
vbox.Append(hboxButtons, false)
|
|
|
|
|
|
|
|
okButton := CreateButton("Add Account", "ADD", custom)
|
|
|
|
hboxButtons.Append(okButton, false)
|
|
|
|
|
|
|
|
backButton := CreateButton("Back", "BACK", custom)
|
|
|
|
hboxButtons.Append(backButton, false)
|
|
|
|
|
|
|
|
return vbox
|
2019-05-22 20:35:00 -05:00
|
|
|
}
|