Fix ComboBox highlight color.
This commit is contained in:
1 parent
d53b0d6ad0
commit
eb7d2c5ba7
9 files changed
+159
-30
No files matched your search
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// SBTokenFieldCell.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 10/11/16.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBTokenFieldCell.h"
|
||||
|
||||
@interface SBTokenFieldCell ()
|
||||
|
||||
@property (nonatomic) NSBackgroundStyle SB_originalBackgroundStyle;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBTokenFieldCell
|
||||
|
||||
- (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
|
||||
Reference in new issue
Block a user