summaryrefslogtreecommitdiff
path: root/smartwindow/preReady.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-07 05:46:59 -0600
committerJeff Carr <[email protected]>2024-01-07 05:46:59 -0600
commit930bdc941b1181460f4c38dc708dc53d583ab5d3 (patch)
tree725fc54433bcc5a5947922bae0fee2a6b830b346 /smartwindow/preReady.go
parent82b5717f48f258f6ea792cd4e895c0ba99cf1e11 (diff)
remove debugging options
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'smartwindow/preReady.go')
-rw-r--r--smartwindow/preReady.go84
1 files changed, 84 insertions, 0 deletions
diff --git a/smartwindow/preReady.go b/smartwindow/preReady.go
new file mode 100644
index 0000000..5009d54
--- /dev/null
+++ b/smartwindow/preReady.go
@@ -0,0 +1,84 @@
+// these are things you can config
+package smartwindow
+
+import (
+ "go.wit.com/log"
+ "go.wit.com/gui/gui"
+)
+
+/* for now, run these before the window is ready
+ That is, they all start with:
+
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+*/
+
+func (sw *SmartWindow) Title(title string) {
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+
+ log.Log(WARN, "Title() =", title)
+ sw.title = title
+}
+
+func (sw *SmartWindow) SetParent(p *gui.Node) {
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+
+ log.Log(WARN, "SetParent")
+ if sw.parent == nil {
+ log.Log(WARN, "SetParent =", p)
+ sw.parent = p
+ return
+ } else {
+ log.Log(WARN, "SetParent was already set. TODO: Move to new parent")
+ }
+}
+
+func (sw *SmartWindow) SetDraw(f func(*SmartWindow)) {
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+
+ sw.populate = f
+}
+
+func (sw *SmartWindow) Make() {
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+
+ log.Log(WARN, "Make() window ready =", sw.ready)
+ sw.window.Make()
+ if (sw.populate != nil) {
+ log.Log(WARN, "Make() trying to run Custom sw.populate() here")
+ sw.populate(sw)
+ }
+ sw.ready = true
+}
+
+func (sw *SmartWindow) Draw() {
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+
+ log.Log(WARN, "Draw() window ready =", sw.ready)
+ sw.window.Draw()
+ if (sw.populate != nil) {
+ log.Log(WARN, "Make() trying to run Custom sw.populate() here")
+ sw.populate(sw)
+ }
+ sw.ready = true
+}
+
+
+func (sw *SmartWindow) Vertical() {
+ if ! sw.Initialized() {return}
+ if sw.Ready() {return}
+
+ log.Log(WARN, "Draw() window ready =", sw.ready)
+ sw.window.Draw()
+ if (sw.populate != nil) {
+ log.Log(WARN, "Make() trying to run Custom sw.populate() here")
+ sw.populate(sw)
+ }
+ sw.ready = true
+}
+