Cocoa predefined resize mouse cursor?
Asked Answered
J

1

9

Is the resize mouse cursor used by Preview (e.g. when resizing shapes) a system cursor?

enter image description here

It's not available directly as a method in NSCursor but then it doesn't look like there's a private resource for the cursor in the Preview app's bundle either..

Are there more system cursors other than the methods defined by the NSCursor class..?

Jetpropelled answered 2/12, 2014 at 5:18 Comment(0)
S
13

I think you are particularly interested in these class methods (Preview.app dissasembly).

+[NSCursor resizeAngle45Cursor]; which calls +[NSCursor _windowResizeNorthEastSouthWestCursor];
+[NSCursor resizeAngle135Cursor]; which calls +[NSCursor _windowResizeNorthWestSouthEastCursor];

According to disassembly of AppKit these are private methods of NSCursor.

You can try it in your code e.g.

 (void)mouseDown:(NSEvent *)theEvent
{
  [[self window] disableCursorRects];

  id cursor = [[NSCursor class] performSelector:@selector(_windowResizeNorthEastSouthWestCursor)];
  [cursor push];
}

There are more undocumented cursors such as

+[NSCursor _helpCursor];
+[NSCursor _zoomInCursor];
+[NSCursor _zoomOutCursor];

and many many more enter image description here

Speechmaking answered 4/12, 2014 at 13:2 Comment(4)
Most of the above cursors are documented; search for them (without the leading underscore) at developer.apple.com. Most of them are at <developer.apple.com/library/mac/documentation/Cocoa/Reference/…>.Benedick
<developer.apple.com/library/mac/documentation/Cocoa/Reference/…>Benedick
You are right, but the question was about rotated resize cursors which I can't find in the documentation. Updated link to documentation. developer.apple.com/library/mac/documentation/Cocoa/Reference/…Speechmaking
Any idea where this is hidden in Swift? #49297701Rejoinder

© 2022 - 2024 — McMap. All rights reserved.