Cocoa predefined resize mouse cursor?

岁酱吖の 提交于 2019-12-21 16:54:37

问题


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

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..?


回答1:


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



来源:https://stackoverflow.com/questions/27242353/cocoa-predefined-resize-mouse-cursor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!