summaryrefslogtreecommitdiff
path: root/area.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2019-05-25 22:07:37 -0700
committerJeff Carr <[email protected]>2019-05-25 22:07:37 -0700
commit458e0f71397857899c295f805521bce1fb065701 (patch)
tree76d29a8cca3999e575aeb54f568783983e3ae03e /area.go
parent8fe85f0af271c8cbfa4e5735f7136923dab357f8 (diff)
make fake buttonmap for Area
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'area.go')
-rw-r--r--area.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/area.go b/area.go
index 05c4847..d3273d6 100644
--- a/area.go
+++ b/area.go
@@ -13,15 +13,25 @@ func makeSplashArea(custom func(*ButtonMap)) *ui.Area {
Data.fontButton = CreateFontButton("SplashFont", "DONE", custom)
makeAttributedString()
- Data.splashArea = ui.NewArea(myAH)
+ splashArea := ui.NewArea(myAH)
+
+ // create a 'fake' button entry for the mouse clicks
+ var newmap ButtonMap
+ newmap.Action = "AREA"
+ newmap.A = splashArea
+ newmap.custom = custom
+
+ myAH.button = &newmap
+ Data.AllButtons = append(Data.AllButtons, newmap)
+ Data.splashArea = splashArea
if (Data.Debug) {
spew.Dump(Data.splashArea)
log.Println("DEBUGGING", Data.Debug)
} else {
- log.Println("NOT DEBUGGING", Data.Debug)
- log.Println("NOT DEBUGGING", Data.Debug)
- log.Println("NOT DEBUGGING", Data.Debug)
+ log.Println("NOT DEBUGGING AREA mhAH.button =", myAH.button)
+ log.Println("NOT DEBUGGING AREA mhAH.button =", myAH.button)
+ log.Println("NOT DEBUGGING AREA mhAH.button =", myAH.button)
}
return Data.splashArea
}
@@ -56,13 +66,6 @@ func makeAttributedString() {
appendWithAttributes("<click or press any key>\n", ui.TextSize(10))
}
-type areaHandler struct{
- buttonFunc func(int, int)
- closeFunc func(int)
-}
-
-var myAH areaHandler
-
func (ah areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
tl := ui.DrawNewTextLayout(&ui.DrawTextLayoutParams{
String: Data.attrstr,
@@ -81,16 +84,12 @@ func (ah areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
}
if (me.Down == 1) {
log.Println("GOT MOUSE DOWN")
- log.Println("GOT MOUSE DOWN")
- log.Println("GOT MOUSE DOWN")
}
if (me.Up == 1) {
log.Println("GOT MOUSE UP")
log.Println("GOT MOUSE UP")
log.Println("GOT MOUSE UP")
- if (Data.MouseClick != nil) {
- Data.MouseClick(nil)
- }
+ mouseClick(myAH.button)
}
}