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

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16C41b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
@@ -99,7 +99,7 @@
<subviews>
<tokenField verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3sj-gY-zSo">
<rect key="frame" x="1" y="1" width="205" height="16"/>
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" allowsEditingTextAttributes="YES" id="BaM-xn-Wzr">
<tokenFieldCell key="cell" selectable="YES" editable="YES" alignment="left" allowsEditingTextAttributes="YES" id="BaM-xn-Wzr" customClass="SBTokenFieldCell">
<font key="font" metaFont="cellTitle"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -290,7 +290,7 @@
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="120" id="MKe-YL-gx8"/>
</constraints>
<buttonCell key="cell" type="smallSquare" title="Restore Defaults" bezelStyle="smallSquare" image="3CE2261F-EE3E-4371-A1F2-F22FF32A83B6" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nBh-jv-KDG">
<buttonCell key="cell" type="smallSquare" title="Restore Defaults" bezelStyle="smallSquare" image="967F5272-ECFD-4F7A-BDF2-A03AEEEF0C42" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nBh-jv-KDG">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
@@ -342,7 +342,7 @@
<userDefaultsController representsSharedInstance="YES" id="LQR-UU-5Gl"/>
</objects>
<resources>
<image name="3CE2261F-EE3E-4371-A1F2-F22FF32A83B6" width="1" height="1">
<image name="967F5272-ECFD-4F7A-BDF2-A03AEEEF0C42" width="1" height="1">
<mutableData key="keyedArchiveRepresentation">
YnBsaXN0MDDUAQIDBAUGPT5YJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK4HCBMU
GR4fIyQrLjE3OlUkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5TUmVw
@@ -206,14 +206,14 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<popUpButton fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cFv-4U-VzM">
<rect key="frame" x="0.0" y="-4" width="316" height="22"/>
<rect key="frame" x="0.0" y="-2" width="316" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="bevel" title="Do not localize" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" imageScaling="proportionallyDown" inset="2" selectedItem="6Zb-NM-Mmo" id="Myn-C3-tc4">
<popUpButtonCell key="cell" type="bevel" title="Do not localize" bezelStyle="rounded" alignment="left" controlSize="small" lineBreakMode="truncatingTail" state="on" imageScaling="proportionallyDown" inset="2" selectedItem="6Zb-NM-Mmo" id="Myn-C3-tc4">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystem"/>
<menu key="menu" id="qwD-bC-Vmw">
<items>
<menuItem title="Do not localize" id="6Zb-NM-Mmo"/>
<menuItem title="Do not localize" state="on" id="6Zb-NM-Mmo"/>
</items>
</menu>
</popUpButtonCell>
@@ -251,9 +251,9 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<comboBox verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="1000" translatesAutoresizingMaskIntoConstraints="NO" id="LbC-r6-Pau">
<rect key="frame" x="3" y="-1" width="319" height="19"/>
<rect key="frame" x="3" y="0" width="319" height="18"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="border" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" completes="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn">
<comboBoxCell key="cell" controlSize="small" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" alignment="left" title="Do not localize" usesSingleLineMode="YES" buttonBordered="NO" completes="NO" numberOfVisibleItems="5" id="jkg-xz-Hbn" customClass="SBComboBoxCell">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+13
View File
@@ -0,0 +1,13 @@
//
// SBComboBoxCell.h
// Subler
//
// Created by Damiano Galassi on 10/11/16.
//
//
#import <Cocoa/Cocoa.h>
@interface SBComboBoxCell : NSComboBoxCell
@end
+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
-11
View File
@@ -10,15 +10,4 @@
@implementation SBComboBoxCellView
- (void)setBackgroundStyle:(NSBackgroundStyle)backgroundStyle
{
[super setBackgroundStyle:backgroundStyle];
if (backgroundStyle == NSBackgroundStyleDark) {
self.comboBox.textColor = [NSColor controlHighlightColor];
}
else {
self.comboBox.textColor = [NSColor controlTextColor];
}
}
@end
+13
View File
@@ -0,0 +1,13 @@
//
// SBTokenFieldCell.h
// Subler
//
// Created by Damiano Galassi on 10/11/16.
//
//
#import <Cocoa/Cocoa.h>
@interface SBTokenFieldCell : NSTokenFieldCell
@end
+47
View File
@@ -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