summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-19 05:54:55 -0600
committerJeff Carr <[email protected]>2024-01-19 05:54:55 -0600
commitf7bb1084ca117315fc293d077a8e4e24ccfe7cd8 (patch)
treef69a69fc5d63b0f5de7535fc79794c0e4341c953
parentc682272f56094fc816c6b7fbee84351f5608c259 (diff)
builds and remembers Visable
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--action.go10
-rw-r--r--common.go2
-rw-r--r--node.go3
-rw-r--r--structs.go7
-rw-r--r--window.go1
5 files changed, 21 insertions, 2 deletions
diff --git a/action.go b/action.go
index 2a1f857..d2deb94 100644
--- a/action.go
+++ b/action.go
@@ -27,7 +27,7 @@ func sendAction(n *Node, atype widget.ActionType) {
}
n.mu.Lock()
defer n.mu.Unlock()
- log.Warn("SENDING ACTION STRINGS n.Strings", n.strings)
+ log.Warn("SENDING ACTION STRINGS n.Strings", n.strings, n.id, n.WidgetType, n.GetProgName())
// if the widget is hidden, don't send actions to the plugin
if n.hidden {
@@ -50,7 +50,13 @@ func sendAction(n *Node, atype widget.ActionType) {
a.State.ProgName = n.progname
a.State.Label = n.label
a.State.Value = n.value
+
a.State.Checked = n.checked
+ a.State.Visable = n.visable
+ a.State.Pad = n.pad
+ a.State.Expand = n.expand
+ a.State.Borderless = n.borderless
+
a.State.Direction = n.direction
for s, _ := range n.strings {
a.State.Strings = append(a.State.Strings, s)
@@ -80,7 +86,7 @@ func sendAction(n *Node, atype widget.ActionType) {
// sends the action/event to each toolkit via a golang plugin channel
func sendActionToPlugin(a *widget.Action) {
for _, aplug := range allPlugins {
- log.Log(PLUG, "Action() aplug =", aplug.name, "Action type=", a.ActionType)
+ log.Warn("send to toolkit =", aplug.name, "Action type=", a.ActionType, a.WidgetId)
if aplug.pluginChan == nil {
log.Warn("Action() retrieving the aplug.PluginChannel()", aplug.name)
aplug.pluginChan = aplug.PluginChannel()
diff --git a/common.go b/common.go
index d24b7fb..a544f51 100644
--- a/common.go
+++ b/common.go
@@ -17,6 +17,7 @@ func (n *Node) Show() *Node {
return n
}
+ n.visable = true
n.hidden = false
n.changed = true
@@ -51,6 +52,7 @@ func (n *Node) Hide() *Node {
return nil
}
+ n.visable = false
n.hidden = true
n.changed = true
diff --git a/node.go b/node.go
index 1df9dd3..0386938 100644
--- a/node.go
+++ b/node.go
@@ -25,7 +25,10 @@ func (n *Node) newNode(title string, t widget.WidgetType) *Node {
// set these defaults
newN.expand = true
+ newN.visable = true
newN.pad = true
+ newN.borderless = false
+
newN.enabled = true
newN.changed = true
diff --git a/structs.go b/structs.go
index 0fef186..986aa5e 100644
--- a/structs.go
+++ b/structs.go
@@ -114,6 +114,13 @@ type Node struct {
// for widgets that have on/off things
checked bool
+ // tells the toolkits if the user should currently see it
+ // state updates are only sent to the toolkits for visable widgets
+ visable bool
+
+ // borderless windows
+ borderless bool
+
// this function is run when there are mouse or keyboard events
Custom func()
diff --git a/window.go b/window.go
index 3b9e535..705b346 100644
--- a/window.go
+++ b/window.go
@@ -18,6 +18,7 @@ func (parent *Node) NewWindow(title string) *Node {
newNode.progname = title
newNode.label = title
newNode.value = title
+ newNode.margin = true
// inform the toolkits
sendAction(newNode, widget.Add)