summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-26 12:05:23 -0700
committerJeff Carr <[email protected]>2019-05-26 12:05:23 -0700
commit1fbb0cd227987b1b7758c19452ce97338041c302 (patch)
treed63ce02697c5d8975a3140532a7796d924baf318
parent4f08c8f1cea5103c9713d2374d3e266025208893 (diff)
more standard button handling
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--area.go5
-rw-r--r--mainCloudBox.go18
-rw-r--r--splash.go10
-rw-r--r--tableCallbacks.go2
4 files changed, 15 insertions, 20 deletions
diff --git a/area.go b/area.go
index d3273d6..87261c0 100644
--- a/area.go
+++ b/area.go
@@ -7,10 +7,10 @@ import _ "github.com/andlabs/ui/winmanifest"
import "github.com/davecgh/go-spew/spew"
-func makeSplashArea(custom func(*ButtonMap)) *ui.Area {
+func makeSplashArea() *ui.Area {
// make this button just to get the default font (but don't display the button)
// There should be another way to do this (?)
- Data.fontButton = CreateFontButton("SplashFont", "DONE", custom)
+ Data.fontButton = CreateFontButton("SplashFont", "DONE", mouseClick)
makeAttributedString()
splashArea := ui.NewArea(myAH)
@@ -19,7 +19,6 @@ func makeSplashArea(custom func(*ButtonMap)) *ui.Area {
var newmap ButtonMap
newmap.Action = "AREA"
newmap.A = splashArea
- newmap.custom = custom
myAH.button = &newmap
Data.AllButtons = append(Data.AllButtons, newmap)
diff --git a/mainCloudBox.go b/mainCloudBox.go
index d6b9340..fad6f76 100644
--- a/mainCloudBox.go
+++ b/mainCloudBox.go
@@ -228,7 +228,7 @@ func makeCloudWindow() {
Data.cloudWindow.SetChild(Data.cloudTab)
Data.cloudWindow.SetMargined(true)
- Data.cloudBox = ShowSplashBox(nil, nil, mouseClick)
+ Data.cloudBox = ShowSplashBox()
Data.cloudTab.Append("WIT Splash", Data.cloudBox)
Data.cloudTab.SetMargined(0, true)
@@ -254,12 +254,12 @@ func ShowVM() {
VMwin.SetChild(VMtab)
VMwin.SetMargined(true)
- createVmBox(VMtab, mouseClick, Data.CurrentVM)
+ createVmBox(VMtab, Data.CurrentVM)
VMwin.Show()
}
func AddVmConfigureTab(name string, pbVM *pb.Event_VM) {
- createVmBox(Data.cloudTab, mouseClick, Data.CurrentVM)
+ createVmBox(Data.cloudTab, Data.CurrentVM)
}
// makeEntryBox(box, "hostname:", "blah.foo.org") {
@@ -307,7 +307,7 @@ func makeEntryHbox(hbox *ui.Box, a string, b string, edit bool) {
// End 'Nickname' vertical box
}
-func createVmBox(tab *ui.Tab, custom func(*ButtonMap), pbVM *pb.Event_VM) {
+func createVmBox(tab *ui.Tab, pbVM *pb.Event_VM) {
log.Println("createVmBox() START")
log.Println("createVmBox() pbVM.Name", pbVM.Name)
spew.Dump(pbVM)
@@ -336,13 +336,13 @@ func createVmBox(tab *ui.Tab, custom func(*ButtonMap), pbVM *pb.Event_VM) {
vbox.Append(hboxButtons, false)
log.Println("pbVM =", pbVM)
- hboxButtons.Append(CreateButton(nil, pbVM, "Power On", "POWERON", custom), false)
- hboxButtons.Append(CreateButton(nil, pbVM, "Power Off", "POWEROFF", custom), false)
- hboxButtons.Append(CreateButton(nil, pbVM, "Destroy", "DESTROY", custom), false)
+ hboxButtons.Append(CreateButton(nil, pbVM, "Power On", "POWERON", mouseClick), false)
+ hboxButtons.Append(CreateButton(nil, pbVM, "Power Off", "POWEROFF", mouseClick), false)
+ hboxButtons.Append(CreateButton(nil, pbVM, "Destroy", "DESTROY", mouseClick), false)
hboxButtons.Append(CreateButton(nil, pbVM, "ping", "PING", runPingClick), false)
hboxButtons.Append(CreateButton(nil, pbVM, "Console", "XTERM", runTestExecClick), false)
- hboxButtons.Append(CreateButton(nil, pbVM, "Save", "SAVE", custom), false)
- hboxButtons.Append(CreateButton(nil, pbVM, "Done", "DONE", custom), false)
+ hboxButtons.Append(CreateButton(nil, pbVM, "Save", "SAVE", mouseClick), false)
+ hboxButtons.Append(CreateButton(nil, pbVM, "Done", "DONE", mouseClick), false)
tab.Append(Data.CurrentVM.Name, vbox)
tab.SetMargined(0, true)
diff --git a/splash.go b/splash.go
index c4ed9c9..f131eaf 100644
--- a/splash.go
+++ b/splash.go
@@ -10,12 +10,12 @@ import "runtime"
import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"
-func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(*ButtonMap)) *ui.Box {
+func ShowSplashBox() *ui.Box {
newbox := ui.NewVerticalBox()
newbox.SetPadded(true)
makeAttributedString()
- Data.MyArea = makeSplashArea(custom)
+ Data.MyArea = makeSplashArea()
newbox.Append(Data.MyArea, true)
@@ -45,12 +45,8 @@ func ShowSplashBox(vbox *ui.Box, atest chan int, custom func(*ButtonMap)) *ui.Bo
}
}
- okButton := CreateButton(nil, nil, "OK", "DONE", custom)
+ okButton := CreateButton(nil, nil, "OK", "DONE", mouseClick)
newbox.Append(okButton, false)
- if (vbox != nil) {
- vbox.Append(newbox, true)
- }
-
return newbox
}
diff --git a/tableCallbacks.go b/tableCallbacks.go
index 8a61f6b..1f926d4 100644
--- a/tableCallbacks.go
+++ b/tableCallbacks.go
@@ -108,7 +108,7 @@ func defaultSetCellValue(mh *TableData, row int, column int) {
} else {
// AddVmConfigureTab(vmname, mh.Rows[row].PbVM)
// createVmBox(Data.cloudTab, buttonVmClick, mh.Rows[row].PbVM)
- createVmBox(Data.cloudTab, mouseClick, mh.Rows[row].VM)
+ createVmBox(Data.cloudTab, mh.Rows[row].VM)
}
}
}