allow windows to be created off the root node

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-07 08:48:02 -06:00
parent d52f6a6903
commit 6a1b386ca5
1 changed files with 14 additions and 9 deletions

View File

@ -14,17 +14,27 @@ type BasicWindow struct {
vertical bool
title string
parent *gui.Node
// parent *gui.Node
win *gui.Node // window widget
box *gui.Node // box
Custom func()
}
func RawBasicWindow(title string) *BasicWindow {
var w *BasicWindow
w = &BasicWindow{
title: title,
vertical: false,
}
log.Log(GADGETS, "NewBasicWindow() END")
return w
}
func NewBasicWindow(parent *gui.Node, title string) *BasicWindow {
var w *BasicWindow
w = &BasicWindow{
parent: parent,
title: title,
vertical: false,
}
@ -118,9 +128,6 @@ func (w *BasicWindow) Initialized() bool {
if w == nil {
return false
}
if w.parent == nil {
return false
}
return true
}
@ -129,9 +136,6 @@ func (w *BasicWindow) Ready() bool {
if !w.Initialized() {
return false
}
if !w.parent.Ready() {
return false
}
return w.ready
}
@ -165,7 +169,8 @@ func (w *BasicWindow) Make() {
log.Log(GADGETS, "BasicWindow.Make() window was already created")
return
}
w.win = w.parent.RawWindow(w.title)
// w.win = w.parent.RawWindow(w.title)
w.win = gui.RawWindow(w.title)
// if Custom isn't set, set it here. This prevents the application from
// os.Exit() if the window is closed. It destroy's the widgets in the toolkit plugins