• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSCursor Resize Cursor
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCursor Resize Cursor


  • Subject: Re: NSCursor Resize Cursor
  • From: Joachim <email@hidden>
  • Date: Thu, 26 Jan 2006 23:46:30 -0800

John Stiles wrote:

I agree with other posters--if you make your own cursor, your app is
likely to stand out, and not in a good way.

I completely disagree. Just take 3 of Apple's own applications; iPhoto, Preview and Pages, and they all have different ways of handling user feedback when resizing selection areas. Preview uses round handles, Pages square, iPhoto none. And the cursors are all different. And I'm sure you can find many other "standards" even just within Apple's applications.


If you, like me, fancy Page's user experience when it comes to resizing a selection area with handles in each corner and on the sides (and I think that's what you're looking for), extract the cursors from Pages ("Angle45ResizeCursor.tiff" etc. in the application bundle) and use them for your cursors. Use code like this to apply the cursors:

+ (NSCursor *)cursor:(NSString *)cursorFile withHotSpot:(NSPoint)hotSpot
{
    // Returns the cursor using the given image
    // Caller must retain it

    NSCursor  *cursor;
    NSImage   *cursorImage;

cursorImage = [[NSImage alloc] initWithContentsOfFile:
[[NSBundle bundleWithIdentifier:kCSPaneBundleIdentifier]
pathForResource:cursorFile ofType:nil]];
cursor = [[NSCursor alloc] initWithImage:cursorImage hotSpot:hotSpot];


    [cursorImage release];
    [cursor autorelease];
    return cursor;
}

- void NSCursor *MyCursor (int cursor)
{
    // Return the desired cursor
    switch (cursor) {
        case kNESWCursor:
            return [YourClass cursor:@"Angle45ResizeCursor.tiff"
                         withHotSpot:NSMakePoint (8, 8)];
    ...
}

NSCursor *nwseCursor = MyCursor (kNESWCursor);
[neswCursor push];
...
[[NSCursor currentCursor] pop];

Hope it helps,
Joachim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSCursor Resize Cursor
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Getting control IDs at initialization
  • Next by Date: Re: NSCursor Resize Cursor
  • Previous by thread: Re: NSCursor Resize Cursor
  • Next by thread: Re: NSCursor Resize Cursor
  • Index(es):
    • Date
    • Thread