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 vertical bool
title string title string
parent *gui.Node // parent *gui.Node
win *gui.Node // window widget win *gui.Node // window widget
box *gui.Node // box box *gui.Node // box
Custom func() 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 { func NewBasicWindow(parent *gui.Node, title string) *BasicWindow {
var w *BasicWindow var w *BasicWindow
w = &BasicWindow{ w = &BasicWindow{
parent: parent,
title: title, title: title,
vertical: false, vertical: false,
} }
@ -118,9 +128,6 @@ func (w *BasicWindow) Initialized() bool {
if w == nil { if w == nil {
return false return false
} }
if w.parent == nil {
return false
}
return true return true
} }
@ -129,9 +136,6 @@ func (w *BasicWindow) Ready() bool {
if !w.Initialized() { if !w.Initialized() {
return false return false
} }
if !w.parent.Ready() {
return false
}
return w.ready return w.ready
} }
@ -165,7 +169,8 @@ func (w *BasicWindow) Make() {
log.Log(GADGETS, "BasicWindow.Make() window was already created") log.Log(GADGETS, "BasicWindow.Make() window was already created")
return 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 // 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 // os.Exit() if the window is closed. It destroy's the widgets in the toolkit plugins