PDA

View Full Version : Cocoa cursor




MacRumoron
Jul 30, 2007, 12:07 AM
How would I get this cursor without having to save an image of it and putting it inside my app bundle?

http://img214.imageshack.us/img214/227/cursorew2.jpg

Thanks in advance



robbieduncan
Jul 30, 2007, 02:20 AM
It's not directly available in Cocoa. You can get it to appear in Cocoa apps if you accept a drag with certain masks but that's because the Finder is setting it.

As you can see here (http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGCursors/chapter_15_section_2.html) it can be set via a Carbon call but not a Cocoa one. Just call the Carbon method.

kainjow
Jul 30, 2007, 06:32 AM
It's not directly available in Cocoa. You can get it to appear in Cocoa apps if you accept a drag with certain masks but that's because the Finder is setting it.

As you can see here (http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGCursors/chapter_15_section_2.html) it can be set via a Carbon call but not a Cocoa one. Just call the Carbon method.

No need to go with Carbon. Just setup your NSView like this:

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
return NSDragOperationCopy;
}

robbieduncan
Jul 30, 2007, 06:42 AM
No need to go with Carbon. Just setup your NSView like this:

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
return NSDragOperationCopy;
}

That was what I was alluding to when I said "if you accept a drag with certain masks". I assumed the OP was wanting to make this appear in other conditions via a NSCursor set call, which cannot be done, but can via Carbon.

kainjow
Jul 30, 2007, 06:51 AM
That was what I was alluding to when I said "if you accept a drag with certain masks". I assumed the OP was wanting to make this appear in other conditions via a NSCursor set call, which cannot be done, but can via Carbon.

Ah I see. But it seems like if you were using this cursor outside of a drag, it would be inconsistent UI.

I would be willing to bet that that cursor is available via a private method call as well *tinkers with class-dump*

Edit: this does the job, although it could break in Leopard: [[NSCursor _copyDragCursor] set];

MacRumoron
Jul 30, 2007, 12:48 PM
No need to go with Carbon. Just setup your NSView like this:

- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
return NSDragOperationCopy;
}

this is what i was looking for, thanks everyone :D