Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Jonathan 'Wolf' Rentzsch http://rentzsch.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Calculate a NSView's frame in QuickDraw coordinates

   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
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS