forked from dmitmel/CCUpdaterUI
/
waiter.go
29 lines (26 loc) · 876 Bytes
/
waiter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"github.com/20kdc/CCUpdaterUI/design"
"github.com/20kdc/CCUpdaterUI/frenyard"
"github.com/20kdc/CCUpdaterUI/frenyard/framework"
"github.com/20kdc/CCUpdaterUI/frenyard/integration"
)
func (app *upApplication) ShowWaiter(text string, a func(func(string)), b func()) {
label := framework.NewUILabelPtr(integration.NewTextTypeChunk("", design.GlobalFont), design.ThemeText, 0, frenyard.Alignment2i{})
app.Teleport(design.LayoutDocument(design.Header{
Title: text,
}, label, false))
go func () {
a(func (text string) {
app.upQueued <- func () {
label.SetText(integration.NewTextTypeChunk(text, design.GlobalFont))
}
})
app.upQueued <- b
}()
}
func (app *upApplication) MessageBox(title string, text string, b func()) {
app.Teleport(design.LayoutDocument(design.Header{
Title: title,
}, design.LayoutMsgbox(text, b), true))
}