add Destroy()
improve syntax shortcuts go mod update Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7af0ecf8f1
commit
391ed60415
26
common.go
26
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
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
4
go.mod
4
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
|
||||
)
|
||||
|
|
8
go.sum
8
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=
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue