Fix ComboBox highlight color.

This commit is contained in:
Damiano Galassi committed 2016-11-10 16:42:33 +01:00
1 parent d53b0d6ad0
commit eb7d2c5ba7
9 files changed
+159 -30

No files matched your search

+47
View File
@@ -0,0 +1,47 @@
//
// SBComboBoxCell.m
// Subler
//
// Created by Damiano Galassi on 10/11/16.
//
//
#import "SBComboBoxCell.h"
@interface SBComboBoxCell ()
@property (nonatomic) NSBackgroundStyle SB_originalBackgroundStyle;
@end
@implementation SBComboBoxCell
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle
{
[super setBackgroundStyle:backgroundStyle];
if (backgroundStyle == NSBackgroundStyleDark) {
self.textColor = [NSColor controlHighlightColor];
}
else {
self.textColor = [NSColor controlTextColor];
}
}
- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj;
{
self.SB_originalBackgroundStyle = self.backgroundStyle;
self.backgroundStyle = NSBackgroundStyleLight;
self.drawsBackground = YES;
return [super setUpFieldEditorAttributes:textObj];
}
- (void)endEditing:(NSText *)textObj
{
[super endEditing:textObj];
self.drawsBackground = NO;
self.backgroundStyle = self.SB_originalBackgroundStyle;
}
@end