make fake buttonmap for Area
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
8fe85f0af2
commit
458e0f7139
31
area.go
31
area.go
|
@ -13,15 +13,25 @@ func makeSplashArea(custom func(*ButtonMap)) *ui.Area {
|
||||||
Data.fontButton = CreateFontButton("SplashFont", "DONE", custom)
|
Data.fontButton = CreateFontButton("SplashFont", "DONE", custom)
|
||||||
|
|
||||||
makeAttributedString()
|
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) {
|
if (Data.Debug) {
|
||||||
spew.Dump(Data.splashArea)
|
spew.Dump(Data.splashArea)
|
||||||
log.Println("DEBUGGING", Data.Debug)
|
log.Println("DEBUGGING", Data.Debug)
|
||||||
} else {
|
} else {
|
||||||
log.Println("NOT DEBUGGING", Data.Debug)
|
log.Println("NOT DEBUGGING AREA mhAH.button =", myAH.button)
|
||||||
log.Println("NOT DEBUGGING", Data.Debug)
|
log.Println("NOT DEBUGGING AREA mhAH.button =", myAH.button)
|
||||||
log.Println("NOT DEBUGGING", Data.Debug)
|
log.Println("NOT DEBUGGING AREA mhAH.button =", myAH.button)
|
||||||
}
|
}
|
||||||
return Data.splashArea
|
return Data.splashArea
|
||||||
}
|
}
|
||||||
|
@ -56,13 +66,6 @@ func makeAttributedString() {
|
||||||
appendWithAttributes("<click or press any key>\n", ui.TextSize(10))
|
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) {
|
func (ah areaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) {
|
||||||
tl := ui.DrawNewTextLayout(&ui.DrawTextLayoutParams{
|
tl := ui.DrawNewTextLayout(&ui.DrawTextLayoutParams{
|
||||||
String: Data.attrstr,
|
String: Data.attrstr,
|
||||||
|
@ -81,16 +84,12 @@ func (ah areaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) {
|
||||||
}
|
}
|
||||||
if (me.Down == 1) {
|
if (me.Down == 1) {
|
||||||
log.Println("GOT MOUSE DOWN")
|
log.Println("GOT MOUSE DOWN")
|
||||||
log.Println("GOT MOUSE DOWN")
|
|
||||||
log.Println("GOT MOUSE DOWN")
|
|
||||||
}
|
}
|
||||||
if (me.Up == 1) {
|
if (me.Up == 1) {
|
||||||
log.Println("GOT MOUSE UP")
|
log.Println("GOT MOUSE UP")
|
||||||
log.Println("GOT MOUSE UP")
|
log.Println("GOT MOUSE UP")
|
||||||
log.Println("GOT MOUSE UP")
|
log.Println("GOT MOUSE UP")
|
||||||
if (Data.MouseClick != nil) {
|
mouseClick(myAH.button)
|
||||||
Data.MouseClick(nil)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
structs.go
13
structs.go
|
@ -13,6 +13,7 @@ import pb "git.wit.com/wit/witProtobuf"
|
||||||
// be the safe way to interact with the GUI
|
// be the safe way to interact with the GUI
|
||||||
//
|
//
|
||||||
var Data GuiDataStructure
|
var Data GuiDataStructure
|
||||||
|
var myAH areaHandler
|
||||||
|
|
||||||
type GuiTabStructure struct {
|
type GuiTabStructure struct {
|
||||||
me *ui.Tab
|
me *ui.Tab
|
||||||
|
@ -68,14 +69,12 @@ type GuiDataStructure struct {
|
||||||
// a tab (maybe the one the user is playing with?)
|
// a tab (maybe the one the user is playing with?)
|
||||||
CurrentTab *GuiTabStructure
|
CurrentTab *GuiTabStructure
|
||||||
// a VM (maybe the one the user is playing with?)
|
// a VM (maybe the one the user is playing with?)
|
||||||
// CurrentVM string
|
|
||||||
CurrentVM *pb.Event_VM
|
CurrentVM *pb.Event_VM
|
||||||
|
|
||||||
// All the tabs
|
// All the tabs
|
||||||
Tabs []GuiTabStructure
|
Tabs []GuiTabStructure
|
||||||
|
|
||||||
// stuff for the splash screen / setup tabs
|
// stuff for the splash screen / setup tabs
|
||||||
// MainWindow *ui.Window
|
|
||||||
cloudWindow *ui.Window
|
cloudWindow *ui.Window
|
||||||
cloudTab *ui.Tab
|
cloudTab *ui.Tab
|
||||||
cloudBox *ui.Box
|
cloudBox *ui.Box
|
||||||
|
@ -102,6 +101,7 @@ type TableColumnData struct {
|
||||||
type ButtonMap struct {
|
type ButtonMap struct {
|
||||||
B *ui.Button
|
B *ui.Button
|
||||||
FB *ui.FontButton
|
FB *ui.FontButton
|
||||||
|
A *ui.Area
|
||||||
Account *pb.Account
|
Account *pb.Account
|
||||||
VM *pb.Event_VM
|
VM *pb.Event_VM
|
||||||
Action string // what type of button
|
Action string // what type of button
|
||||||
|
@ -110,6 +110,15 @@ type ButtonMap struct {
|
||||||
custom func (*ButtonMap)
|
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
|
// TABLE DATA STRUCTURES START
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue