summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/box.go
blob: 548c90acf87456a12fc654bf3d2d8ad31689ba24 (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
package toolkit

import "log"

import "github.com/andlabs/ui"
import _ "github.com/andlabs/ui/winmanifest"

// create a new box
func (t *Toolkit) GetBox() *ui.Box {
	return t.uiBox
}

// create a new box
func (t *Toolkit) NewBox() *Toolkit {
	log.Println("gui.Toolbox.NewBox() START create default")
	t.Dump()
	if (t.uiGroup != nil) {
		log.Println("gui.Toolbox.NewBox() is a Group")
		var newTK Toolkit

		vbox := ui.NewVerticalBox()
		vbox.SetPadded(true)
		t.uiGroup.SetChild(vbox)
		newTK.uiBox = vbox

		return &newTK
	}
	if (t.uiBox != nil) {
		log.Println("gui.Toolbox.NewBox() is a Box")
		// return t
	}
	log.Println("gui.Toolbox.NewBox() FAILED. Couldn't figure out where to make a box")
	t.Dump()
	return nil
}

// Make a new box
func MakeBox(name string) *Toolkit {
	var newt Toolkit

	vbox := ui.NewVerticalBox()
	vbox.SetPadded(border)
	newt.uiBox = vbox
	newt.Name = name

	log.Println("gui.Toolbox.MakeBox() name =", name)
	newt.Dump()
	return &newt
}