summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--area.go9
-rw-r--r--gui.go2
-rw-r--r--mainCloudBox.go14
-rw-r--r--splash.go11
-rw-r--r--structs.go3
5 files changed, 25 insertions, 14 deletions
diff --git a/area.go b/area.go
index 73279aa..8109232 100644
--- a/area.go
+++ b/area.go
@@ -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)
diff --git a/gui.go b/gui.go
index 407984f..8b01821 100644
--- a/gui.go
+++ b/gui.go
@@ -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)
diff --git a/splash.go b/splash.go
index 96a360b..504bd8e 100644
--- a/splash.go
+++ b/splash.go
@@ -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)
diff --git a/structs.go b/structs.go
index 6b0ee3c..6d1796a 100644
--- a/structs.go
+++ b/structs.go
@@ -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