Simple question - Subclassing NSView

2008-06-12 Thread Vikas
Hi, I have recently started programming on Mac using Objective-C and Cocoa. I am coming from C++/C# world. So, its a fairly basic question. Please help me understand the following code: @implementation MyView /*MyView inherits from NSView */ -(void)drawRect: (NSRect)aRect {

Re: Simple question - Subclassing NSView

2008-06-12 Thread Randall Meadows
On Jun 12, 2008, at 10:26 AM, Vikas wrote: I have recently started programming on Mac using Objective-C and Cocoa. I am coming from C++/C# world. So, its a fairly basic question. Please help me understand the following code: @implementation MyView /*MyView inherits from NSView */

Re: Simple question - Subclassing NSView

2008-06-12 Thread Hamish Allan
Hi Vikas, On Thu, Jun 12, 2008 at 6:26 PM, Vikas [EMAIL PROTECTED] wrote: I have recently started programming on Mac using Objective-C and Cocoa. I am coming from C++/C# world. So, its a fairly basic question. Please help me understand the following code: @implementation MyView

Re: Simple question - Subclassing NSView

2008-06-12 Thread I. Savant
I have recently started programming on Mac using Objective-C and Cocoa. I am coming from C++/C# world. Recant, heretic! ;-) In first line, I was expecting something like [self setColor:[NSColor blackColor]]; (similar to this.color = NSColor.blackColor; in C#/C++) how NSColor object

Re: Simple question - Subclassing NSView

2008-06-12 Thread Vikas
O'kay, that was helpful. I still have one doubt. The declaration of NSRectFill is as below: void NSRectFill ( NSRect aRect ); NSRectFill() is a C function, not part of any class e.g. NSView. aRect is simply a struct which specify location points (doesnt contain reference of any

Re: Simple question - Subclassing NSView

2008-06-12 Thread Hamish Allan
On Thu, Jun 12, 2008 at 6:54 PM, Vikas [EMAIL PROTECTED] wrote: NSRectFill() is a C function, not part of any class e.g. NSView. aRect is simply a struct which specify location points (doesnt contain reference of any window). How the function knows about the drawing surface, in which

Re: Simple question - Subclassing NSView

2008-06-12 Thread I. Savant
NSRectFill() is a C function, not part of any class e.g. NSView. aRect is simply a struct which specify location points (doesnt contain reference of any window). How the function knows about the drawing surface, in which window/surface to paint? Does it implicitly make use of some self

Re: Simple question - Subclassing NSView

2008-06-12 Thread Kyle Sluder
On Thu, Jun 12, 2008 at 1:54 PM, Vikas [EMAIL PROTECTED] wrote: NSRectFill() is a C function, not part of any class e.g. NSView. aRect is simply a struct which specify location points (doesnt contain reference of any window). How the function knows about the drawing surface, in which

Re: Simple question - Subclassing NSView

2008-06-12 Thread Mike Abdullah
On 12 Jun 2008, at 10:54, Vikas wrote: O'kay, that was helpful. I still have one doubt. The declaration of NSRectFill is as below: void NSRectFill ( NSRect aRect ); NSRectFill() is a C function, not part of any class e.g. NSView. aRect is simply a struct which specify location points

Re: Simple question - Subclassing NSView

2008-06-12 Thread Jens Alfke
On 12 Jun '08, at 10:54 AM, Vikas wrote: How the function knows about the drawing surface, in which window/ surface to paint? There's always a current graphics context; it's global to each thread. (See NSGraphicsContext if you want to look at its API; but if you're looking for the