[futurebasic] Using NSOffSetRect

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2010 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Sun, 7 Nov 2010 00:09:20 -0400
Brian wrote:

>So far my efforts to coerce an HIRect to an NSRect ( to feed to the 
>C wrapper function that calls NSOffSetRect() ) have failed.


Brian,

In 10.5 and later you could use the the new utility functions 
NSRectFromCGRect and NSRectToCGRect to expedite the conversion to and 
from the HIRect (which is a CGRect).

Ken


HIRect DoOffSetNSRect( HIRect hiRect, CGFloat offset )
{
     NSRect tempRect = NSRectFromCGRect( (CGRect)inRect );
     CGRect outRect  = NSRectToCGRect( NSOffsetRect( tempRect, 0, offset) );
     return (HIRect)outRect;
}
endC