diff options
| -rw-r--r-- | area.go | 9 | ||||
| -rw-r--r-- | gui.go | 2 | ||||
| -rw-r--r-- | mainCloudBox.go | 14 | ||||
| -rw-r--r-- | splash.go | 11 | ||||
| -rw-r--r-- | structs.go | 3 |
5 files changed, 25 insertions, 14 deletions
@@ -63,6 +63,15 @@ func makeSplashArea(ah *AreaHandler) { } } +func AreaAppendText(newText *ui.AttributedString, what string, attrs ...ui.Attribute) { + start := len(newText.String()) + end := start + len(what) + newText.AppendUnattributed(what) + for _, a := range attrs { + newText.SetAttribute(a, start, end) + } +} + func appendWithAttributes(newText *ui.AttributedString, what string, attrs ...ui.Attribute) { start := len(newText.String()) end := start + len(what) @@ -232,7 +232,7 @@ func CreateFontButton(action string) *ButtonMap { var newBM ButtonMap newBM.Action = action newBM.FB = newB - newBM.AH = myAH + newBM.AH = Data.myAH Data.AllButtons = append(Data.AllButtons, newBM) newB.OnChanged(func (*ui.FontButton) { diff --git a/mainCloudBox.go b/mainCloudBox.go index 2c0c46b..84b8e32 100644 --- a/mainCloudBox.go +++ b/mainCloudBox.go @@ -215,16 +215,17 @@ func makeCloudWindow() { // cloudWindow.SetBorderless(true) // create a 'fake' button entry for the mouse clicks - var newButtonMap ButtonMap - newButtonMap.Action = "QUIT" - Data.AllButtons = append(Data.AllButtons, newButtonMap) + var newBM ButtonMap + newBM.Action = "QUIT" + newBM.W = Data.cloudWindow + Data.AllButtons = append(Data.AllButtons, newBM) Data.cloudWindow.OnClosing(func(*ui.Window) bool { - mouseClick(&newButtonMap) + mouseClick(&newBM) return true }) ui.OnShouldQuit(func() bool { - mouseClick(&newButtonMap) + mouseClick(&newBM) return true }) @@ -232,7 +233,8 @@ func makeCloudWindow() { Data.cloudWindow.SetChild(Data.cloudTab) Data.cloudWindow.SetMargined(true) - Data.cloudBox = ShowSplashBox() + text := makeAttributedString() + Data.cloudBox = ShowSplashBox(text) Data.cloudTab.Append("WIT Splash", Data.cloudBox) Data.cloudTab.SetMargined(0, true) @@ -10,17 +10,16 @@ import "runtime" import "github.com/andlabs/ui" import _ "github.com/andlabs/ui/winmanifest" -func ShowSplashBox() *ui.Box { +func ShowSplashBox(newText *ui.AttributedString) *ui.Box { newbox := ui.NewVerticalBox() newbox.SetPadded(true) // initialize the AreaHandler{} - myAH = new(AreaHandler) - newText := makeAttributedString() - myAH.Attrstr = newText - makeSplashArea(myAH) + Data.myAH = new(AreaHandler) + Data.myAH.Attrstr = newText + makeSplashArea(Data.myAH) - newbox.Append(myAH.Area, true) + newbox.Append(Data.myAH.Area, true) if runtime.GOOS == "linux" { newbox.Append(ui.NewLabel("OS: Linux"), false) @@ -13,7 +13,7 @@ import pb "git.wit.com/wit/witProtobuf" // be the safe way to interact with the GUI // var Data GuiDataStructure -var myAH *AreaHandler +// var myAH *AreaHandler type GuiDataStructure struct { State string @@ -62,6 +62,7 @@ type GuiDataStructure struct { cloudTab *ui.Tab cloudBox *ui.Box smallBox *ui.Box + myAH *AreaHandler tabcount int |
