6 Commits

Author SHA1 Message Date
Alex Rozanski 29d61656fe Add Release Notes for 2.0.2. 2014-03-06 00:01:22 +00:00
Alex Rozanski 52e21a8ced Bump project to 2.0.2. 2014-03-06 00:00:06 +00:00
Alex Rozanski 60974e14fd Fix #39: Badges not drawn correctly when Source List row is selected.
This fix consists of two parts:
1) We first need to check the backgroundStyle property in
PXSourceListBadgeCell to determine whether to draw the light badge
background or not.

2) Next we need to determine whether the enclosing Source List (or child
view) is focused to decide whether to draw the badge text using the bright
blue or grey-blue. To do this, we walk up the view hierarchy
from the common ancestor view of the controlView and firstResponder
until we hit a PXSourceList instance. If we find one, then the source
list is selected, otherwise not.

Walking up the tree from the common ancestor view catches the highly-
unlikely but possible scenario where there are two PXSourceList
instances on screen and one is focused.
2014-03-05 23:50:11 +00:00
Alex Rozanski 3eadddb784 Bump project to 2.0.1. 2014-01-29 13:25:34 +00:00
Alex Rozanski 20a6e83f86 Add Release Notes for 2.0.1. 2014-01-29 12:55:20 +00:00
Alex Rozanski 7548ffdd1b Update ReleaseNotes for 2.0.0.
The note about -[PXSourceList delegate] and -[PXSourceList dataSource]
being marked as unavailable was missing from the 2.0.0 release notes.
2014-01-29 12:50:24 +00:00
4 changed files with 32 additions and 7 deletions
+2 -2
View File
@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<string>2.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>2.0.0</string>
<string>2.0.2</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2009-14 Alex Rozanski and other contributors. All rights reserved.</string>
<key>NSPrincipalClass</key>
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PXSourceList'
s.version = '2.0.0'
s.version = '2.0.2'
s.author = { 'Alex Rozanski' => 'alex@rozanski.me' }
s.license = 'BSD'
s.homepage = 'https://github.com/Perspx/PXSourceList'
@@ -23,6 +23,6 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.7'
s.public_header_files = 'PXSourceList/*.h'
s.source = { :git => 'https://github.com/Perspx/PXSourceList.git', :tag => '2.0.0' }
s.source = { :git => 'https://github.com/Perspx/PXSourceList.git', :tag => '2.0.2' }
s.source_files = 'PXSourceList/**/*.{h,m}'
end
+20 -2
View File
@@ -9,6 +9,8 @@
#import "PXSourceListBadgeCell.h"
#import "PXSourceList.h"
//Drawing constants
static inline NSColor *badgeBackgroundColor() { return [NSColor colorWithCalibratedRed:(152/255.0) green:(168/255.0) blue:(202/255.0) alpha:1]; }
static inline NSColor *badgeHiddenBackgroundColor() { return [NSColor colorWithDeviceWhite:(180/255.0) alpha:1]; }
@@ -40,11 +42,27 @@ static const CGFloat badgeLeftAndRightPadding = 5.0;
NSDictionary *attributes;
NSColor *backgroundColor;
if(self.isHighlighted) {
if(self.isHighlighted || self.backgroundStyle == NSBackgroundStyleDark) {
backgroundColor = [NSColor whiteColor];
NSResponder *firstResponder = controlView.window.firstResponder;
BOOL isFocused = [firstResponder isKindOfClass:[NSView class]] && [(NSView *)firstResponder isDescendantOf:controlView];
BOOL isFocused = NO;
// Starting with the closest ancestor of the control view and the first responder (to make sure both views are in the
// same subtree of the view hierarchy), keep going up the view hierarchy until we hit a PXSourceList instance to tell
// if the source list is focused.
// This covers both the cell-based and view-based cases as well as if a child view of the NSTableCellView (such as
// a text field) is focused.
if ([firstResponder isKindOfClass:[NSView class]]) {
NSView *view = [(NSView*)firstResponder ancestorSharedWithView:controlView];
do {
if ([view isKindOfClass:[PXSourceList class]]) {
isFocused = YES;
break;
}
} while ((view = [view superview]));
}
NSColor *textColor;
if (isMainWindowVisible && isFocused)
+8 -1
View File
@@ -1,5 +1,11 @@
# PXSourceList Release Notes
## 2.0.2
- Fix #39: Badges not drawn correctly when Source List row is selected.
## 2.0.1
- Add missing note to the 2.0.0 release notes about marking `-[PXSourceList delegate]` and `-[PXSourceList dataSource]` as unavailable using \_\_attribute\_\_.
## 2.0.0
### New Features
@@ -11,6 +17,7 @@
- Added a generic `PXSourceListItem` data source model class which can be used for easily constructing data source models without having to implement your own class.
### API Changes
- **Incompatible change.* Marked `-[PXSourceList delegate]` and -[PXSourceList dataSource]` as unavailable using the “unavailable” \_\_attribute\_\_. These methods shouldnt be used because of the internal implementation of PXSourceList, and have been documented as such since version 0.8. However, adding this \_\_attribute\_\_ is more robust because a compile-time error will be generated if you use either of these methods.
- Added view-based Source List delegate methods to `PXSourceListDelegate`, namely:
- `-sourceList:viewForItem:`
- `-sourceList:rowViewForItem:`
@@ -67,4 +74,4 @@
- Removed `SourceListItem` from the old example project as it has been superseded by `PXSourceListItem`.
- Removed the TODO.rtf file from the project as all issues are now being tracked through GitHub.
- Upgraded the Xcode project to the Xcode 5 project format. `LastUpgradeCheck` was updated from `0450` to`0500`.
- Added a Release Notes file ;)
- Added a Release Notes file ;)