You can override -(void) resetCursorRects for a subclass of NSView . Something like that:
-(void) resetCursorRects { [super resetCursorRects]; // define cursor image and cursorRects NSRect move = NSMakeRect((reg1UserStart + REGION_RESIZE_SIZE),REGION_Y_LOCATION, (self.reg1UserLength - (REGION_RESIZE_SIZE*2)), REGION_HEIGHT); NSRect resizeStart = NSMakeRect(self.reg1UserStart, REGION_Y_LOCATION, REGION_RESIZE_SIZE, REGION_HEIGHT); NSRect resizeEnd = NSMakeRect(((self.reg1UserStart + self.reg1UserLength) - REGION_RESIZE_SIZE), REGION_Y_LOCATION, REGION_RESIZE_SIZE, REGION_HEIGHT); [self addCursorRect:move cursor:[NSCursor openHandCursor]]; [self addCursorRect:resizeStart cursor: [NSCursor resizeRightCursor]]; [self addCursorRect:resizeEnd cursor:[NSCursor resizeLeftCursor]]; }
You must define an NSRect , which represents the area that the mouse cursor changes, and then you specify the type of NSCursor. It can also be used to create custom cursors.
Gw
source share