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-11-13 08:53:03 -06:00
|
|
|
//import toolkit "git.wit.org/wit/gui/toolkit/andlabs"
|
2022-10-19 13:23:22 -05:00
|
|
|
|
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-11-13 08:53:03 -06:00
|
|
|
var newNode *Node
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2021-10-31 14:21:36 -05:00
|
|
|
title := Config.Title
|
2022-10-20 06:55:42 -05:00
|
|
|
// Windows are created off of the master node of the Binary Tree
|
2022-11-13 08:53:03 -06:00
|
|
|
newNode = Config.master.New(title)
|
2022-11-06 12:59:24 -06:00
|
|
|
|
2022-11-13 08:53:03 -06:00
|
|
|
newNode.Widget.Name = title
|
|
|
|
newNode.Widget.Width = Config.Width
|
|
|
|
newNode.Widget.Height = Config.Height
|
2022-10-11 11:25:46 -05:00
|
|
|
|
2022-11-13 08:53:03 -06:00
|
|
|
if (Config.Exit != nil) {
|
|
|
|
newNode.custom = func() {
|
|
|
|
Config.Exit(newNode)
|
2022-11-06 12:59:24 -06:00
|
|
|
}
|
2022-11-13 08:53:03 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (newNode.custom == nil) {
|
|
|
|
newNode.custom = func () {StandardExit(newNode)}
|
|
|
|
}
|
|
|
|
|
|
|
|
newNode.Widget.Custom = newNode.custom
|
|
|
|
|
|
|
|
log.Println("gui.Node.Window()", title)
|
|
|
|
|
|
|
|
for _, aplug := range allPlugins {
|
|
|
|
log.Println("gui.Node.NewWindow() toolkit plugin =", aplug.name)
|
|
|
|
if (aplug.NewWindow == nil) {
|
|
|
|
log.Println("gui.Node.NewWindow() is nil")
|
|
|
|
continue
|
2021-10-31 14:21:36 -05:00
|
|
|
}
|
2022-11-13 08:53:03 -06:00
|
|
|
aplug.NewWindow(&newNode.Widget)
|
2021-10-31 14:21:36 -05:00
|
|
|
}
|
2022-11-13 08:53:03 -06:00
|
|
|
|
|
|
|
return newNode
|
2021-10-06 10:43:58 -05:00
|
|
|
}
|