diff options
Diffstat (limited to 'redo/sizing_darwin.go')
| -rw-r--r-- | redo/sizing_darwin.go | 53 |
1 files changed, 3 insertions, 50 deletions
diff --git a/redo/sizing_darwin.go b/redo/sizing_darwin.go index be29666..6eb29b2 100644 --- a/redo/sizing_darwin.go +++ b/redo/sizing_darwin.go @@ -43,53 +43,6 @@ func (c *container) translateAllocationCoords(allocations []*allocation, winwidt } } -func (w *widgetbase) allocate(x int, y int, width int, height int, d *sizing) []*allocation { - return []*allocation{&allocation{ - x: x, - y: y, - width: width, - height: height, - this: w, - }} -} - -func (w *widgetbase) commitResize(c *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(w.id, C.intptr_t(c.x), C.intptr_t(c.y), C.intptr_t(c.width), C.intptr_t(c.height)) -} - -func (w *widgetbase) getAuxResizeInfo(d *sizing) { -// TODO -// d.neighborAlign = C.alignmentInfo(s.id, C.frame(s.id)) -} - /* Cocoa doesn't provide a reliable way to get the preferred size of a control (you're supposed to use Interface Builder and have it set up autoresizing for you). The best we can do is call [control sizeToFit] (which is defined for NSControls and has a custom implementation for the other types here) and read the preferred size. Though this changes the size, we're immediately overriding the change on return from sysData.preferredSize(), so no harm done. (This is similar to what we are doing with GTK+, except GTK+ does not actually change the size.) */ @@ -132,8 +85,8 @@ var prefsizefuncs = [nctypes]func(C.id) (int, int){ } */ -func (w *widgetbase) preferredSize(d *sizing) (width int, height int) { +//func (w *widgetbase) preferredSize(d *sizing) (width int, height int) { //TODO // return prefsizefuncs[s.ctype](s.id) -return 0,0 -} +//return 0,0 +//} |
