From d9115cc29adeac39159587bf72b16e9349154997 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 14 Jan 2024 10:25:23 -0600 Subject: [PATCH] compiles and runs Signed-off-by: Jeff Carr --- basicWindow.go | 55 ++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/basicWindow.go b/basicWindow.go index d4a9766..aa8713b 100644 --- a/basicWindow.go +++ b/basicWindow.go @@ -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() }