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
|
Height int
|
||||||
ButtonClick func(int, string)
|
ButtonClick func(int, string)
|
||||||
CurrentVM string
|
CurrentVM string
|
||||||
|
MyArea *ui.Area
|
||||||
|
|
||||||
|
// stuff for the splash screen / setup tabs
|
||||||
cloudWindow *ui.Window
|
cloudWindow *ui.Window
|
||||||
|
cloudTab *ui.Tab
|
||||||
|
cloudBox *ui.Box
|
||||||
|
smallBox *ui.Box
|
||||||
|
|
||||||
mainwin *ui.Window
|
mainwin *ui.Window
|
||||||
maintab *ui.Tab
|
maintab *ui.Tab
|
||||||
tabcount int
|
tabcount int
|
||||||
allButtons []ButtonMap
|
allButtons []ButtonMap
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// stuff for the 'area'
|
// stuff for the 'area'
|
||||||
fontButton *ui.FontButton
|
fontButton *ui.FontButton
|
||||||
attrstr *ui.AttributedString
|
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"
|
||||||
import _ "github.com/andlabs/ui/winmanifest"
|
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 {
|
func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(int, string)) *ui.Box {
|
||||||
newbox := ui.NewVerticalBox()
|
newbox := ui.NewVerticalBox()
|
||||||
newbox.SetPadded(true)
|
newbox.SetPadded(true)
|
||||||
|
|
||||||
makeAttributedString()
|
makeAttributedString()
|
||||||
MyArea = makeSplashArea(custom)
|
Data.MyArea = makeSplashArea(custom)
|
||||||
|
|
||||||
newbox.Append(MyArea, true)
|
newbox.Append(Data.MyArea, true)
|
||||||
|
|
||||||
if runtime.GOOS == "linux" {
|
if runtime.GOOS == "linux" {
|
||||||
newbox.Append(ui.NewLabel("OS: Linux"), false)
|
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"
|
// 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) {
|
func buttonClick(i int, s string) {
|
||||||
log.Println("gui.buttonClick() i, s =", i, s)
|
log.Println("gui.buttonClick() i, s =", i, s)
|
||||||
log.Println("Figure out what to do here")
|
log.Println("Figure out what to do here")
|
||||||
|
@ -27,25 +21,25 @@ func buttonClick(i int, s string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowAccountQuestionTab() {
|
func ShowAccountQuestionTab() {
|
||||||
cloudTab.Delete(0)
|
Data.cloudTab.Delete(0)
|
||||||
|
|
||||||
log.Println("Sleep(1000)")
|
log.Println("Sleep(1000)")
|
||||||
time.Sleep(1000 * time.Millisecond)
|
time.Sleep(1000 * time.Millisecond)
|
||||||
|
|
||||||
smallBox = AddAccountQuestionBox(nil, buttonClick)
|
Data.smallBox = AddAccountQuestionBox(nil, buttonClick)
|
||||||
cloudTab.InsertAt("New Account?", 0, smallBox)
|
Data.cloudTab.InsertAt("New Account?", 0, Data.smallBox)
|
||||||
cloudTab.SetMargined(0, true)
|
Data.cloudTab.SetMargined(0, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ShowAccountTab() {
|
func ShowAccountTab() {
|
||||||
cloudTab.Delete(0)
|
Data.cloudTab.Delete(0)
|
||||||
|
|
||||||
log.Println("Sleep(1000)")
|
log.Println("Sleep(1000)")
|
||||||
time.Sleep(1000 * time.Millisecond)
|
time.Sleep(1000 * time.Millisecond)
|
||||||
|
|
||||||
smallBox = AddAccountBox(buttonClick)
|
Data.smallBox = AddAccountBox(buttonClick)
|
||||||
cloudTab.InsertAt("Add Account", 0, smallBox)
|
Data.cloudTab.InsertAt("Add Account", 0, Data.smallBox)
|
||||||
cloudTab.SetMargined(0, true)
|
Data.cloudTab.SetMargined(0, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GoMainWindow() {
|
func GoMainWindow() {
|
||||||
|
@ -64,14 +58,14 @@ func makeCloudWindow() {
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
cloudTab = ui.NewTab()
|
Data.cloudTab = ui.NewTab()
|
||||||
Data.cloudWindow.SetChild(cloudTab)
|
Data.cloudWindow.SetChild(Data.cloudTab)
|
||||||
Data.cloudWindow.SetMargined(true)
|
Data.cloudWindow.SetMargined(true)
|
||||||
|
|
||||||
cloudBox = ShowSplashBox(nil, nil, buttonClick)
|
Data.cloudBox = ShowSplashBox(nil, nil, buttonClick)
|
||||||
|
|
||||||
cloudTab.Append("WIT Splash", cloudBox)
|
Data.cloudTab.Append("WIT Splash", Data.cloudBox)
|
||||||
cloudTab.SetMargined(0, true)
|
Data.cloudTab.SetMargined(0, true)
|
||||||
|
|
||||||
Data.cloudWindow.Show()
|
Data.cloudWindow.Show()
|
||||||
Data.State = "splash"
|
Data.State = "splash"
|
||||||
|
|
Loading…
Reference in New Issue