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

import (
	"git.wit.org/wit/gui/toolkit"

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

// make new Box here
func newBox(a *toolkit.Action) {
	w := a.Widget
	parentW := a.Where
	log(debugToolkit, "newBox()", w.Name)

	t := mapToolkits[parentW]
	if (t == nil) {
		log(debugToolkit, "newBox() toolkit struct == nil. name=", parentW.Name, w.Name)
		listMap(debugToolkit)
	}
	newt := t.rawBox(w.Name, a.B)
	newt.boxC = 0
	place(a, t, newt)
	mapWidgetsToolkits(a, newt)
}

// make new Box using andlabs/ui
func (t *andlabsT) rawBox(title string, b bool) *andlabsT {
	var newt andlabsT
	var box *ui.Box
	newt.Name = title

	log(debugToolkit, "rawBox() create", newt.Name)

	if (b) {
		box = ui.NewHorizontalBox()
	} else {
		box = ui.NewVerticalBox()
	}
	box.SetPadded(padded)

	newt.uiBox = box
	newt.uiControl = box

	return &newt
}