summaryrefslogtreecommitdiff
path: root/toolkit/democui/plugin.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-29 23:03:04 -0500
committerJeff Carr <[email protected]>2023-03-29 23:03:04 -0500
commit4e28cde838683188bfbd9222746409538828592d (patch)
tree3c84fffc14352329bc41e6b58910ff278c99f08c /toolkit/democui/plugin.go
parentd4787a1ebdd08359746516dbb72f1feaf95be5b6 (diff)
add semi-working gocuiv0.7.4
commit 947169df5a22c9f9b53f825764747f648c70ff1e Author: Jeff Carr <[email protected]> Date: Wed Mar 29 22:44:08 2023 -0500 ready for version v0.7.4 start deprecating toolkit.Widget switch to variable name 'ParentId' use 'ActionType' and 'WidgetType' preliminary redraw() final definition of variables 'Name' and 'Text' more cleaning of the code remove lots of dumb code bind 'd' key press to dump out debugging info early color handling in gocui! Signed-off-by: Jeff Carr <[email protected]> commit 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 Author: Jeff Carr <[email protected]> Date: Sun Mar 26 17:19:20 2023 -0500 improvements towards a working dns control panel democui has the help menu try to add mouse support to gocui make a direct access method Margin() and Pad() tests add SPEW also push devel branch to github Signed-off-by: Jeff Carr <[email protected]> commit 6f91f5e080e06cdc0f34b13d23e5fd16ea37259a Author: Jeff Carr <[email protected]> Date: Fri Mar 24 20:14:18 2023 -0500 starting to try safe chan and goroutines fix tab title's right before attempting to add chan goroutines removed "where" widget pointer box added to tab experiement with log as it's own repo Signed-off-by: Jeff Carr <[email protected]> Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/democui/plugin.go')
-rw-r--r--toolkit/democui/plugin.go109
1 files changed, 6 insertions, 103 deletions
diff --git a/toolkit/democui/plugin.go b/toolkit/democui/plugin.go
index 2c0d42e..86125d4 100644
--- a/toolkit/democui/plugin.go
+++ b/toolkit/democui/plugin.go
@@ -4,112 +4,15 @@ import (
// if you include more than just this import
// then your plugin might be doing something un-ideal (just a guess from 2023/02/27)
"git.wit.org/wit/gui/toolkit"
-
- "github.com/awesome-gocui/gocui"
)
-// This is a map between the widgets in wit/gui and the internal structures of gocui
-var viewWidget map[*gocui.View]*toolkit.Widget
-var stringWidget map[string]*toolkit.Widget
-
func Quit() {
- g.Close()
-}
-
-// This lists out the know mappings
-func listMap() {
- for v, w := range viewWidget {
- log("view =", v.Name, "widget name =", w.Name)
- }
- for s, w := range stringWidget {
- log("string =", s, "widget =", w)
- }
+ me.baseGui.Close()
}
-
-//
-// This should be called ?
-// Pass() ?
-// This handles all interaction between the wit/gui package (what golang knows about)
-// and this plugin that talks to the OS and does scary and crazy things to make
-// a GUI on whatever OS or whatever GUI toolkit you might have (GTK, QT, WASM, libcurses)
-//
-// Once you are here, you should be in a protected goroutine created by the golang wit/gui package
-//
-// TODO: make sure you can't escape this goroutine
-//
-func Send(p *toolkit.Widget, c *toolkit.Widget) {
- if (p == nil) {
- log(debugPlugin, "Send() parent = nil")
- } else {
- log(debugPlugin, "Send() parent =", p.Name, ",", p.Type)
- }
- log(debugPlugin, "Send() child =", c.Name, ",", c.Type)
-
- /*
- if (c.Action == "SetMargin") {
- log(debugError, "need to implement SetMargin here")
- setMargin(c, c.B)
- return
- }
- */
-
- switch c.Type {
- /*
- case toolkit.Window:
- // doWindow(c)
- case toolkit.Tab:
- // doTab(p, c)
- case toolkit.Group:
- newGroup(p, c)
- case toolkit.Button:
- newButton(p, c)
- case toolkit.Checkbox:
- // doCheckbox(p, c)
- case toolkit.Label:
- // doLabel(p, c)
- case toolkit.Textbox:
- // doTextbox(p, c)
- case toolkit.Slider:
- // doSlider(p, c)
- case toolkit.Spinner:
- // doSpinner(p, c)
- case toolkit.Dropdown:
- // doDropdown(p, c)
- case toolkit.Combobox:
- // doCombobox(p, c)
- case toolkit.Grid:
- // doGrid(p, c)
- */
- /*
- case toolkit.Flag:
- // log(debugFlags, "plugin Send() flag parent =", p.Name, p.Type)
- // log(debugFlags, "plugin Send() flag child =", c.Name, c.Type)
- // log(debugFlags, "plugin Send() flag child.Action =", c.Action)
- // log(debugFlags, "plugin Send() flag child.S =", c.S)
- // log(debugFlags, "plugin Send() flag child.B =", c.B)
- // log(debugFlags, "plugin Send() what to flag?")
- // should set the checkbox to this value
- switch c.S {
- case "Toolkit":
- debugToolkit = c.B
- case "Change":
- debugChange = c.B
- case "Plugin":
- debugPlugin = c.B
- case "Flags":
- debugFlags = c.B
- case "Error":
- debugError = c.B
- case "Show":
- ShowDebug()
- default:
- log(debugError, "Can't set unknown flag", c.S)
- }
- */
- default:
- log(debugError, "plugin Send() unknown parent =", p.Name, p.Type)
- log(debugError, "plugin Send() unknown child =", c.Name, c.Type)
- log(debugError, "plugin Send() Don't know how to do", c.Type, "yet")
- }
+func Action(a *toolkit.Action) {
+ log(logNow, "Action()", a)
+ w := setupWidgetT(a)
+ place(w, a)
+ log(logInfo, "Action() END")
}