summaryrefslogtreecommitdiff
path: root/checkbox.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-18 00:08:37 -0600
committerJeff Carr <[email protected]>2024-01-18 00:08:37 -0600
commit3ac6b2486a7f17e96ea8d812437ed9bad8662260 (patch)
treeaaf29d4a1f6fc591a3738077e6cebf26fe637849 /checkbox.go
init move into seperate repo. all history lost :(v0.0.1
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'checkbox.go')
-rw-r--r--checkbox.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/checkbox.go b/checkbox.go
new file mode 100644
index 0000000..76b4377
--- /dev/null
+++ b/checkbox.go
@@ -0,0 +1,33 @@
+package main
+
+import (
+ // "github.com/awesome-gocui/gocui"
+ "go.wit.com/lib/widget"
+)
+
+func (n *node) setCheckbox(b any) {
+ w := n.tk
+ if n.WidgetType != widget.Checkbox {
+ return
+ }
+ if widget.GetBool(b) {
+ n.value = b
+ n.tk.label = "X " + n.label
+ } else {
+ n.value = b
+ n.tk.label = " " + n.label
+ }
+ t := len(n.tk.label) + 1
+ w.gocuiSize.w1 = w.gocuiSize.w0 + t
+
+ // w.realWidth = w.gocuiSize.Width() + me.PadW
+ // w.realHeight = w.gocuiSize.Height() + me.PadH
+
+ // if w.frame {
+ // w.realWidth += me.FramePadW
+ // w.realHeight += me.FramePadH
+ // }
+
+ n.deleteView()
+ n.showView()
+}