diff options
| author | Jeff Carr <[email protected]> | 2023-03-29 22:44:08 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-29 22:44:08 -0500 |
| commit | 947169df5a22c9f9b53f825764747f648c70ff1e (patch) | |
| tree | 3c84fffc14352329bc41e6b58910ff278c99f08c /redraw.go | |
| parent | 6013fde8332e8ecbffaf1a0977ba2e1da8ea8775 (diff) | |
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]>
Diffstat (limited to 'redraw.go')
| -rw-r--r-- | redraw.go | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/redraw.go b/redraw.go new file mode 100644 index 0000000..38c3972 --- /dev/null +++ b/redraw.go @@ -0,0 +1,59 @@ +package gui + +import ( + "git.wit.org/wit/gui/toolkit" +) + +// This recreates the whole GUI for a plugin + +func Redraw(s string) { + var p *aplug + log(logNow, "attempt to feed the binary tree to", s) + for _, aplug := range allPlugins { + log("Loaded plugin:", aplug.name, aplug.filename) + if (aplug.name == s) { + log("Found plugin:", aplug.name, aplug.filename) + p = aplug + } + } + if (p == nil) { + log("Plugin", s, "is not loaded") + return + } + Config.rootNode.Redraw(p) +} + +// func (n *Node) ListChildren(dump bool, dropdown *Node, mapNodes map[string]*Node) { +func (n *Node) Redraw(p *aplug) { + if (n == nil) { + return + } + + n.redo(p) + for _, child := range n.children { + child.Redraw(p) + } + return +} + +func (n *Node) redo(p *aplug) { + log(logNow, "redo() on n.Widget") + + var a *toolkit.Action + a = new(toolkit.Action) + a.Name = n.Name + a.Text = n.Text + a.ActionType = toolkit.Add + a.WidgetType = n.WidgetType + a.WidgetId = n.id + a.Width = n.Width + a.Height = n.Height + + if (n.parent == nil) { + a.ParentId = 0 + } else { + a.ParentId = n.parent.id + } + + p.Action(a) +} |
