I'm working on a subclass of NSCell
for my project.
This subclass has, in some situation a NSButtonCell
drawn on its view, with this :
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
...
if (self.mode == PMVersatileCellButton) {
[_button drawWithFrame:cellFrame inView:controlView];
inView:controlView];
} else {
...
}
[super drawInteriorWithFrame:cellFrame inView:controlView];
}
No prob. about the drawing, the problem is respond to click on the button !
I'm trying to do this with :
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)frame ofView:(NSView *)controlView {
NSLog(@"hitTest !");
return [super hitTestForEvent:event inRect:frame ofView:controlView];
}
And :
+ (BOOL)prefersTrackingUntilMouseUp {
return YES;
}
- (BOOL)startTrackingAt:(NSPoint) inView:(NSView *)
- (BOOL)trackMouse:(NSEvent *) inRect:(NSRect) ofView:(NSView *) untilMouseUp:(BOOL)
- (BOOL)continueTracking:(NSPoint) at:(NSPoint) inView:(NSView *)
- (void)stopTracking:(NSPoint) at:(NSPoint) inView:(NSView *) mouseIsUp:(BOOL)
But hitTest or any others never get called...
Only + (BOOL)prefersTrackingUntilMouseUp
get called, which doesn't help me so much...
Any idea ? ^^