more standard button handling
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
4f08c8f1ce
commit
1fbb0cd227
5
area.go
5
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)
|
||||
|
|
|
@ -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)
|
||||
|
|
10
splash.go
10
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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue