summaryrefslogtreecommitdiff
path: root/add.go
blob: 151d4d22203ff85d3c4daa095ef9c946f083bfbb (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package main

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

var fakeStartWidth int = me.FakeW
var fakeStartHeight int = me.TabH + me.FramePadH

// setup fake labels for non-visible things off screen
func (n *node) setFake() {
	w := n.tk
	w.isFake = true

	n.gocuiSetWH(fakeStartWidth, fakeStartHeight)

	fakeStartHeight += w.gocuiSize.Height()
	// TODO: use the actual max hight of the terminal window
	if fakeStartHeight > 24 {
		fakeStartHeight = me.TabH
		fakeStartWidth += me.FakeW
	}
	if true {
		n.showView()
	}
}

// set the widget start width & height
func (n *node) addWidget() {
	nw := n.tk
	log.Log(INFO, "setStartWH() w.id =", n.WidgetId, "n.name", n.progname)
	switch n.WidgetType {
	case widget.Root:
		log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.progname)
		nw.color = &colorRoot
		n.setFake()
		return
	case widget.Flag:
		nw.color = &colorFlag
		n.setFake()
		return
	case widget.Window:
		nw.frame = false
		nw.color = &colorWindow
		// redoWindows(0,0)
		return
	case widget.Tab:
		nw.color = &colorTab
		// redoWindows(0,0)
		return
	case widget.Button:
		nw.color = &colorButton
	case widget.Box:
		nw.color = &colorBox
		nw.isFake = true
		n.setFake()
		return
	case widget.Grid:
		nw.color = &colorGrid
		nw.isFake = true
		n.setFake()
		return
	case widget.Group:
		nw.color = &colorGroup
		nw.frame = false
		return
	case widget.Label:
		nw.color = &colorLabel
		nw.frame = false
		return
	default:
		/*
			if n.IsCurrent() {
				n.updateCurrent()
			}
		*/
	}
	n.showWidgetPlacement(true, "addWidget()")
}