diff options
| author | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2023-03-01 11:35:36 -0600 |
| commit | 8dbf5a09097b7868e9218bf98716c57eac998a10 (patch) | |
| tree | ab3bdfeaf5a59a55de9d2a6661d2d824090491e5 /node.go | |
| parent | f3bb68396afa7452ecf1c8d4744c825a9d81057c (diff) | |
lots cleaner code between the pluginv0.6.1
Queue() around SetText is helping userspace crashing
merge forceDump(bool) into Dump()
debugging output configuration is pretty clean
keep cutting down duplicate things
--gui-verbose flag works
make label "standard" code
add debug.FreeOSMemory()
move the GO language internals to display in the GUI
update push to do tags and go to github.com/wit-go/
remove the other license file
it might be confusing golang.org and github
proper WidgetType
added a Quit() button
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'node.go')
| -rw-r--r-- | node.go | 37 |
1 files changed, 21 insertions, 16 deletions
@@ -1,15 +1,30 @@ package gui -// import "git.wit.org/wit/gui/toolkit" +import "git.wit.org/wit/gui/toolkit" /* generic function to create a new node on the binary tree */ -func (n *Node) New(title string, t string) *Node { +func (n *Node) New(title string, t toolkit.WidgetType, custom func()) *Node { var newN *Node - newN = addNode(title, n.Width, n.Height) - newN.Widget.Type = t + newN = addNode(title) + newN.widget.Type = t + newN.widget.Action = "New" + newN.Custom = custom + + // TODO: This should not be defined for each widget. This has to be stupid + // or wait a second, is this where I send something to a channel? + newN.widget.Custom = func() { + if (newN.Custom == nil) { + log(debugChange, "newT.Custom() == nil. Not doing anything. SEND SOMETHING TO THE CHANNEL") + return + } + log(debugChange, "newT.Custom() START SEND SOMETHING TO THE CHANNEL widget.Name =", newN.widget.Name) + // send something to the channel here???? + newN.Custom() + log(debugChange, "newT.Custom() END SEND SOMETHING TO THE CHANNEL widget.Name =", newN.widget.Name) + } n.Append(newN) newN.parent = n @@ -19,20 +34,10 @@ func (n *Node) New(title string, t string) *Node { /* raw create function for a new node struct */ -func addNode(title string, width int, height int) *Node { +func addNode(title string) *Node { n := new(Node) - n.Name = title - n.Width = width - n.Height = height - - n.Widget.Name = title - n.Widget.Width = width - n.Widget.Height = height - - // no longer a string - // id := Config.prefix + strconv.Itoa(Config.counter) - // n.id = id + n.widget.Name = title n.id = Config.counter Config.counter += 1 |
