Cocoa cursor

Discussion in 'Mac Programming' started by MacRumoron, Jul 29, 2007.

  1. macrumors 6502

    Joined:
    Sep 6, 2005
    #1
    How would I get this cursor without having to save an image of it and putting it inside my app bundle?

    [​IMG]

    Thanks in advance
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    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 it can be set via a Carbon call but not a Cocoa one. Just call the Carbon method.
     
  3. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    No need to go with Carbon. Just setup your NSView like this:

    Code:
    - (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
    {
    	return NSDragOperationCopy;
    }
     
  4. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    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.
     
  5. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #5
    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:
    Code:
    [[NSCursor _copyDragCursor] set];
     
  6. thread starter macrumors 6502

    Joined:
    Sep 6, 2005
    #6
    this is what i was looking for, thanks everyone :D
     

Share This Page