Re: Keeping NSView square

2009-11-19 Thread Kyle Sluder
On Thu, Nov 19, 2009 at 12:22 AM, Andrew Farmer wrote: > To be more specific - I wasn't suggesting adjusting the size of the view at > draw time, or refusing to draw the entire dirty rect, but simply performing > the min(frame width, frame height) calculation at draw time and drawing the > view

Re: Keeping NSView square

2009-11-19 Thread Andrew Farmer
On 19 Nov 2009, at 00:10, Kyle Sluder wrote: > 2009/11/18 Andrew Farmer : >> Don't. Arbitrarily changing the size of your view in setFrame: makes AppKit >> lose track of what size your view was, making it impossible to restore the >> original size later. Cut the view down to square at draw time i

Re: Keeping NSView square

2009-11-19 Thread Kyle Sluder
2009/11/18 Andrew Farmer : > Don't. Arbitrarily changing the size of your view in setFrame: makes AppKit > lose track of what size your view was, making it impossible to restore the > original size later. Cut the view down to square at draw time instead. This sounds like an even worse idea. If

Re: Keeping NSView square

2009-11-18 Thread Andrew Farmer
On 18 Nov 2009, at 04:38, Henri Häkkinen wrote: > I'm making a custom NSView derived class and I need the view to have a fixed > width/height ratio at all times, specifically I would like the view to stay > square. I am trying to override the setFrame: method like this... Don't. Arbitrarily chan

Re: Keeping NSView square

2009-11-18 Thread vinai
width and height of your image), and has been anchored to an image view within the application's main window (myWindow). Hope this helps, or at least points you in the right direction. cheers vinai --- On Wed, 11/18/09, Henri Häkkinen wrote: > From: Henri Häkkinen > Subject: Keepi

Keeping NSView square

2009-11-18 Thread Henri Häkkinen
Hello. I'm making a custom NSView derived class and I need the view to have a fixed width/height ratio at all times, specifically I would like the view to stay square. I am trying to override the setFrame: method like this: - (void)setFrame:(NSRect)frameRect { // Keeps the frame rectang