diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-30 23:02:02 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-30 23:02:02 -0400 |
| commit | 77bf566ebbcb62acd4d08d905d9542d6ff9b6b80 (patch) | |
| tree | eeb8e72bc3bf57f5be7f0c0af4319189ac6de838 /control_darwin.go | |
| parent | 155899c65ed32245e2ccad4197a10c77017d835b (diff) | |
...in with the new.
Diffstat (limited to 'control_darwin.go')
| -rw-r--r-- | control_darwin.go | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/control_darwin.go b/control_darwin.go new file mode 100644 index 0000000..b3b3dcf --- /dev/null +++ b/control_darwin.go @@ -0,0 +1,58 @@ +// 30 july 2014 + +package ui + +// #include "objc_darwin.h" +import "C" + +// all Controls that call base methods must be this +type controlPrivate interface { + id() C.id + Control +} + +type controlParent struct { + id C.id +} + +func basesetParent(c controlPrivate, p *controlParent) { + // redrawing the new window handled by C.parent() + C.parent(c.id(), p.id) +} + +func basepreferredSize(c controlPrivate, d *sizing) (int, int) { + s := C.controlPreferredSize(c.id()) + return int(s.width), int(s.height) +} + +func basecommitResize(c controlPrivate, a *allocation, d *sizing) { + dobasecommitResize(c.id(), a, d) +} + +func dobasecommitResize(id C.id, c *allocation, d *sizing) { + C.moveControl(id, C.intptr_t(c.x), C.intptr_t(c.y), C.intptr_t(c.width), C.intptr_t(c.height)) +} + +func basegetAuxResizeInfo(c controlPrivate, d *sizing) { + d.neighborAlign = C.alignmentInfoFrame(c.id()) +} + +type scroller struct { + id C.id +} + +func newScroller(child C.id, bordered bool) *scroller { + id := C.newScrollView(child, toBOOL(bordered)) + s := &scroller{ + id: id, + } + return s +} + +func (s *scroller) setParent(p *controlParent) { + C.parent(s.id, p.id) +} + +func (s *scroller) commitResize(c *allocation, d *sizing) { + dobasecommitResize(s.id, c, d) +} |
