summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/common.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-10-21 11:40:08 -0500
committerJeff Carr <[email protected]>2022-10-21 11:40:08 -0500
commita3fc02c2f7e22f92b76ff6db92618be0cf3656a6 (patch)
tree70c05aada2b3acfbb95d1e6e0098291c7f8b6bcf /toolkit/andlabs/common.go
parentb8ef0bb05dc14bc4291f3d156b199fa125cdb9d7 (diff)
v0.4.1 set sane toolkit default look and feelv0.4.1
autogenerate README.md from doc.go (goreadme cmd) remove passing arguements on a mouse click() make defaults for padding, margin, stretchy, etc add a checkbox widget function rename to NewButton() keep cleaning up toolkit code fix date. I was somehow in the future Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/common.go')
-rw-r--r--toolkit/andlabs/common.go46
1 files changed, 46 insertions, 0 deletions
diff --git a/toolkit/andlabs/common.go b/toolkit/andlabs/common.go
new file mode 100644
index 0000000..75f7444
--- /dev/null
+++ b/toolkit/andlabs/common.go
@@ -0,0 +1,46 @@
+package toolkit
+
+import "log"
+
+// import "github.com/andlabs/ui"
+// import _ "github.com/andlabs/ui/winmanifest"
+
+func init() {
+ log.Println("gui/toolkit init() Setting defaultBehavior = true")
+ setDefaultBehavior(true)
+}
+
+func (t Toolkit) commonChange(widget string) {
+ s := t.String()
+ log.Println("gui.Toolkit.ui.OnChanged() =", s)
+ if (DebugToolkit) {
+ log.Println("gui.Toolkit.ui.OnChanged() =", s)
+ }
+ if (t.OnChanged != nil) {
+ log.Println("gui.Toolkit.OnChanged() trying to run toolkit.OnChanged() entered val =", s)
+ t.OnChanged(&t)
+ return
+ }
+ if (t.Custom != nil) {
+ log.Println("gui.Toolkit.OnChanged() Running toolkit.Custom()")
+ t.Dump()
+ t.Custom()
+ return
+ }
+ log.Println("gui.Toolkit.OnChanged() ENDED without finding any callback")
+}
+
+func (t Toolkit) broken() bool {
+ if (t.uiBox == nil) {
+ log.Println("gui.Toolkit.UiBox == nil. I can't add a widget without a place to put it")
+ // log.Println("probably could just make a box here?")
+ // corruption or something horrible?
+ panic("wit/gui toolkit/andlabs func broken() invalid goroutine access into this toolkit?")
+ return true
+ }
+ if (t.uiWindow == nil) {
+ log.Println("gui.Toolkit.UiWindow == nil. I can't add a widget without a place to put it (IGNORING FOR NOW)")
+ return false
+ }
+ return false
+}