open and close windows on linux for the VM

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-26 15:03:20 -07:00
parent 25757a812f
commit 38185c3156
4 changed files with 18 additions and 2 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.swp

6
gui.go
View File

@ -142,6 +142,12 @@ func mouseClick(b *ButtonMap) {
createVmBox(Data.cloudTab, b.VM)
}
}
if (b.Action == "WINDOW CLOSE") {
b.W.Hide()
// TODO: fix this (seems to crash? maybe because we are in the button here?)
// b.W.Destroy()
return
}
if (b.Action == "ADD") {
log.Println("\tgui.mouseClick() SHOULD ADD VM HERE?")
}

View File

@ -239,12 +239,19 @@ func ShowVM() {
name := Data.CurrentVM.Name
log.Println("ShowVM() START Data.CurrentVM=", Data.CurrentVM)
VMwin := ui.NewWindow("VM " + name, 500, 300, false)
// create a 'fake' button entry for the mouse clicks
var newButtonMap ButtonMap
newButtonMap.Action = "WINDOW CLOSE"
newButtonMap.W = VMwin
Data.AllButtons = append(Data.AllButtons, newButtonMap)
VMwin.OnClosing(func(*ui.Window) bool {
mouseClick(&newButtonMap)
return true
})
ui.OnShouldQuit(func() bool {
VMwin.Destroy()
VMwin = nil
mouseClick(&newButtonMap)
return true
})

View File

@ -101,6 +101,8 @@ type ButtonMap struct {
B *ui.Button
FB *ui.FontButton
A *ui.Area
W *ui.Window
Account *pb.Account
VM *pb.Event_VM
Action string // what type of button