summaryrefslogtreecommitdiff
path: root/gui.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-24 12:51:04 -0700
committerJeff Carr <[email protected]>2019-05-24 12:51:04 -0700
commit238c39de36931ad81427d964228cd5bc0c3ea60a (patch)
treeb11e8cb7e30d2f0462a7e83a580ff4a8ea76eaca /gui.go
parent1756f961e4c872d0374e7f147cc6f31cbbdd5591 (diff)
clean more of the button handling
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui.go')
-rw-r--r--gui.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/gui.go b/gui.go
index 254458c..a583305 100644
--- a/gui.go
+++ b/gui.go
@@ -114,6 +114,18 @@ func mouseClick(b *ButtonMap, s string) {
}
}
+// This is one of the routines that is called from the
+// defaultButtonClick() below when the button is found
+// in the AllButtons %map
+func buttonMapClick(b *ButtonMap, s string) {
+ log.Println("gui.buttonVmClick() START")
+ if (Data.MouseClick != nil) {
+ log.Println("Data.ButtonClick() START")
+ Data.MouseClick(nil)
+ }
+}
+
+// This is the raw routine passed to every button in andlabs libui / ui
func defaultButtonClick(button *ui.Button) {
log.Println("defaultButtonClick() button =", button)
for key, foo := range Data.AllButtons {
@@ -128,7 +140,7 @@ func defaultButtonClick(button *ui.Button) {
return
}
if (Data.MouseClick != nil) {
- Data.MouseClick( &Data.AllButtons[key])
+ Data.MouseClick(&Data.AllButtons[key])
}
return
}
@@ -140,6 +152,9 @@ func defaultButtonClick(button *ui.Button) {
}
}
+// This is the raw routine passed to every button in andlabs libui / ui
+// (this has to be different for FontButtons)
+// TODO; merge the logic with the function above
func defaultFontButtonClick(button *ui.FontButton) {
log.Println("defaultButtonClick() button =", button)
for key, foo := range Data.AllButtons {
@@ -224,7 +239,10 @@ func closeButton(name string, mytab *ui.Tab) ui.Control {
func addVmButtonClick(button *ui.Button) {
log.Println("addVMButtonClick()")
- spew.Dump(button)
+ if (Data.Debug) {
+ spew.Dump(button)
+ }
+ createAddVmBox(Data.cloudTab, "Create New Virtual Machine", buttonMapClick)
}
func addVmButton(name string) ui.Control {