开发者

hitTest doesn't get called in NSCell subclass

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) {
      开发者_StackOverflow社区  [_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 ? ^^

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜