Re: NSTableView and clipping
Re: NSTableView and clipping
- Subject: Re: NSTableView and clipping
- From: Tobias Lidskog <email@hidden>
- Date: Tue, 27 Aug 2002 07:46:54 +0200
Well actually that's the code I was working on in the first place... I
found the code and had made a few improvements to it, but then I got
stuck on this. So it's back to square one I guess :-/
/Tobias
On tisdag, aug 27, 2002, at 05:27 Europe/Stockholm, Tony Arnold wrote:
Tobias,
Take a look @ the code I've been working on:
http://homepage.mac.com/tonyarnold/
It borrows heavily from work done by Brad Brack, but draws authentic
iTunes listings quite to my liking :).
-Tony
On Tuesday, Aug 27, 2002, at 11:49 Australia/Sydney, Tobias Lidskog
wrote:
Hi all
I have a NSTableView subclass where I'd like to draw vertical grid
lines, iTunes style. To do this I override -
(void)drawGridInClipRect:(NSRect)r. Normally this works great and my
lines are drawn in the whole view, including below the last row with
contents. Resizing the view and reordering columns is fine too.
However when I resize a column only the part where the actual rows
are gets redrawn. The area below the last row (actually below last
row + 1) isn't touched, and the vertical grid lines are still drawn
at the old position in that area. Resizing the view restores the
grid. I'm guessing that my drawing are clipped somehow, but I've been
unsuccessful in my attempts to change the clipping. Is it possible to
make this work (if so, how?) or do I have to change my strategy? My
current code is shown below, full sample project available upon
request.
/Tobias
p.s. Sorry if this gets posted twice, I sent it from the wrong
account at first d.s.
- (void)drawGridInClipRect:(NSRect)r {
[NSGraphicsContext saveGraphicsState];
// alter clip rect
[NSBezierPath clipRect: [self visibleRect]];
[NSBezierPath setDefaultLineWidth:0.0];
// iterate through columns and draw vertical lines using
[NSBezierPath strokeLineFromPoint:...]
// the lines are normally drawn correctly
...
// restore clip rect
[NSGraphicsContext restoreGraphicsState];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.