1 @interface NSView (frameAsQuickDrawRect)
2 - (Rect)frameAsQuickDrawRect;
3 @end
4 @implementation NSView (frameAsQuickDrawRect)
5 - (Rect)frameAsQuickDrawRect {
6 NSRect nsrect = [self convertRect:[self bounds] toView:[[self window] contentView]];
7 float windowHeight = NSHeight( [[[self window] contentView] frame] );
8
9 float nsrectHeight = NSHeight( nsrect );
10
11 Rect qdrect;
12 qdrect.top = windowHeight - (nsrect.origin.y + nsrectHeight);
13 qdrect.left = nsrect.origin.x;
14 qdrect.bottom = qdrect.top + nsrectHeight;
15 qdrect.right = qdrect.left + NSWidth( nsrect );
16
17 return qdrect;
18 }
19 @end