2021-10-06 08:36:28 -05:00
|
|
|
package gui
|
|
|
|
|
2021-10-06 10:43:58 -05:00
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
2021-10-06 08:36:28 -05:00
|
|
|
|
2022-10-20 06:55:42 -05:00
|
|
|
import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
|
|
|
|
|
|
|
|
|
|
|
|
// the _ means we only need this for the init()
|
|
|
|
|
|
|
|
const Xaxis = 0 // box that is horizontal
|
|
|
|
const Yaxis = 1 // box that is vertical
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
log.Println("gui.init() has been run")
|
|
|
|
|
|
|
|
Config.counter = 0
|
|
|
|
Config.prefix = "wit"
|
|
|
|
Config.DebugNode = false
|
|
|
|
Config.DebugTabs = false
|
|
|
|
|
|
|
|
title := "master"
|
|
|
|
w := 640
|
|
|
|
h := 480
|
2022-10-21 11:40:08 -05:00
|
|
|
// f := StandardClose
|
2022-10-20 06:55:42 -05:00
|
|
|
|
|
|
|
Config.master = addNode(title, w, h)
|
2022-10-21 11:40:08 -05:00
|
|
|
// Config.master.custom = f
|
2022-10-20 06:55:42 -05:00
|
|
|
|
|
|
|
Config.master.Dump()
|
|
|
|
}
|
|
|
|
|
2021-10-06 08:36:28 -05:00
|
|
|
func Main(f func()) {
|
|
|
|
log.Println("Starting gui.Main() (using gtk via andlabs/ui)")
|
2022-10-20 06:55:42 -05:00
|
|
|
toolkit.Main(f)
|
2021-10-06 08:36:28 -05:00
|
|
|
}
|
|
|
|
|
2021-10-31 14:21:36 -05:00
|
|
|
// Other goroutines must use this to access the GUI
|
2021-10-06 08:36:28 -05:00
|
|
|
//
|
|
|
|
// You can not acess / process the GUI thread directly from
|
2021-10-06 10:43:58 -05:00
|
|
|
// other goroutines. This is due to the nature of how
|
2021-10-06 08:36:28 -05:00
|
|
|
// Linux, MacOS and Windows work (they all work differently. suprise. surprise.)
|
2022-10-20 06:55:42 -05:00
|
|
|
// For example: gui.Queue(NewWindow())
|
2021-10-06 08:36:28 -05:00
|
|
|
func Queue(f func()) {
|
|
|
|
log.Println("Sending function to gui.Main() (using gtk via andlabs/ui)")
|
2022-10-20 06:55:42 -05:00
|
|
|
toolkit.Queue(f)
|
2021-10-06 08:36:28 -05:00
|
|
|
}
|