summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-15 16:14:48 -0600
committerJeff Carr <[email protected]>2024-01-15 16:14:48 -0600
commitaa491036c319beb8326fc422a0efdadf7337cda5 (patch)
tree6e1294823a8a2ec3a79caa55f05a16bcb9bad1f4
parent785b6db6e7fc312a18da4352673027c2b91d3789 (diff)
add Destroy()v0.12.9
improve syntax shortcuts go mod update Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--common.go26
-rw-r--r--go.mod4
-rw-r--r--go.sum8
-rw-r--r--plugin.go1
-rw-r--r--separator.go14
5 files changed, 42 insertions, 11 deletions
diff --git a/common.go b/common.go
index 7430f98..c6397fa 100644
--- a/common.go
+++ b/common.go
@@ -33,13 +33,19 @@ func (n *Node) Hide() *Node {
if ! n.Ready() { return n }
if n.Hidden() { return n }
+
if n.WidgetType == widget.Window {
log.Warn("Hide on a window", n.progname)
log.Warn("this needs to do TestDestroy() ?")
+ n.Destroy()
+ n.hidden = true
+ n.changed = true
+ return nil
}
n.hidden = true
n.changed = true
+
// inform the toolkits
sendAction(n, widget.Hide)
return n
@@ -73,6 +79,18 @@ func (n *Node) Disable() *Node {
return n
}
+func (n *Node) Destroy() {
+ if ! n.Ready() { return }
+ // if ! n.enabled { return }
+
+ n.enabled = false
+ n.changed = true
+
+ // inform the toolkits
+ sendAction(n, widget.Delete)
+ return
+}
+
// add a new text string to widgets that support
// multiple string values
@@ -128,17 +146,17 @@ func (n *Node) GetBool() bool {
}
// should get the reference name used for programming and debugging
-func (n *Node) SetProgName(s string) {
- if ! n.Ready() { return }
+func (n *Node) SetProgName(s string) *Node {
+ if ! n.Ready() { return n }
if n.progname == s {
// don't do anything since nothing changed
- return
+ return n
}
n.changed = true
n.progname = s
- return
+ return n
}
/*
diff --git a/go.mod b/go.mod
index af0bf43..e41e5dc 100644
--- a/go.mod
+++ b/go.mod
@@ -5,10 +5,10 @@ go 1.21.4
require (
go.wit.com/dev/alexflint/arg v1.4.5
go.wit.com/gui/widget v1.1.3
- go.wit.com/log v0.5.3
+ go.wit.com/log v0.5.4
)
require (
go.wit.com/dev/alexflint/scalar v1.2.1 // indirect
- go.wit.com/dev/davecgh/spew v1.1.3 // indirect
+ go.wit.com/dev/davecgh/spew v1.1.4 // indirect
)
diff --git a/go.sum b/go.sum
index 0e09894..99987ba 100644
--- a/go.sum
+++ b/go.sum
@@ -2,9 +2,9 @@ go.wit.com/dev/alexflint/arg v1.4.5 h1:asDx5f9IlfpknKjPBqqb2qndE91Pbo7ZDkWUgddfM
go.wit.com/dev/alexflint/arg v1.4.5/go.mod h1:wnWc+c6z8kSdDKYriMf6RpM+FiXmo5RYp/t4FNi0MU0=
go.wit.com/dev/alexflint/scalar v1.2.1 h1:loXOcbVnd+8YeJRLey+XXidecBiedMDO00zQ26TvKNs=
go.wit.com/dev/alexflint/scalar v1.2.1/go.mod h1:+rYsfxqdI2cwA8kJ7GCMwWbNJvfvWUurOCXLiwdTtSs=
-go.wit.com/dev/davecgh/spew v1.1.3 h1:hqnB5qsPgC2cLZaJXqQJspQ5n/Ugry9kyL3tLk0hVzQ=
-go.wit.com/dev/davecgh/spew v1.1.3/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
+go.wit.com/dev/davecgh/spew v1.1.4 h1:C9hj/rjlUpdK+E6aroyLjCbS5MFcyNUOuP1ICLWdNek=
+go.wit.com/dev/davecgh/spew v1.1.4/go.mod h1:sihvWmnQ/09FWplnEmozt90CCVqBtGuPXM811tgfhFA=
go.wit.com/gui/widget v1.1.3 h1:GvLzGSOF9tfmoh6HNbFdN+NSlBo2qeS/Ba2TnQQ1A1U=
go.wit.com/gui/widget v1.1.3/go.mod h1:A6/FaiFQtAHTjgo7c4FrokXe6bXX1Cowo35b2Lgi31E=
-go.wit.com/log v0.5.3 h1:/zHkniOPusPEuX1R401rMny9uwSO/nSU/QOMx6qoEnE=
-go.wit.com/log v0.5.3/go.mod h1:LzIzVxc2xJQxWQBtV9VbV605P4TOxmYDCl+BZF38yGE=
+go.wit.com/log v0.5.4 h1:vijLRPTUgChb8J5tx/7Uma/lGTUxeSXosFbheAmL914=
+go.wit.com/log v0.5.4/go.mod h1:BaJBfHFqcJSJLXGQ9RHi3XVhPgsStxSMZRlaRxW4kAo=
diff --git a/plugin.go b/plugin.go
index ff4d512..50a1aca 100644
--- a/plugin.go
+++ b/plugin.go
@@ -201,7 +201,6 @@ func initToolkit(name string, filename string) *aplug {
// add it to the list of plugins
allPlugins = append(allPlugins, newPlug)
-
// set the communication to the plugins
newPlug.pluginChan = newPlug.PluginChannel()
if (newPlug.pluginChan == nil) {
diff --git a/separator.go b/separator.go
new file mode 100644
index 0000000..2765b24
--- /dev/null
+++ b/separator.go
@@ -0,0 +1,14 @@
+package gui
+
+import (
+ "go.wit.com/gui/widget"
+)
+
+func (parent *Node) NewSeparator(progname string) *Node {
+ newNode := parent.newNode(progname, widget.Separator)
+ newNode.progname = progname
+
+ // inform the toolkits
+ sendAction(newNode, widget.Add)
+ return newNode
+}