2022-10-11 11:25:46 -05:00
|
|
|
// This creates a simple hello world window
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2022-10-16 08:07:13 -05:00
|
|
|
"os"
|
|
|
|
"log"
|
2022-10-11 11:25:46 -05:00
|
|
|
"git.wit.org/wit/gui"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
gui.Main(initGUI)
|
|
|
|
}
|
|
|
|
|
|
|
|
// This initializes the first window
|
|
|
|
func initGUI() {
|
|
|
|
gui.Config.Title = "Hello World golang wit/gui Window"
|
|
|
|
gui.Config.Width = 640
|
|
|
|
gui.Config.Height = 480
|
2022-10-16 08:07:13 -05:00
|
|
|
gui.Config.Exit = myDefaultExit
|
|
|
|
|
2022-10-11 11:25:46 -05:00
|
|
|
node1 := gui.NewWindow()
|
|
|
|
addDemoTab(node1, "A Simple Tab Demo")
|
|
|
|
addDemoTab(node1, "A Second Tab")
|
|
|
|
}
|
|
|
|
|
|
|
|
func addDemoTab(n *gui.Node, title string) {
|
|
|
|
newNode := n.AddTab(title, nil)
|
|
|
|
|
2022-10-17 22:39:03 -05:00
|
|
|
g := newNode.NewGroup("group 1")
|
|
|
|
// g.Dump()
|
|
|
|
g.AddComboBox("demoCombo2", "more 1", "more 2", "more 3")
|
2022-10-11 11:25:46 -05:00
|
|
|
}
|
2022-10-16 08:07:13 -05:00
|
|
|
|
|
|
|
func myDefaultExit(n *gui.Node) {
|
|
|
|
log.Println("You can Do exit() things here")
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
|