summaryrefslogtreecommitdiff
path: root/newctrl/control.go
blob: 1f08ce2cd5e69bf6398d2fd8e54a2ffa1c2f69c1 (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
// 30 july 2014

package ui

// Control represents a control.
type Control interface {
	setParent(p *controlParent) // controlParent defined per-platform
//	nChildren() int		// TODO
	preferredSize(d *sizing) (width, height int)
	resize(x int, y int, width int, height int, d *sizing)
	nTabStops() int
}

type controlbase struct {
	fsetParent			func(p *controlParent)
	fpreferredSize		func(d *sizing) (width, height int)
	fresize			func(x int, y int, width int, height int, d *sizing)
	fnTabStops		func() int
}

func (c *controlbase) setParent(p *controlParent) {
	c.fsetParent(p)
}

func (c *controlbase) preferredSize(d *sizing) (width, height int) {
	return c.fpreferredSize(d)
}

func (c *controlbase) resize(x int, y int, width int, height int, d *sizing) {
	c.fresize(x, y, width, height, d)
}

func (c *controlbase) nTabStops() int {
	return c.fnTabStops()
}