summaryrefslogtreecommitdiff
path: root/box.go
blob: e16d3e47247735966287f305b83eb9e641b08624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package gui

import (
	"go.wit.com/widget"
)

func (parent *Node) NewBox(progname string, b bool) *Node {
	newNode := parent.newNode(progname, widget.Box)
	newNode.progname = progname

	if b {
		newNode.direction = widget.Horizontal
	} else {
		newNode.direction = widget.Vertical
	}

	// inform the toolkits
	sendAction(newNode, widget.Add)
	return newNode
}

func (parent *Node) Box() *Node {
	newNode := parent.newNode("BOX", widget.Box)

	// inform the toolkits
	sendAction(newNode, widget.Add)
	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

	newNode.direction = widget.Horizontal

	// inform the toolkits
	sendAction(newNode, widget.Add)
	return newNode
}

func (parent *Node) NewVerticalBox(progname string) *Node {
	newNode := parent.newNode(progname, widget.Box)
	newNode.progname = progname

	newNode.direction = widget.Vertical

	// inform the toolkits
	sendAction(newNode, widget.Add)
	return newNode
}