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

import "log"
import "os"

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

// make new Group here
func (t Toolkit) NewGroup(title string) *Toolkit {
	var newt Toolkit

	if (t.uiBox == nil) {
		log.Println("gui.ToolboxNode.NewGroup() node.UiBox == nil. I can't add a range UI element without a place to put it")
		log.Println("probably could just make a box here?")
		os.Exit(0)
		return nil
	}

	if (DebugToolkit) {
		log.Println("gui.Toolbox.NewGroup() create", title)
	}
	g := ui.NewGroup(title)
	g.SetMargined(margin)
	t.uiBox.Append(g, stretchy)

	hbox := ui.NewVerticalBox()
	hbox.SetPadded(padded)
	g.SetChild(hbox)

	newt.uiGroup = g
	newt.uiBox = hbox
	newt.Name = title

	t.Dump()
	newt.Dump()
	// panic("toolkit.NewGroup")
	return &newt
}