summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-22 19:05:25 -0700
committerJeff Carr <[email protected]>2019-05-22 19:05:25 -0700
commit9189fcde04e6051910e92d93bde0cde9172b851d (patch)
tree342a3a08b609a56fdd48b672f087e7a635214340
parent522581dbafc487a8b6a049e22522233504bdf829 (diff)
start moving everything into a common structure (gui.Data)
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--gui.go21
-rw-r--r--tabWindow.go28
2 files changed, 24 insertions, 25 deletions
diff --git a/gui.go b/gui.go
index 245749a..0795258 100644
--- a/gui.go
+++ b/gui.go
@@ -12,22 +12,24 @@ var mainwin *ui.Window
var maintab *ui.Tab
var tabcount int
-var Width int
var Height int
var allButtons []ButtonMap
-var internalDS GuiDS
-func GetDataStructures() *GuiDS {
- return &internalDS
-}
+//
+// All GUI Data Structures and functions that are external
+// If you need cross platform support, these might only
+// be the safe way to interact with the GUI
+//
+var Data GuiDataStructure
-// All GUI Data Structures that are external
-type GuiDS struct {
+type GuiDataStructure struct {
State string
MainWindow *ui.Window
+ Width int
ButtonClick func(int, string)
+ cloudWindow *ui.Window
}
type TableColumnData struct {
@@ -48,7 +50,7 @@ type ButtonMap struct {
}
func setupUI() {
- mainwin = ui.NewWindow("Cloud Control Panel", Width, Height, false)
+ mainwin = ui.NewWindow("Cloud Control Panel", Data.Width, Height, false)
mainwin.OnClosing(func(*ui.Window) bool {
ui.Quit()
return true
@@ -172,9 +174,6 @@ func DoGUI() {
}
}
-func defaultMouseEvent() {
-}
-
func defaultButtonClick(button *ui.Button) {
log.Println("defaultButtonClick() button =", button)
for key, foo := range allButtons {
diff --git a/tabWindow.go b/tabWindow.go
index 250e247..8f75848 100644
--- a/tabWindow.go
+++ b/tabWindow.go
@@ -8,7 +8,7 @@ import _ "github.com/andlabs/ui/winmanifest"
// import "github.com/davecgh/go-spew/spew"
-var cloudWindow *ui.Window
+// var cloudWindow *ui.Window
var cloudTab *ui.Tab
var cloudBox *ui.Box
var smallBox *ui.Box
@@ -26,7 +26,11 @@ func splashClose(a int, b string) {
}
func buttonClick(i int, s string) {
- log.Println("test2 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")
+ log.Println("Figure out what to do here")
+ /*
cloudTab.Delete(0)
log.Println("Sleep(2000)")
@@ -35,6 +39,7 @@ func buttonClick(i int, s string) {
smallBox = AddAccountBox(nil, splashClose)
cloudTab.InsertAt("Intro", 0, smallBox)
cloudTab.SetMargined(0, true)
+ */
}
func ShowAccountTab() {
@@ -53,31 +58,26 @@ func GoMainWindow() {
}
func makeCloudWindow() {
- cloudWindow := ui.NewWindow("", 640, 480, true)
+ Data.cloudWindow = ui.NewWindow("", 640, 480, true)
// cloudWindow.SetBorderless(true)
- cloudWindow.OnClosing(func(*ui.Window) bool {
+ Data.cloudWindow.OnClosing(func(*ui.Window) bool {
ui.Quit()
return true
})
ui.OnShouldQuit(func() bool {
- cloudWindow.Destroy()
+ Data.cloudWindow.Destroy()
return true
})
-// cloudBox = ui.NewVerticalBox()
-// cloudBox.SetPadded(true)
-// cloudWindow.SetChild(cloudBox)
-// cloudWindow.SetMargined(true)
-
cloudTab = ui.NewTab()
- cloudWindow.SetChild(cloudTab)
- cloudWindow.SetMargined(true)
+ Data.cloudWindow.SetChild(cloudTab)
+ Data.cloudWindow.SetMargined(true)
cloudBox = ShowSplashBox(nil, nil, buttonClick)
cloudTab.Append("WIT Splash", cloudBox)
cloudTab.SetMargined(0, true)
- cloudWindow.Show()
- // state = "done"
+ Data.cloudWindow.Show()
+ Data.State = "splash done"
}