all local variables are in Data{}
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
23f110b5a2
commit
6984b0dbc0
8
gui.go
8
gui.go
|
@ -22,13 +22,21 @@ type GuiDataStructure struct {
|
|||
Height int
|
||||
ButtonClick func(int, string)
|
||||
CurrentVM string
|
||||
MyArea *ui.Area
|
||||
|
||||
// stuff for the splash screen / setup tabs
|
||||
cloudWindow *ui.Window
|
||||
cloudTab *ui.Tab
|
||||
cloudBox *ui.Box
|
||||
smallBox *ui.Box
|
||||
|
||||
mainwin *ui.Window
|
||||
maintab *ui.Tab
|
||||
tabcount int
|
||||
allButtons []ButtonMap
|
||||
|
||||
|
||||
|
||||
// stuff for the 'area'
|
||||
fontButton *ui.FontButton
|
||||
attrstr *ui.AttributedString
|
||||
|
|
31
splash.go
31
splash.go
|
@ -10,41 +10,14 @@ import "runtime"
|
|||
import "github.com/andlabs/ui"
|
||||
import _ "github.com/andlabs/ui/winmanifest"
|
||||
|
||||
var MyArea *ui.Area
|
||||
|
||||
func ShowSplash() *ui.Window {
|
||||
splashWin := ui.NewWindow("", 640, 480, true)
|
||||
splashWin.SetBorderless(true)
|
||||
splashWin.OnClosing(func(*ui.Window) bool {
|
||||
ui.Quit()
|
||||
return true
|
||||
})
|
||||
ui.OnShouldQuit(func() bool {
|
||||
splashWin.Destroy()
|
||||
return true
|
||||
})
|
||||
|
||||
vbox := ui.NewVerticalBox()
|
||||
vbox.SetPadded(true)
|
||||
splashWin.SetChild(vbox)
|
||||
splashWin.SetMargined(true)
|
||||
|
||||
// This displays the window
|
||||
// splashWin.Show()
|
||||
|
||||
ShowSplashBox(vbox, nil, nil)
|
||||
|
||||
return splashWin
|
||||
}
|
||||
|
||||
func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(int, string)) *ui.Box {
|
||||
newbox := ui.NewVerticalBox()
|
||||
newbox.SetPadded(true)
|
||||
|
||||
makeAttributedString()
|
||||
MyArea = makeSplashArea(custom)
|
||||
Data.MyArea = makeSplashArea(custom)
|
||||
|
||||
newbox.Append(MyArea, true)
|
||||
newbox.Append(Data.MyArea, true)
|
||||
|
||||
if runtime.GOOS == "linux" {
|
||||
newbox.Append(ui.NewLabel("OS: Linux"), false)
|
||||
|
|
32
tabWindow.go
32
tabWindow.go
|
@ -8,12 +8,6 @@ import _ "github.com/andlabs/ui/winmanifest"
|
|||
|
||||
// import "github.com/davecgh/go-spew/spew"
|
||||
|
||||
// var cloudWindow *ui.Window
|
||||
var cloudTab *ui.Tab
|
||||
var cloudBox *ui.Box
|
||||
var smallBox *ui.Box
|
||||
var state string
|
||||
|
||||
func buttonClick(i int, s string) {
|
||||
log.Println("gui.buttonClick() i, s =", i, s)
|
||||
log.Println("Figure out what to do here")
|
||||
|
@ -27,25 +21,25 @@ func buttonClick(i int, s string) {
|
|||
}
|
||||
|
||||
func ShowAccountQuestionTab() {
|
||||
cloudTab.Delete(0)
|
||||
Data.cloudTab.Delete(0)
|
||||
|
||||
log.Println("Sleep(1000)")
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
|
||||
smallBox = AddAccountQuestionBox(nil, buttonClick)
|
||||
cloudTab.InsertAt("New Account?", 0, smallBox)
|
||||
cloudTab.SetMargined(0, true)
|
||||
Data.smallBox = AddAccountQuestionBox(nil, buttonClick)
|
||||
Data.cloudTab.InsertAt("New Account?", 0, Data.smallBox)
|
||||
Data.cloudTab.SetMargined(0, true)
|
||||
}
|
||||
|
||||
func ShowAccountTab() {
|
||||
cloudTab.Delete(0)
|
||||
Data.cloudTab.Delete(0)
|
||||
|
||||
log.Println("Sleep(1000)")
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
|
||||
smallBox = AddAccountBox(buttonClick)
|
||||
cloudTab.InsertAt("Add Account", 0, smallBox)
|
||||
cloudTab.SetMargined(0, true)
|
||||
Data.smallBox = AddAccountBox(buttonClick)
|
||||
Data.cloudTab.InsertAt("Add Account", 0, Data.smallBox)
|
||||
Data.cloudTab.SetMargined(0, true)
|
||||
}
|
||||
|
||||
func GoMainWindow() {
|
||||
|
@ -64,14 +58,14 @@ func makeCloudWindow() {
|
|||
return true
|
||||
})
|
||||
|
||||
cloudTab = ui.NewTab()
|
||||
Data.cloudWindow.SetChild(cloudTab)
|
||||
Data.cloudTab = ui.NewTab()
|
||||
Data.cloudWindow.SetChild(Data.cloudTab)
|
||||
Data.cloudWindow.SetMargined(true)
|
||||
|
||||
cloudBox = ShowSplashBox(nil, nil, buttonClick)
|
||||
Data.cloudBox = ShowSplashBox(nil, nil, buttonClick)
|
||||
|
||||
cloudTab.Append("WIT Splash", cloudBox)
|
||||
cloudTab.SetMargined(0, true)
|
||||
Data.cloudTab.Append("WIT Splash", Data.cloudBox)
|
||||
Data.cloudTab.SetMargined(0, true)
|
||||
|
||||
Data.cloudWindow.Show()
|
||||
Data.State = "splash"
|
||||
|
|
Loading…
Reference in New Issue