summaryrefslogtreecommitdiff
path: root/toolkit/nocui/stdin.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-01 15:43:50 -0600
committerJeff Carr <[email protected]>2024-01-01 15:43:50 -0600
commit4e7bbd89900a733593f0848778103c1cf1a7145d (patch)
tree22cd22124dd3ecba7c2a866b882d39aaf790d670 /toolkit/nocui/stdin.go
parent53ce3a8252090d5fb75d7fc1e3cd75a72c1415c6 (diff)
reorg to final resting place at go.wit.com/gui/guiv0.9.5
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/nocui/stdin.go')
-rw-r--r--toolkit/nocui/stdin.go80
1 files changed, 0 insertions, 80 deletions
diff --git a/toolkit/nocui/stdin.go b/toolkit/nocui/stdin.go
deleted file mode 100644
index 98285c0..0000000
--- a/toolkit/nocui/stdin.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package main
-
-import (
- "os"
- "fmt"
- "bufio"
- "strings"
- "strconv"
-
- "go.wit.com/gui/toolkit"
-)
-
-func simpleStdin() {
- scanner := bufio.NewScanner(os.Stdin)
- for scanner.Scan() {
- s := scanner.Text()
- s = strings.TrimSuffix(s, "\n")
- switch s {
- case "l":
- log(true, "list widgets")
- me.rootNode.listWidgets()
- case "b":
- log(true, "show buttons")
- me.rootNode.showButtons()
- case "d":
- var a toolkit.Action
- a.ActionType = toolkit.EnableDebug
- callback <- a
- case "":
- fmt.Println("")
- fmt.Println("Enter:")
- fmt.Println("'l': list all widgets")
- fmt.Println("'b': for buttons")
- fmt.Println("'d': enable debugging")
- default:
- i, _ := strconv.Atoi(s)
- log(true, "got input:", i)
- n := me.rootNode.findWidgetId(i)
- if (n != nil) {
- n.dumpWidget("found node")
- n.doUserEvent()
- }
- }
- }
-}
-
-func (n *node) showButtons() {
- if n.WidgetType == toolkit.Button {
- n.dumpWidget("Button:")
- }
-
- for _, child := range n.children {
- child.showButtons()
- }
-}
-
-func (n *node) dumpWidget(pad string) {
- log(true, "node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.Name)
-}
-
-var depth int = 0
-
-func (n *node) listWidgets() {
- if (n == nil) {
- return
- }
-
- var pad string
- for i := 0; i < depth; i++ {
- pad = pad + " "
- }
- n.dumpWidget(pad)
-
- for _, child := range n.children {
- depth += 1
- child.listWidgets()
- depth -= 1
- }
- return
-}