miscellaneous questions
miscellaneous questions
- Subject: miscellaneous questions
- From: Oscar Bascara <email@hidden>
- Date: Sun, 24 Mar 2002 20:20:37 -0800
Well, I just have a few more miscellaneous questions. I've been trying
to remember to write down questions as I program in Cocoa.
The routine NSMakeRect(x,y,w,h) is useful for building a rectangle. Is
there a function for creating a rectangle given two points? Or do I
just have to write my own? I looked at NSGeometry.h to see how
NSMakeRect(x,y,w,h) is written, and now I'm also using:
FOUNDATION_STATIC_INLINE NSRect BTNMakeRect(NSPoint p1, NSPoint p2)
{
return NSMakeRect(MIN(p1.x, p2.x), MIN(p1.y, p2.y),
abs(p1.x - p2.x), abs(p1.y - p2.y));
}
This is a very basic question, but what does static inline mean? I know
that inline means to compile the code directly inserted every time the
routine is called (and that this can lead to code bloat so inline
routines should be short). But what is meant by static? I've also seen
extern inline (which has the FOUNDATION_EXTERN_INLINE macro), which I
think means the inline code is built elsewhere and needs to be linked
later on.
Here's another miscellaneous question. I've been using [event
locationInWindow] in a timer routine to make autoscrolling smoother (as
advised by Aaron Hillegass in his book). It really does make things
smoother. But [event locationInWindow] apparently is not valid for
every event, despite what the online Apple documentation says. In
particular, I've had trouble when NSFlagChanged, NSKeyDown, or NSKeyUp
happens to be the event type. In the timer routine, I have to
explicitly ignore these types. Has this been the experience with other
people?
Oscar Bascara
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.