summaryrefslogtreecommitdiff
path: root/redo/container_darwin.go
blob: 1f8a477fab4d3b420b7af2c44867ca6cff584f43 (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
// 4 august 2014

package ui

import (
	"unsafe"
)

// #include "objc_darwin.h"
import "C"

type container struct {
	// TODO rename to id
	view		C.id
	*sizer
}

func newContainer(child Control) *container {
	c := &container{
		sizer:	new(sizer),
	}
	c.view = C.newContainerView(unsafe.Pointer(c))
	c.child = child
	c.child.setParent(&controlParent{c.view})
	return c
}

//export containerResized
func containerResized(data unsafe.Pointer, width C.intptr_t, height C.intptr_t) {
	c := (*container)(unsafe.Pointer(data))
	// the origin of a view's content area is always (0, 0)
	c.resize(0, 0, int(width), int(height))
}