summaryrefslogtreecommitdiff
path: root/choices.go
diff options
context:
space:
mode:
Diffstat (limited to 'choices.go')
-rw-r--r--choices.go65
1 files changed, 65 insertions, 0 deletions
diff --git a/choices.go b/choices.go
new file mode 100644
index 0000000..32eecf6
--- /dev/null
+++ b/choices.go
@@ -0,0 +1,65 @@
+// This creates a simple hello world window
+package main
+
+import (
+ "go.wit.com/gui"
+ "go.wit.com/lib/gadgets"
+ "go.wit.com/log"
+)
+
+type choices struct {
+ group *gui.Node // the group
+ grid *gui.Node // the grid
+ hello *gui.Node // the hello button
+ computers *gui.Node
+ colors *gui.Node
+ checkers *gui.Node
+
+ socks *gadgets.OneLiner
+}
+
+// This initializes the first window and some widgets
+func newChoices(parent *gui.Node) *choices {
+ var c *choices
+ c = new(choices)
+ c.group = parent.NewGroup("choices")
+ c.grid = c.group.NewGrid("gridiron", 2, 1)
+ c.grid.NewButton("hello", func() {
+ log.Info("world")
+ })
+ c.grid.NewButton("show basic window", func() {
+ basicWindow.Toggle()
+ })
+ c.grid.NewLabel("a label")
+
+ c.computers = c.grid.NewDropdown().SetProgName("COMPUTERS")
+ c.computers.AddText("Atari 500")
+ c.computers.AddText("Beagleboard")
+ c.computers.AddText("Unmatched Rev B")
+ c.computers.AddText("asldjf")
+ c.computers.AddText("asdjf")
+ c.computers.AddText("a1jf")
+ c.computers.AddText("jf")
+ c.computers.SetText("Beagleboard")
+
+ c.colors = c.grid.NewCombobox().SetProgName("COLORS")
+ c.colors.AddText("Cyan")
+ c.colors.AddText("Magenta")
+ c.colors.AddText("Yellow")
+ c.colors.SetText("orange")
+
+ c.checkers = c.grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
+ c.checkers.Custom = func() {
+ log.Info("Checkers is", c.checkers.Bool())
+ }
+
+ c.socks = gadgets.NewOneLiner(c.grid, "two for one")
+ c.socks.SetValue("socks")
+
+ return c
+}
+
+func (c *choices) SetSocks(s string) *choices {
+ c.socks.SetValue(s)
+ return c
+}