2022-11-14 14:30:28 -06:00
|
|
|
package main
|
2022-10-20 06:55:42 -05:00
|
|
|
|
|
|
|
import (
|
2022-11-14 14:30:28 -06:00
|
|
|
"git.wit.org/wit/gui/toolkit"
|
2022-10-20 06:55:42 -05:00
|
|
|
|
|
|
|
"github.com/andlabs/ui"
|
2022-11-06 12:59:24 -06:00
|
|
|
// the _ means we only need this for the init()
|
2022-10-20 06:55:42 -05:00
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Main(f func()) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "Starting gui.Main() (using gtk via andlabs/ui)")
|
2022-11-14 14:30:28 -06:00
|
|
|
ui.Main( func() {
|
2023-02-25 14:05:25 -06:00
|
|
|
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)")
|
2022-11-14 14:30:28 -06:00
|
|
|
// time.Sleep(1 * time.Second)
|
|
|
|
// NewWindow2("helloworld2", 200, 100)
|
|
|
|
f()
|
|
|
|
})
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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()) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "Sending function to ui.QueueMain() (using gtk via andlabs/ui)")
|
|
|
|
log("THIS MIGHT BREAK")
|
|
|
|
ui.QueueMain(f)
|
|
|
|
// f()
|
2022-11-14 14:30:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func Init() {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "should Init() here")
|
2022-11-14 14:30:28 -06:00
|
|
|
|
|
|
|
mapWidgets = make(map[*andlabsT]*toolkit.Widget)
|
|
|
|
mapToolkits = make(map[*toolkit.Widget]*andlabsT)
|
|
|
|
}
|
|
|
|
|
|
|
|
func Quit() {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "should Quit() here")
|
2022-11-14 14:30:28 -06:00
|
|
|
// myExit(nil)
|
2022-10-20 06:55:42 -05:00
|
|
|
}
|