2014-07-30 11:34:54 -05:00
|
|
|
// 30 july 2014
|
|
|
|
|
|
|
|
package ui
|
|
|
|
|
|
|
|
// #include "objc_darwin.h"
|
|
|
|
import "C"
|
|
|
|
|
2014-08-03 19:08:25 -05:00
|
|
|
// all Controls that call base methods must be this
|
|
|
|
type controlPrivate interface {
|
|
|
|
id() C.id
|
|
|
|
Control
|
2014-07-30 11:34:54 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type controlParent struct {
|
2014-10-02 09:05:53 -05:00
|
|
|
id C.id
|
2014-07-30 11:34:54 -05:00
|
|
|
}
|
|
|
|
|
2014-08-03 19:08:25 -05:00
|
|
|
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) {
|
2014-08-09 20:29:37 -05:00
|
|
|
s := C.controlPreferredSize(c.id())
|
2014-08-03 19:08:25 -05:00
|
|
|
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) {
|
2014-08-11 10:36:32 -05:00
|
|
|
d.neighborAlign = C.alignmentInfoFrame(c.id())
|
2014-07-30 11:34:54 -05:00
|
|
|
}
|
|
|
|
|
2014-08-03 19:08:25 -05:00
|
|
|
type scroller struct {
|
2014-10-02 09:05:53 -05:00
|
|
|
id C.id
|
2014-07-30 11:34:54 -05:00
|
|
|
}
|
|
|
|
|
2014-08-10 13:37:34 -05:00
|
|
|
func newScroller(child C.id, bordered bool) *scroller {
|
|
|
|
id := C.newScrollView(child, toBOOL(bordered))
|
2014-08-03 19:08:25 -05:00
|
|
|
s := &scroller{
|
2014-10-02 09:05:53 -05:00
|
|
|
id: id,
|
2014-07-30 11:34:54 -05:00
|
|
|
}
|
|
|
|
return s
|
|
|
|
}
|
2014-08-03 19:08:25 -05:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|