remove the myAH stand alone variable
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
64eada2638
commit
bde27292ea
9
area.go
9
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)
|
||||
|
|
2
gui.go
2
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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
11
splash.go
11
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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue