summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go78
1 files changed, 37 insertions, 41 deletions
diff --git a/main.go b/main.go
index 5774340..45f692f 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,9 @@ package main
import (
"go.wit.com/gui"
+ "go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets"
+ "go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
)
@@ -16,16 +18,17 @@ var mainWindow *gui.Node
// this is a basic window. the user can open and close it
var basicWindow *gadgets.BasicWindow
-// the computers dropdown
-var computers *gui.Node
-
-// the colors combobox
-var colors *gui.Node
+// the widget structure for both windows
+var section1 *choices
+var section2 *choices
func main() {
- myGui = gui.New().Default()
+ myGui = gui.New()
+ myGui.LoadToolkit("andlabs")
// myGui.LoadToolkit("nocui")
+ myGui.Default()
+
helloworld()
basicWindow = makebasicWindow()
@@ -37,54 +40,47 @@ func main() {
func helloworld() {
mainWindow = myGui.NewWindow("hello world").SetProgName("BASEWIN1")
- box := mainWindow.NewBox("vbox", false)
- group := box.NewGroup("choices")
- grid := group.NewGrid("gridiron", 2, 1)
- grid.NewButton("hello", func() {
- log.Println("world")
- })
- grid.NewButton("show basic window", func() {
+ box := mainWindow.NewBox("hbox", true)
+ section1 = newChoices(box)
+
+ group := box.NewGroup("interact")
+ group.NewButton("show basic window", func() {
basicWindow.Toggle()
})
- grid.NewLabel("a label")
-
- computers = grid.NewDropdown().SetProgName("COMPUTERS")
- computers.AddText("Atari 500")
- computers.AddText("Beagleboard")
- computers.AddText("Unmatched Rev B")
- computers.AddText("asldjf")
- computers.AddText("asdjf")
- computers.AddText("a1jf")
- computers.AddText("jf")
- computers.SetText("Beagleboard")
-
- colors = grid.NewCombobox().SetProgName("COLORS")
- colors.AddText("Cyan")
- colors.AddText("Magenta")
- colors.AddText("Yellow")
- colors.SetText("orange")
-
- grid.NewCheckbox("Checkers").SetProgName("CHECKERS")
- queryGroup := box.NewGroup("interact")
-
- queryGroup.NewButton("Which Computer?", func() {
- tmp := computers.String()
+ group.NewButton("Which Computer?", func() {
+ tmp := section1.computers.String()
log.Println("computer =", tmp)
- for i, s := range computers.Strings() {
+ for i, s := range section1.computers.Strings() {
log.Println("has option", i, s)
}
})
- queryGroup.NewButton("Which Color?", func() {
- tmp := colors.String()
+ group.NewButton("Which Color?", func() {
+ tmp := section1.colors.String()
log.Println("color =", tmp)
})
- queryGroup.NewButton("Show apple", func() {
+ group.NewButton("Show apple", func() {
apple.Show()
})
- queryGroup.NewButton("Hide apple", func() {
+ group.NewButton("Hide apple", func() {
apple.Hide()
})
+ group.NewButton("set socks", func() {
+ section1.SetSocks("blue")
+ section2.SetSocks("green")
+ })
+ group.NewButton("show socks", func() {
+ log.Info("main window socks =", section1.socks.String())
+ log.Info("basic window socks =", section2.socks.String())
+ })
+
+ group = box.NewGroup("debug")
+ group.NewButton("debugger", func() {
+ debugger.DebugWindow()
+ })
+ group.NewButton("log options", func() {
+ logsettings.LogWindow()
+ })
}