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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package main
import (
"embed"
"git.wit.org/wit/gui/toolkit"
"github.com/andlabs/ui"
// the _ means we only need this for the init()
_ "github.com/andlabs/ui/winmanifest"
)
//go:embed resources
var res embed.FS
func Main(f func()) {
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
ui.Main( func() {
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
// time.Sleep(1 * time.Second)
// NewWindow2("helloworld2", 200, 100)
f()
})
}
// Other goroutines must use this to access the GUI
//
// You can not acess / process the GUI thread directly from
// other goroutines. This is due to the nature of how
// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
//
// For example: Queue(NewWindow())
//
func Queue(f func()) {
log(debugToolkit, "Sending function to ui.QueueMain()")
log(true, "using gui.Queue() in this plugin DOES BREAK. TODO: wrap this")
ui.QueueMain(f)
}
func Init() {
log(debugToolkit, "Init()")
mapWidgets = make(map[*andlabsT]*toolkit.Widget)
mapToolkits = make(map[*toolkit.Widget]*andlabsT)
}
func Quit() {
log(debugToolkit, "Quit() TODO: close the toolkit cleanly")
}
|