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>>
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>>






Cocoa mail archive

