summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'common.go')
-rw-r--r--common.go91
1 files changed, 62 insertions, 29 deletions
diff --git a/common.go b/common.go
index e9a493d..614a749 100644
--- a/common.go
+++ b/common.go
@@ -12,26 +12,34 @@ import (
// functions for handling text related GUI elements
func (n *Node) Show() *Node {
- a := newAction(n, widget.Show)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.Show)
+ sendAction(a)
+ }
return n
}
func (n *Node) Hide() *Node {
- a := newAction(n, widget.Hide)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.Hide)
+ sendAction(a)
+ }
return n
}
func (n *Node) Enable() *Node {
- a := newAction(n, widget.Enable)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.Enable)
+ sendAction(a)
+ }
return n
}
func (n *Node) Disable() *Node {
- a := newAction(n, widget.Disable)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.Disable)
+ sendAction(a)
+ }
return n
}
@@ -40,8 +48,10 @@ func (n *Node) Add(str string) {
n.S = str
- a := newAction(n, widget.Add)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.Add)
+ sendAction(a)
+ }
}
func (n *Node) AddText(str string) {
@@ -50,8 +60,10 @@ func (n *Node) AddText(str string) {
n.Text = str
n.S = str
- a := newAction(n, widget.AddText)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.AddText)
+ sendAction(a)
+ }
}
func (n *Node) SetText(text string) *Node {
@@ -60,8 +72,10 @@ func (n *Node) SetText(text string) *Node {
n.Text = text
n.S = text
- a := newAction(n, widget.SetText)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.SetText)
+ sendAction(a)
+ }
return n
}
@@ -86,8 +100,10 @@ func (n *Node) Set(val any) {
log.Error(errors.New("Set() unknown type"), "v =", v)
}
- a := newAction(n, widget.Set)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.Set)
+ sendAction(a)
+ }
}
func (n *Node) AppendText(str string) {
@@ -95,8 +111,10 @@ func (n *Node) AppendText(str string) {
n.Text = tmp
n.S = tmp
- a := newAction(n, widget.SetText)
- sendAction(a)
+ if ! n.hidden {
+ a := newAction(n, widget.SetText)
+ sendAction(a)
+ }
}
// THESE TWO FUNCTIONS ARE TERRIBLY NAMED AND NEED TO BE FIXED
@@ -169,33 +187,48 @@ func commonCallback(n *Node) {
}
func (n *Node) Margin() *Node {
- a := newAction(n, widget.Margin)
- sendAction(a)
+ n.margin = true
+ if ! n.hidden {
+ a := newAction(n, widget.Margin)
+ sendAction(a)
+ }
return n
}
func (n *Node) Unmargin() *Node {
- a := newAction(n, widget.Unmargin)
- sendAction(a)
+ n.margin = false
+ if ! n.hidden {
+ a := newAction(n, widget.Unmargin)
+ sendAction(a)
+ }
return n
}
func (n *Node) Pad() *Node {
- a := newAction(n, widget.Pad)
- sendAction(a)
+ n.pad = true
+ if ! n.hidden {
+ a := newAction(n, widget.Pad)
+ sendAction(a)
+ }
return n
}
func (n *Node) Unpad() *Node {
- a := newAction(n, widget.Unpad)
- sendAction(a)
+ n.pad = false
+ if ! n.hidden {
+ a := newAction(n, widget.Unpad)
+ sendAction(a)
+ }
return n
}
func (n *Node) Expand() *Node {
- a := newAction(n, widget.Pad)
- a.Expand = true
- sendAction(a)
+ n.expand = true
+ if ! n.hidden {
+ a := newAction(n, widget.Pad)
+ a.Expand = true
+ sendAction(a)
+ }
return n
}