mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Draw white circle around label swatch when row is selected
We previously did this when the background style was set to dark, but the code for this only works when the view is a direct descendent of the NSTableCellView and also, when a row is selected in an inactive table view, the background style is not set to dark.
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
|
||||
@interface OakLabelSwatchView : NSView
|
||||
@property (nonatomic) NSInteger labelIndex;
|
||||
@property (nonatomic) NSBackgroundStyle backgroundStyle;
|
||||
@end
|
||||
|
||||
@implementation OakLabelSwatchView
|
||||
@@ -42,6 +41,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)isSelected
|
||||
{
|
||||
NSView* view = self;
|
||||
while(view && ![view isKindOfClass:[NSTableRowView class]])
|
||||
view = [view superview];
|
||||
return [view isKindOfClass:[NSTableRowView class]] && ((NSTableRowView*)view).isSelected;
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)aRect
|
||||
{
|
||||
if(_labelIndex == 0)
|
||||
@@ -56,7 +63,7 @@
|
||||
NSBezierPath* path = [NSBezierPath bezierPathWithOvalInRect:r];
|
||||
[path fill];
|
||||
|
||||
if(_backgroundStyle == NSBackgroundStyleDark)
|
||||
if(self.isSelected)
|
||||
{
|
||||
[[NSColor whiteColor] set];
|
||||
[path stroke];
|
||||
|
||||
Reference in New Issue
Block a user