summaryrefslogtreecommitdiff
path: root/node.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-13 22:02:12 -0600
committerJeff Carr <[email protected]>2024-01-13 22:02:12 -0600
commit47b15946de10a75cda026a7317a90d4857b453c8 (patch)
treeab6a8c085226263982d3b19f2913e540707af2a1 /node.go
parent4ef8409eeadcd4a359b7593b5ea35f9f523bfb64 (diff)
work on hiding widgetsv0.12.5
When widgets are hidden, their state works exactly the same as normal, but updates are not sent to the toolkits Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'node.go')
-rw-r--r--node.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/node.go b/node.go
index 5ce28a2..1fd8470 100644
--- a/node.go
+++ b/node.go
@@ -7,14 +7,26 @@ import (
/*
generic function to create a new node on the binary tree
+
+ this is called each time you want a new widget
+ and it initializes basic default values
+
+ there isn't much to see here.
*/
func (n *Node) newNode(title string, t widget.WidgetType) *Node {
var newN *Node
newN = addNode()
+ newN.progname = title
newN.value = title
newN.WidgetType = t
+ // set these defaults
+ newN.expand = true
+ newN.pad = true
+ newN.enabled = true
+ newN.changed = true
+
if n.WidgetType == widget.Grid {
n.gridIncrement()
}
@@ -28,7 +40,7 @@ func (n *Node) newNode(title string, t widget.WidgetType) *Node {
}
/*
- raw create function for a new node struct
+ raw create function for a new node struct and increments the counter
*/
func addNode() *Node {
n := new(Node)
@@ -40,10 +52,13 @@ func addNode() *Node {
}
func (n *Node) Parent() *Node {
+ if ! n.Ready() { return n }
return n.parent
}
func (n *Node) Delete(d *Node) {
+ if ! n.Ready() { return }
+
for i, child := range n.children {
log.Log(NODE, "\t", i, child.id, child.progname)
if (child.id == d.id) {