diff --git a/Makefile b/Makefile index 1f5064b..cf71e66 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,9 @@ all: go build -v -x ./control-panel-vpn +goimports: + goimports -w *.go + redomod: rm -f go.* GO111MODULE= go mod init diff --git a/main.go b/main.go index a5cbd2c..a6d07f4 100644 --- a/main.go +++ b/main.go @@ -1,19 +1,27 @@ // This is a simple example package main -import ( - "log" - "go.wit.com/gui/gui" - "go.wit.com/gui/gadgets" - "go.wit.com/apps/control-panel-dns/smartwindow" +import ( + "go.wit.com/log" + + "go.wit.com/gui" + "go.wit.com/lib/gadgets" ) var myGui *gui.Node +var win *gadgets.BasicWindow + func main() { myGui = gui.New().Default() - + myGui.LoadToolkit("andlabs") helloworld() + log.Sleep(1) + win.Toggle() + log.Sleep(1) + win.Toggle() + log.Sleep(1) + win.Toggle() // This is just a optional goroutine to watch that things are alive gui.Watchdog() @@ -21,9 +29,11 @@ func main() { // This creates a window func helloworld() { - win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window") + win = gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window") + win.Make() + win.Draw() - win.Box().NewButton("hello", func () { + win.Box().NewButton("hello", func() { log.Println("world") hellosmart() }) @@ -31,21 +41,11 @@ func helloworld() { // This creates a window func hellosmart() { - win := smartwindow.New() - win.SetParent(myGui) - win.InitWindow() - win.Title("helloworld golang wit/gui window") - win.Vertical() - win.SetDraw(smartDraw) + win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window") win.Make() + win.Draw() - win.Box().NewButton("hello", func () { - log.Println("smart") - }) -} - -func smartDraw(sw *smartwindow.SmartWindow) { - sw.Box().NewButton("hello", func () { + win.Box().NewButton("hello", func() { log.Println("smart") }) }