summaryrefslogtreecommitdiff
path: root/box.go
blob: 4a16469665b7db325c085e368a828b3258e3a1c7 (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
package gui

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

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

	if ! newNode.hidden {
		a := newAction(newNode, widget.Add)
		if b {
			a.Direction = widget.Horizontal
		} else {
			a.Direction = widget.Vertical
		}
		sendAction(a)
	}
	return newNode
}

func (parent *Node) NewHorizontalBox(name string) *Node {
	newNode := parent.newNode(name, widget.Box)

	if ! newNode.hidden {
		a := newAction(newNode, widget.Add)
		a.Direction = widget.Horizontal
		sendAction(a)
	}
	return newNode
}

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

	if ! newNode.hidden {
		a := newAction(newNode, widget.Add)
		a.Direction = widget.Vertical
		sendAction(a)
	}
	return newNode
}