compiles and runs

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-14 10:25:23 -06:00
parent 9d468879c7
commit d9115cc29a
1 changed files with 20 additions and 35 deletions

View File

@ -21,11 +21,16 @@ type BasicWindow struct {
Custom func()
}
func (w *BasicWindow) Hide() {
if ! w.Ready() {return}
w.win.Hide()
w.hidden = true
return
func NewBasicWindow(parent *gui.Node, title string) *BasicWindow {
var w *BasicWindow
w = &BasicWindow {
parent: parent,
title: title,
vertical: false,
}
log.Warn("NewBasicWindow() END")
return w
}
func (w *BasicWindow) Show() {
@ -35,6 +40,13 @@ func (w *BasicWindow) Show() {
return
}
func (w *BasicWindow) Hide() {
if ! w.Ready() {return}
w.win.Hide()
w.hidden = true
return
}
func (w *BasicWindow) Toggle() {
if ! w.Ready() {return}
if w.hidden {
@ -115,7 +127,7 @@ func (w *BasicWindow) TestDraw() {
if ! w.Initialized() {return}
if w.win == nil {
log.Warn("BasicWindow.TestDraw() can't draw on window == nil")
return
w.Make()
}
log.Warn("BasicWindow.TestDraw() RUNNING HERE")
w.win.TestDraw()
@ -125,34 +137,7 @@ func (w *BasicWindow) Draw() {
if ! w.Initialized() {return}
if w.win != nil {
log.Warn("BasicWindow.Draw() window was already created")
return
w.Make()
}
// various timeout settings
w.win = w.parent.NewWindow(w.title)
w.win.Custom = func() {
log.Warn("BasicWindow.Custom() closed. TODO: handle this", w.title)
}
log.Warn("BasicWindow.Draw() about to make a box vertical =", w.vertical, w.title)
if w.vertical {
w.box = w.win.NewVerticalBox("BW VBOX")
log.Log(INFO, "BasicWindow.Draw() made vbox title =", w.title)
} else {
w.box = w.win.NewHorizontalBox("BW HBOX")
log.Log(INFO, "BasicWindow.Draw() made hbox title =", w.title)
}
w.ready = true
}
func NewBasicWindow(parent *gui.Node, title string) *BasicWindow {
var w *BasicWindow
w = &BasicWindow {
parent: parent,
title: title,
vertical: false,
}
log.Warn("NewBasicWindow() END")
return w
w.win.TestDraw()
}