diff --git a/area.go b/area.go index 5210163..7e93a77 100644 --- a/area.go +++ b/area.go @@ -20,7 +20,7 @@ func findFB(button *GuiButton) *GuiButton { return a } -func makeSplashArea(wm *GuiWindow, ah *AreaHandler) { +func makeSplashArea(wm *GuiWindow, ah *GuiArea) { // make this button just to get the default font (but don't display the button) // There should be another way to do this (?) newB := CreateFontButton(wm, "AREA") @@ -59,7 +59,7 @@ func appendWithAttributes(newText *ui.AttributedString, what string, attrs ...ui } } -func (ah AreaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { +func (ah GuiArea) Draw(a *ui.Area, p *ui.AreaDrawParams) { tl := ui.DrawNewTextLayout(&ui.DrawTextLayoutParams{ String: ah.Attrstr, DefaultFont: ah.Button.FB.Font(), @@ -70,7 +70,7 @@ func (ah AreaHandler) Draw(a *ui.Area, p *ui.AreaDrawParams) { defer tl.Free() } -func (ah AreaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) { +func (ah GuiArea) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) { if (Data.Debug) { log.Println("GOT MouseEvent() ah.Button =", ah.Button) spew.Dump(me) @@ -88,15 +88,15 @@ func (ah AreaHandler) MouseEvent(a *ui.Area, me *ui.AreaMouseEvent) { } } -func (ah AreaHandler) MouseCrossed(a *ui.Area, left bool) { +func (ah GuiArea) MouseCrossed(a *ui.Area, left bool) { log.Println("GOT MouseCrossed()") } -func (ah AreaHandler) DragBroken(a *ui.Area) { +func (ah GuiArea) DragBroken(a *ui.Area) { log.Println("GOT DragBroken()") } -func (ah AreaHandler) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) { +func (ah GuiArea) KeyEvent(a *ui.Area, ke *ui.AreaKeyEvent) (handled bool) { log.Println("GOT KeyEvent()") if (ke.Key == 10) { log.Println("GOT ENTER") diff --git a/splash.go b/splash.go index 0c46251..07ae6da 100644 --- a/splash.go +++ b/splash.go @@ -22,8 +22,8 @@ func ShowSplashBox(wm *GuiWindow, newText *ui.AttributedString) *ui.Box { newbox := ui.NewVerticalBox() newbox.SetPadded(true) - // initialize the AreaHandler{} - wm.AH = new(AreaHandler) + // initialize the GuiArea{} + wm.AH = new(GuiArea) wm.AH.WM = wm wm.AH.Attrstr = newText makeSplashArea(wm, wm.AH) diff --git a/structs.go b/structs.go index 8251f24..0476f6c 100644 --- a/structs.go +++ b/structs.go @@ -44,6 +44,7 @@ type GuiData struct { // windows, all tabs, across all goroutines // This is "GLOBAL" AllButtons []GuiButton + ButtonMap map[*GuiButton][]func (*GuiButton) // A map of all the entry boxes AllEntries []*GuiEntry @@ -80,17 +81,21 @@ type GuiEntry struct { Action string // what type of button } +type GuiBox struct { + EntryMap map[string][]*GuiEntry + AH *GuiArea + +} + type GuiWindow struct { W *ui.Window T *ui.Tab Box1 *ui.Box Box2 *ui.Box - EntryMap map[string][]*GuiEntry - C *pb.Config - AH *AreaHandler + AH *GuiArea Action string } @@ -109,7 +114,7 @@ type GuiButton struct { W *ui.Window T *ui.Tab - AH *AreaHandler + AH *GuiArea // git.wit.com/wit/gui stuff WM *GuiWindow @@ -123,7 +128,7 @@ type GuiButton struct { // AREA STRUCTURES START -type AreaHandler struct{ +type GuiArea struct{ Button *GuiButton Attrstr *ui.AttributedString Area *ui.Area