Remove disableHighlight property from NSCell subclass

The desired rendering can be achieved without adding code to NSCell
This commit is contained in:
Allan Odgaard
2013-10-27 11:27:47 +01:00
parent 40d9b239b4
commit f943a6367a
3 changed files with 5 additions and 16 deletions

View File

@@ -13,7 +13,6 @@ PUBLIC @interface OFBPathInfoCell : OakImageAndTextCell
@property (nonatomic, assign) BOOL isOpen;
@property (nonatomic, assign) BOOL isVisible;
@property (nonatomic, assign) BOOL isLoading;
@property (nonatomic, assign) BOOL disableHighlight;
- (NSRect)closeButtonRectInFrame:(NSRect)cellFrame;
@end

View File

@@ -97,15 +97,6 @@ static void DrawSpinner (NSRect cellFrame, BOOL isFlipped, NSColor* color, doubl
return NSMouseInRect(mousePoint, [self closeButtonRectInFrame:cellFrame], controlView.isFlipped);
}
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
BOOL wasHighlighted = self.isHighlighted;
if(self.disableHighlight)
self.highlighted = NO;
[super drawInteriorWithFrame:cellFrame inView:controlView];
self.highlighted = wasHighlighted;
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView
{
if([controlView respondsToSelector:@selector(indentationPerLevel)])

View File

@@ -54,10 +54,6 @@
// ========================================
@interface NSCell (DisableHighlight)
@property (nonatomic) BOOL disableHighlight;
@end
@interface OakInactiveTableView ()
@property (nonatomic) OakTextFieldMovementDelegate* textFieldMovementDelegate;
@end
@@ -66,8 +62,11 @@
- (NSCell*)preparedCellAtColumn:(NSInteger)column row:(NSInteger)row
{
NSCell* res = [super preparedCellAtColumn:column row:row];
if([res respondsToSelector:@selector(setDisableHighlight:)])
[res setDisableHighlight:[self.window isKeyWindow]];
if(res.isHighlighted && [self.window isKeyWindow])
{
res.backgroundStyle = NSBackgroundStyleDark;
res.highlighted = NO;
}
return res;
}