summaryrefslogtreecommitdiff
path: root/controlsize_sys.go
blob: 153ed697926cb0e7bb46d2fbadb935be403bbec6 (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
81
82
83
84
// +build SKIP

// 25 june 2014

package ui

type sysSizeData struct {
	// for size calculations
	// all platforms
	margin	int	// windows: calculated
	spacing	int	// gtk+, cocoa: constants
	// windows
	baseX	int
	baseY	int
	// gtk, mac os x: nothing

	// for the actual resizing
	// windows
	// possibly also the HDWP
	// gtk
	shouldVAlignTop	bool
	// mac os x
	// neighbor control alignment rect/baseline info
}

func (s *sysData) beginResize() *sysSizeData {
	// windows: get baseX/baseY for window and compute margin and spacing
	// gtk, mac: return zero
}

func (s *sysData) endResize(d *sysSizeData) {
	// redraw
}

func (s *sysData) translateAllocationCoords(allocations []*allocation, winwidth, winheight int) {
	// windows, gtk: nothing
	// mac
	for _, a := range allocations {
		// winheight - y because (0,0) is the bottom-left corner of the window and not the top-left corner
		// (winheight - y) - height because (x, y) is the bottom-left corner of the control and not the top-left
		a.y = (winheight - a.y) - a.height
	}
}

// windows
func (s *sysData) doResize(c *allocation, d *sysSizeData) {
	if s.ctype == c_label {
		// add additional offset of 4 dialog units
	}
	// resize
}
func (s *sysData) getAuxResizeInfo(d *sysSizeData) {
	// do nothing
}

// gtk+
func (s *sysData) doResize(c *allocation, d *sysSizeData) {
	if s.ctype == c_label && !s.alternate && c.neighbor != nil {
		c.neighbor.getAuxResizeInfo(d)
		if d.shouldVAlignTop {
			// TODO should it be center-aligned to the first line or not
			gtk_misc_set_align(s.widget, 0, 0)
		} else {
			gtk_misc_set_align(s.widget, 0, 0.5)
		}
	}
	// resize
}
func (s *sysData) getAuxResizeInfo(d *sysSizeData) {
	d.shouldVAlignTop = (s.ctype == c_listbox) || (s.ctype == c_area)
}

// cocoa
func (s *sysData) doResize(c *allocation, d *sysSizeData) {
	if s.ctype == c_label && !s.alternate && c.neighbor != nil {
		c.neighbor.getAuxResizeInfo(d)
		// get this control's alignment rect and baseline
		// align
	}
	// resize
}
func (s *sysData) getAuxResizeInfo(d *sysSizeData) {
	// get this control's alignment rect and baseline
}