Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)frame ofView:(NSView *)controlView {
- NSRect checkBoxFrame = [self _checkBoxFrameForInteriorFrame:frame];
- NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
- // Delegate hit testing to other cells
- if (_checkBoxCell) {
- if (NSPointInRect(point, checkBoxFrame)) {
- return NSCellHitTrackableArea;
- }
- }
- return NSCellHitNone;
- }
- + (BOOL)prefersTrackingUntilMouseUp {
- // you want a single, long tracking "session" from mouse down till up
- return YES;
- }
- - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView {
- [_checkBoxCell setHighlighted:YES];
- return YES; // keep tracking
- }
- - (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView {
- // if |currentPoint| is in the button, highlight it
- // otherwise, unhighlight it
- return YES; // keep on tracking
- }
- - (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag {
- // if |flag| and mouse in button's rect, then
- // and, finally,
- }
Add Comment
Please, Sign In to add comment