I’m using an NSImageView to display an image on an NSWindow. The image will be on top of the area where the user can normally drag the window.
The window is styled in such a way that it’s not easily apparent that you can drag the window… I thus need this little image to indicate that you can in fact drag the window.
Unfortunately, I can’t figure out how to make a click on the image drag the window! It needs this. Dragging anywhere else in the window’s title area works fine.
How can I make clicking and holding the image drag the entire window?
Bonus points if you can tell me how to give the mouse a “drag icon” cursor while hovered on this image.
I think the easiest way is to subclass NSImageView and return YES to mouseDownCanMoveWindow (which it inherits from NSView).
You can set a new cursor when the mouse enters the image view by overriding resetCursorRects like this in the NSImageView subclass (I don’t know what you mean by “drag icon” cursor, so this example uses the pointing hand cursor: