summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--area.go31
-rw-r--r--structs.go13
2 files changed, 26 insertions, 18 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)
}
}
diff --git a/structs.go b/structs.go
index 90da86f..643c1de 100644
--- a/structs.go
+++ b/structs.go
@@ -13,6 +13,7 @@ import pb "git.wit.com/wit/witProtobuf"
// be the safe way to interact with the GUI
//
var Data GuiDataStructure
+var myAH areaHandler
type GuiTabStructure struct {
me *ui.Tab
@@ -68,14 +69,12 @@ type GuiDataStructure struct {
// a tab (maybe the one the user is playing with?)
CurrentTab *GuiTabStructure
// a VM (maybe the one the user is playing with?)
-// CurrentVM string
CurrentVM *pb.Event_VM
// All the tabs
Tabs []GuiTabStructure
// stuff for the splash screen / setup tabs
- // MainWindow *ui.Window
cloudWindow *ui.Window
cloudTab *ui.Tab
cloudBox *ui.Box
@@ -102,6 +101,7 @@ type TableColumnData struct {
type ButtonMap struct {
B *ui.Button
FB *ui.FontButton
+ A *ui.Area
Account *pb.Account
VM *pb.Event_VM
Action string // what type of button
@@ -110,6 +110,15 @@ type ButtonMap struct {
custom func (*ButtonMap)
}
+
+// AREA STRUCTURES START
+type areaHandler struct{
+ // buttonFunc func(int, int)
+ // closeFunc func(int)
+ button *ButtonMap
+}
+// AREA STRUCTURES END
+
//
// TABLE DATA STRUCTURES START
//