2019-06-03 20:53:14 -05:00
|
|
|
package gui
|
|
|
|
|
2021-10-06 10:43:58 -05:00
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
2019-06-03 20:53:14 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
|
|
|
|
|
2021-10-31 14:21:36 -05:00
|
|
|
// This routine creates a blank window with a Title and size (W x H)
|
|
|
|
//
|
|
|
|
// This routine can not have any arguements due to the nature of how
|
|
|
|
// it can be passed via the 'andlabs/ui' queue which, because it is
|
|
|
|
// cross platform, must pass UI changes into the OS threads (that is
|
|
|
|
// my guess).
|
|
|
|
func NewWindow() *Node {
|
2022-10-19 13:23:22 -05:00
|
|
|
var n *Node
|
|
|
|
var t *toolkit.Toolkit
|
|
|
|
|
2021-10-31 14:21:36 -05:00
|
|
|
title := Config.Title
|
|
|
|
w := Config.Width
|
|
|
|
h := Config.Height
|
2022-10-21 11:40:08 -05:00
|
|
|
// f := Config.Exit
|
2021-10-31 14:21:36 -05:00
|
|
|
|
2022-10-20 06:55:42 -05:00
|
|
|
// Windows are created off of the master node of the Binary Tree
|
|
|
|
n = Config.master.New(title)
|
2022-11-06 12:59:24 -06:00
|
|
|
|
|
|
|
n.OnChanged = Config.Exit
|
2022-10-11 11:25:46 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
t = toolkit.NewWindow(title, w, h)
|
|
|
|
t.Custom = func () {
|
2022-11-06 12:59:24 -06:00
|
|
|
if (Config.Options.Debug) {
|
|
|
|
log.Println("Got to wit/gui Window Close START user defined close()")
|
|
|
|
}
|
|
|
|
if (n.OnChanged != nil) {
|
|
|
|
if (Config.Options.Debug) {
|
|
|
|
log.Println("Got to wit/gui Window Close SKIP node.custom() == nil")
|
|
|
|
}
|
|
|
|
n.OnChanged(n)
|
2022-10-21 11:40:08 -05:00
|
|
|
return
|
2021-10-31 14:21:36 -05:00
|
|
|
}
|
2022-11-06 12:59:24 -06:00
|
|
|
StandardExit(n)
|
2021-10-31 14:21:36 -05:00
|
|
|
}
|
2022-10-20 06:55:42 -05:00
|
|
|
n.toolkit = t
|
2021-10-31 14:21:36 -05:00
|
|
|
return n
|
2021-10-06 10:43:58 -05:00
|
|
|
}
|