summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--action.go3
-rw-r--r--box.go10
-rw-r--r--common.go11
-rw-r--r--group.go2
-rw-r--r--node.go4
5 files changed, 29 insertions, 1 deletions
diff --git a/action.go b/action.go
index d2deb94..6db01eb 100644
--- a/action.go
+++ b/action.go
@@ -56,12 +56,13 @@ func sendAction(n *Node, atype widget.ActionType) {
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)
}
log.Warn("SENDING ACTION STRINGS a.Strings", a.Strings)
+ log.Warn("SENDING ACTION a.State.Value", a.State.Value)
a.State.Range.Low = n.X
a.State.Range.High = n.Y
diff --git a/box.go b/box.go
index 87276e8..39b64b0 100644
--- a/box.go
+++ b/box.go
@@ -19,6 +19,16 @@ func (parent *Node) NewBox(progname string, b bool) *Node {
return newNode
}
+func (n *Node) Vertical() *Node {
+ n.direction = widget.Horizontal
+ return n
+}
+
+func (n *Node) Horizontal() *Node {
+ n.direction = widget.Horizontal
+ return n
+}
+
func (parent *Node) NewHorizontalBox(progname string) *Node {
newNode := parent.newNode(progname, widget.Box)
newNode.progname = progname
diff --git a/common.go b/common.go
index a544f51..a46ecb5 100644
--- a/common.go
+++ b/common.go
@@ -119,6 +119,17 @@ func (n *Node) String() string {
if !n.Ready() {
return ""
}
+ switch n.WidgetType {
+ case widget.Window:
+ return n.label
+ case widget.Button:
+ return n.label
+ case widget.Group:
+ return n.label
+ case widget.Label:
+ return n.label
+ default:
+ }
return widget.GetString(n.value)
}
diff --git a/group.go b/group.go
index fd47dc1..1a113f1 100644
--- a/group.go
+++ b/group.go
@@ -13,6 +13,8 @@ func (parent *Node) NewGroup(name string) *Node {
newNode.progname = name
newNode.label = name
+ newNode.direction = widget.Vertical
+
// inform the toolkits
sendAction(newNode, widget.Add)
return newNode
diff --git a/node.go b/node.go
index 59eb967..a66ac93 100644
--- a/node.go
+++ b/node.go
@@ -14,6 +14,10 @@ and it initializes basic default values
there isn't much to see here.
*/
func (n *Node) newNode(title string, t widget.WidgetType) *Node {
+ if n == nil {
+ log.Warn("newNode got parent == nil")
+ log.Exit(0)
+ }
var newN *Node
newN = addNode()