summaryrefslogtreecommitdiff
path: root/redo/control_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-02 09:47:57 -0400
committerPietro Gagliardi <[email protected]>2014-08-02 09:47:57 -0400
commitc6e47ba21abc5b67f034f3f244c91d415ad571db (patch)
tree9ad2985903efd7a53a46599363b47160e7dab664 /redo/control_darwin.go
parent85fb097ab97603ff2539ec7a3abd6ae8b96a44cb (diff)
Migrated the Label alignment code back into the Mac OS X port.
Diffstat (limited to 'redo/control_darwin.go')
-rw-r--r--redo/control_darwin.go31
1 files changed, 1 insertions, 30 deletions
diff --git a/redo/control_darwin.go b/redo/control_darwin.go
index bb24337..09ebdae 100644
--- a/redo/control_darwin.go
+++ b/redo/control_darwin.go
@@ -34,39 +34,10 @@ func newControl(id C.id) *controlbase {
return int(s.width), int(s.height)
}
c.fcommitResize = func(a *allocation, d *sizing) {
-//TODO
-/*
- if s.ctype == c_label && !s.alternate && c.neighbor != nil {
- c.neighbor.getAuxResizeInfo(d)
- if d.neighborAlign.baseline != 0 { // no adjustment needed if the given control has no baseline
- // in order for the baseline value to be correct, the label MUST BE AT THE HEIGHT THAT OS X WANTS IT TO BE!
- // otherwise, the baseline calculation will be relative to the bottom of the control, and everything will be wrong
- origsize := C.controlPrefSize(s.id)
- c.height = int(origsize.height)
- newrect := C.struct_xrect{
- x: C.intptr_t(c.x),
- y: C.intptr_t(c.y),
- width: C.intptr_t(c.width),
- height: C.intptr_t(c.height),
- }
- ourAlign := C.alignmentInfo(s.id, newrect)
- // we need to find the exact Y positions of the baselines
- // fortunately, this is easy now that (x,y) is the bottom-left corner
- thisbasey := ourAlign.alignmentRect.y + ourAlign.baseline
- neighborbasey := d.neighborAlign.alignmentRect.y + d.neighborAlign.baseline
- // now the amount we have to move the label down by is easy to find
- yoff := neighborbasey - thisbasey
- // and we just add that
- c.y += int(yoff)
- }
- // TODO if there's no baseline, the alignment should be to the top /of the alignment rect/, not the frame
- }
-*/
C.moveControl(c.id, C.intptr_t(a.x), C.intptr_t(a.y), C.intptr_t(a.width), C.intptr_t(a.height))
}
c.fgetAuxResizeInfo = func(d *sizing) {
-// TODO
-// d.neighborAlign = C.alignmentInfo(s.id, C.frame(s.id))
+ d.neighborAlign = C.alignmentInfo(c.id, C.frame(c.id))
}
return c
}