make fake buttonmap for Area

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-05-25 22:07:37 -07:00
parent 8fe85f0af2
commit 458e0f7139
2 changed files with 26 additions and 18 deletions

31
area.go
View File

@ -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)
}
}

View File

@ -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
//