Skip navigation.
 
ml[Wrap-up] Re: Equivelent to drawRect: for drawing after sub views are drawn
FROM : George Lawrence Storm
DATE : Thu Oct 07 20:15:30 2004

Wrap-up to my earlier post(s)

>> I need to perform the equivalent to NSView's drawRect:, however I
>> need it to be called AFTER its sub views are drawn.
>>
>> Is there a method I can override for such a purpose?
>>
>> I need to draw a transparent overlay & some guidelines which will
>> overlap some of those sub views.


I decided to live dangerously and overrode the following undocumented
method in my NSView:

- (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)fp8
visRect:(struct _NSRect)fp12
{
   [super _recursiveDisplayAllDirtyWithLockFocus:fp8 visRect:fp12];
   [self lockFocus];
   [self drawPostRect];
   [self unlockFocus];
}

my drawPostRect: being where I draw my overlays

> region to that of only the visible rect. This creates a problem when
> the view is in a scroller, in that my drawPostRect: is being clipped
> to the visible rect unlike the drawRect: which is clipped to the
> scrolling view.


I found that I have to call [myScrollView setDrawsBackground:NO];
during one of my awakeFromNib's to eliminate the clipping problem.

-----

> Based on this little experiment it seems that adding a "drawPostRect:"
> method (with it being passed a NSRect and the ability to call
> getRectsBeingDrawn:count: and needsToDrawRect: the same as drawRect:)
> would be of benefit. Alternatively if the private method I am
> overriding could be made public and properly documented it would be
> appreciated.


It now appears to be working reliably, I will submit this as a feature
request.

-----

George Lawrence Storm
Macintosh Applications Development
Snohomish (Seattle), Washington
E-mail: <<email_removed>>

Related mailsAuthorDate
mlEquivelent to drawRect: for drawing after sub views are drawn George Lawrence St… Sep 30, 08:28
mlRe: Equivelent to drawRect: for drawing after sub views are drawn Ricky Sharp Sep 30, 13:13
mlRe: Equivelent to drawRect: for drawing after sub views are drawn George Lawrence St… Oct 5, 09:14
mlRe: Equivelent to drawRect: for drawing after sub views are drawn Ricky Sharp Oct 5, 13:30
mlRe: Equivelent to drawRect: for drawing after sub views are drawn Izidor Jerebic Oct 5, 18:09
mlRe: Equivelent to drawRect: for drawing after sub views are drawn George Lawrence St… Oct 5, 18:59
mlRe: Equivelent to drawRect: for drawing after sub views are drawn Glenn Andreas Oct 5, 20:39
ml[Wrap-up] Re: Equivelent to drawRect: for drawing after sub views are drawn George Lawrence St… Oct 7, 20:15
mlRe: Equivelent to drawRect: for drawing after sub views are drawn John C. Randolph Oct 8, 08:58
mlRe: Equivelent to drawRect: for drawing after sub views are drawn George Lawrence St… Oct 8, 11:38
mlRe: Equivelent to drawRect: for drawing after sub views are drawn Shawn Erickson Oct 8, 16:39
mlRe: Equivelent to drawRect: for drawing after sub views are drawn R. Scott Thompson Oct 8, 17:01