Go to file
Jeff Carr 97f0204f5a try a binary tree create here 2025-05-23 10:31:43 -05: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 notes about Bruce's legal project 2025-03-03 00:50:53 -06:00
Makefile start thinking about a raw grid widget 2025-02-21 05:41:54 -06:00
README.md try using go1.20 2024-12-01 12:52:14 -06:00
action.go turn off the debugging 2025-02-09 14:19:06 -06:00
addText.go prepare for protobuf 2024-02-05 15:02:09 -06:00
argv.go add options to debug plugin load failures 2025-03-06 07:56:23 -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 quiet debug output 2025-03-10 23:38:29 -05: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 show more info on widgets that fail here 2025-03-10 07:53:37 -05: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 it is a tree, but the variable shouldn't be this 2025-04-30 14:40:23 -05:00
plugin.go hopefully this works 2025-03-12 13:18:22 -05: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 it is a tree, but the variable shouldn't be this 2025-04-30 14:40:23 -05:00
table.go it is a tree, but the variable shouldn't be this 2025-04-30 14:40:23 -05:00
textbox.go string rows 2025-02-19 17:39:45 -06:00
watchdog.go grid.NextRow() plugin counter 2024-02-09 03:45:49 -06:00
window.go try a binary tree create here 2025-05-23 10:31:43 -05: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