Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-09 01:16:00 -06:00
commit a0be4a93d1
3 changed files with 64 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*
!.gitignore
!Makefile
!*.go

9
Makefile Normal file
View File

@ -0,0 +1,9 @@
all:
go build -v -x
./control-panel-vpn
redomod:
rm -f go.*
go mod init
go mod tidy

51
main.go Normal file
View File

@ -0,0 +1,51 @@
// 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"
)
var myGui *gui.Node
func main() {
myGui = gui.New().Default()
helloworld()
// This is just a optional goroutine to watch that things are alive
gui.Watchdog()
}
// This creates a window
func helloworld() {
win := gadgets.NewBasicWindow(myGui, "helloworld golang wit/gui window")
win.Box().NewButton("hello", func () {
log.Println("world")
hellosmart()
})
}
// 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.Make()
win.Box().NewButton("hello", func () {
log.Println("smart")
})
}
func smartDraw(sw *smartwindow.SmartWindow) {
sw.Box().NewButton("hello", func () {
log.Println("smart")
})
}