From a0be4a93d1776ef2b173edecbf6aef11ba910ad7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 9 Jan 2024 01:16:00 -0600 Subject: [PATCH] start Signed-off-by: Jeff Carr --- .gitignore | 4 ++++ Makefile | 9 +++++++++ main.go | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 main.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3aa4127 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +* +!.gitignore +!Makefile +!*.go diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1c870cb --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +all: + go build -v -x + ./control-panel-vpn + +redomod: + rm -f go.* + go mod init + go mod tidy + diff --git a/main.go b/main.go new file mode 100644 index 0000000..a5cbd2c --- /dev/null +++ b/main.go @@ -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") + }) +}