Go to file
Jeff Carr 0482931c92 stub in an option to provide a file 2025-01-20 07:58:50 -06:00
.gitignore golang release attempt 18 2024-01-30 15:40:50 -06:00
LICENSE maybe follow Bruce's lead on this with PostOpen 2024-12-25 20:31:51 -06:00
LICENSE.PostOpen maybe follow Bruce's lead on this with PostOpen 2024-12-25 20:31:51 -06:00
Makefile add a 'app' defined default plugin variable 2025-01-20 05:06:08 -06:00
README.md try using go1.20 2024-12-01 12:52:14 -06:00
action.go gocui panic() loads nocui correctly 2024-02-09 09:29:55 -06:00
addText.go prepare for protobuf 2024-02-05 15:02:09 -06:00
argv.go stub in an option to provide a file 2025-01-20 07:58:50 -06:00
box.go start thinking further about exact layouts & views 2024-02-17 14:21:25 -06:00
button.go move widget 2024-01-18 03:51:04 -06:00
checkbox.go quiet earlier checkbox debugging code 2024-02-22 17:34:15 -06:00
common.go updates for v0.22 gui changes 2024-11-05 01:41:44 -06:00
debug.go prepare for protobuf 2024-02-05 15:02:09 -06:00
dropdown.go use internal log flags 2024-02-07 08:47:06 -06:00
flags.go use internal log flags 2024-02-07 08:47:06 -06:00
grid.go add grid without bounds 2024-02-09 04:54:42 -06:00
group.go hidden settings seem to work 2024-01-19 17:08:42 -06:00
image.go use internal log flags 2024-02-07 08:47:06 -06:00
init.go add a 'app' defined default plugin variable 2025-01-20 05:06:08 -06:00
label.go seperate mirror code 2024-02-22 19:27:49 -06:00
mirror.go seperate mirror code 2024-02-22 19:27:49 -06:00
node.go seperate mirror code 2024-02-22 19:27:49 -06:00
plugin.go add a 'app' defined default plugin variable 2025-01-20 05:06:08 -06:00
redraw.go load toolkit working better 2024-01-27 12:30:34 -06:00
release-logo.png print a simple text colsole banner on init() 2024-02-25 18:38:47 -06:00
separator.go move widget 2024-01-18 03:51:04 -06:00
setText.go use the common SetLabel() function 2024-02-19 19:42:42 -06:00
slider.go move widget 2024-01-18 03:51:04 -06:00
spinner.go visable state is honored. TODO: fix hide/show 2024-01-21 14:44:47 -06:00
structs.go add a 'app' defined default plugin variable 2025-01-20 05:06:08 -06:00
table.go seperate mirror code 2024-02-22 19:27:49 -06:00
textbox.go allow Windows to be made directly off the binary tree 2024-02-06 20:40:13 -06:00
watchdog.go grid.NextRow() plugin counter 2024-02-09 03:45:49 -06:00
window.go use internal log flags 2024-02-07 08:47:06 -06:00

README.md

gui

Package gui implements a abstraction layer for Go visual elements. TODO: check and see if go1.20 is new enough to build this

Hello World Example

// This creates a simple hello world window
package main

import 	(
	"log"
	"go.wit.com/gui"
)

var myGui *gui.Node // This is your gui object

func main() {
	myGui = gui.New().Default()

    helloworld()

    // go will sit here until the window exits
    // intermittently, it will show toolkit statistics
    gui.Watchdog()
}

// This initializes the first window and 2 tabs
func helloworld() {
	window := myGui.NewWindow()

	group := window.NewGroup("a group of widgets")
	group.NewButton("hello", func() {
		log.Println("world")
	})
}

Build

This will build the simple hello world example above.

go install go.wit.com/apps/helloworld@latest

A more extensive list of applications can be found on go.wit.com.

Build Toolkit Plugins

This is an example of how to build the console based toolkit plugin built against the gocui package.

GO111MODULE=off go get go.wit.com/toolkits/gocui
cd ~/go/src/go.wit.com/toolkits/gocui
go build -v -buildmode=plugin -o ~/go/lib/toolkits/gocui.so

Toolkits

The toolkits are compiled as plugins and communicate only over a channel to your application. This way, the toolkits are isolated and you don't have to care about what the user uses to display things when you write your application. Also, that allows the control panels to run in both a traditional GUI like GTK or in the console like ncurses.

There are two working toolkits. One is written to the andlabs package which provides a native linux, macos and windows. The second one is terminal window based using gocui. (There is a 3rd one using STDIN/STDOUT as a template to create new toolkit plugins.) Also, GO doesn't support plugins on Windows so the native Windows GUI awaits someone to fix that.

The next step is to allow this to work against go-gtk and go-qt.

Others potential plugins: Fyne, WASM, native macos & windows, android and hopefully also things like libSDL, faiface/pixel, slint

General Thoughts

A primary design purpose for this toolkit is to be able to develop a modern set of control panels for linux. Specifically a DNS and IPv6 control panel. Since the toolkit interface plugins are cross platform, these control panels should be able to run on the Macos and Windows also.

Definitions:

* Toolkit: the underlying GUI library (MacOS gui, Windows gui, gtk, qt, etc)
* Node: A binary tree of all the underlying widgets

Principles:

* Make code using this package simple to use
* Hide complexity internally here
* Isolate the GUI toolkit
* Widget names should try to match [Wikipedia Graphical widget]
* When in doubt, search upward in the binary tree
* It's ok to guess. Try to do something sensible.

Bugs

"The author's idea of friendly may differ to that of many other people."

-- quote from the minimalistic window manager 'evilwm'

References

Useful links and other external things which might be useful