summaryrefslogtreecommitdiff
path: root/toolkit/gocui/logical.go
blob: c3964fbe0826af06779fcbd5417e734670a44aed (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
package main

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

var adjusted bool = false

/*
// expands the logical size of the parents
func (w *cuiWidget) setParentLogical() {
	p := w.parent
	if (w.isFake) {
		// expand the parent logicalsize to include the widget logicalsize
		if (p.logicalSize.w0 > w.logicalSize.w0) {
			p.logicalSize.w0 = w.logicalSize.w0
			adjusted = true
		}
		if (p.logicalSize.h0 > w.logicalSize.h0) {
			p.logicalSize.h0 = w.logicalSize.h0
			adjusted = true
		}
		if (p.logicalSize.w1 < w.logicalSize.w1) {
			p.logicalSize.w1 = w.logicalSize.w1
			adjusted = true
		}
		if (p.logicalSize.h1 < w.logicalSize.h1) {
			p.logicalSize.h1 = w.logicalSize.h1
			adjusted = true
		}
	} else {
		// expand the parent logicalsize to include the widget realSize
		if (p.logicalSize.w0 > w.realSize.w0) {
			p.logicalSize.w0 = w.realSize.w0
			adjusted = true
		}
		if (p.logicalSize.h0 > w.realSize.h0) {
			p.logicalSize.h0 = w.realSize.h0
			adjusted = true
		}
		if (p.logicalSize.w1 < w.realSize.w1) {
			p.logicalSize.w1 = w.realSize.w1
			adjusted = true
		}
		if (p.logicalSize.h1 < w.realSize.h1) {
			p.logicalSize.h1 = w.realSize.h1
			adjusted = true
		}
	}
	if (! w.isFake) {
		// adjust the widget realSize to the top left corner of the logicalsize
		if (w.logicalSize.w0 > w.realSize.w0) {
			w.realSize.w0 = w.logicalSize.w0
			w.realSize.w1 = w.realSize.w0 + w.realWidth
			adjusted = true
		}
		if (w.logicalSize.h0 > w.realSize.h0) {
			w.realSize.h0 = w.logicalSize.h0
			w.realSize.h1 = w.realSize.h0 + w.realHeight
			adjusted = true
		}
	}
	w.showWidgetPlacement(logNow, "setParentLogical() widget")
	p.showWidgetPlacement(logNow, "setParentLogical() parent")
	if (w.id == 0) || (p.id == 0) {
		// stop resizing when you hit the root widget
		return
	}
	// pass the logical resizing up
	pP := w.parent
	if (pP != nil) {
		pP.setParentLogical()
	}
}
*/