From 207cf7ea16f1da8fa9f893504d77a2856298cc22 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 13 Nov 2022 08:53:03 -0600 Subject: Massive refactor to use go plugins. This is neat. update README.md set xterm title. make os.Exit() default on window close add a toolkit.Widget to the node structure remove 'Greeter' symbol mapping scheme removed the testing greeter code plugins: attempt to load plugins in a sensible order andlabs/ui: working andlabs/ui plugin (andlabs2) buttons work in andlabs plugin TODO: re-implement non-plugin version for Windows mswindows doesn't support go plugins yet gocui: put the gocui console so file in the binary does a full init of gocui plugin Button() and Group() working very well with gogui cleanly exit gocui technically you can load two toolkits at the same time kinda both working at the same time. esoteric two working plugins at the same time give up working on two gui's at the same time this is fun, but _not interesting wow. this actually works. NewButton() from both toolkits examples: all the examples run again remove early helloplugin example buttonplugin example cmd code buttonplugin runs and ldd is minimum Signed-off-by: Jeff Carr --- slider.go | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'slider.go') diff --git a/slider.go b/slider.go index a50ee9a..abc1357 100644 --- a/slider.go +++ b/slider.go @@ -2,27 +2,24 @@ package gui import "log" -import toolkit "git.wit.org/wit/gui/toolkit/andlabs" - func (n *Node) NewSlider(name string, x int, y int) *Node { - var newT *toolkit.Toolkit - var sNode *Node - - log.Println("toolkit.NewSlider() START", name) + newNode := n.New(name) + newNode.Widget.Name = name + newNode.Widget.X = x + newNode.Widget.Y = y - n.verify() + newNode.Widget.Custom = func() { + log.Println("even newer clicker() name in NewSlider", newNode.Widget) + } - // make a *Node with a *toolkit.Group - sNode = n.New(name + " part1") - newT = n.toolkit.NewSlider(name, x, y) - newT.Name = name - sNode.custom = n.custom - newT.Custom = func () { - commonCallback(sNode) + for _, aplug := range allPlugins { + log.Println("gui.NewSlider() aplug =", aplug.name, "name =", newNode.Widget.Name) + if (aplug.NewSlider == nil) { + log.Println("\tgui.NewSlider() aplug.NewSlider = nil", aplug.name) + continue + } + aplug.NewSlider(&n.Widget, &newNode.Widget) } - sNode.toolkit = newT - sNode.Dump() - // panic("checking Custom()") - return sNode + return newNode } -- cgit v1.2.3