aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks
diff options
context:
space:
mode:
authorXu Jie <xujie04@gmail.com>2014-12-01 17:53:24 +0800
committerXu Jie <xujie04@gmail.com>2014-12-01 17:53:24 +0800
commit5195ce158690ef1fb39869a6727c3de4b110b496 (patch)
tree522616ea735cf79c3af15f7cad6226d19ab384ec /Frameworks
parent1af7e143385e716b5b0154854dda22a9c270ccad (diff)
downloadsequelpro-5195ce158690ef1fb39869a6727c3de4b110b496.tar.gz
sequelpro-5195ce158690ef1fb39869a6727c3de4b110b496.tar.bz2
sequelpro-5195ce158690ef1fb39869a6727c3de4b110b496.zip
Remove a private API in PSMTabBarCell
Directly assigning to _controlView of a NSActionCell is private and not allowed by Mac App Store. An _customControlView is used to replace _controlView in PSMTabBarCell to avoid direct assigning to _controlView. This should be the last private API to remove before going to Mac App Store.
Diffstat (limited to 'Frameworks')
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarCell.h5
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarCell.m68
-rw-r--r--Frameworks/PSMTabBar/PSMTabDragAssistant.m4
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m4
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m4
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m4
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m4
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m2
-rw-r--r--Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m4
9 files changed, 50 insertions, 49 deletions
diff --git a/Frameworks/PSMTabBar/PSMTabBarCell.h b/Frameworks/PSMTabBar/PSMTabBarCell.h
index 6279355a..c68f9814 100644
--- a/Frameworks/PSMTabBar/PSMTabBarCell.h
+++ b/Frameworks/PSMTabBar/PSMTabBarCell.h
@@ -35,6 +35,7 @@
NSColor *_countColor;
BOOL _isEdited;
NSColor *_backgroundColor;
+ id _customControlView;
}
// creation/destruction
@@ -43,8 +44,8 @@
- (void)dealloc;
// accessors
-- (id)controlView;
-- (void)setControlView:(id)view;
+- (id)customControlView;
+- (void)setCustomControlView:(id)view;
- (NSTrackingRectTag)closeButtonTrackingTag;
- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag;
- (NSTrackingRectTag)cellTrackingTag;
diff --git a/Frameworks/PSMTabBar/PSMTabBarCell.m b/Frameworks/PSMTabBar/PSMTabBarCell.m
index 003c1220..80fe4ec0 100644
--- a/Frameworks/PSMTabBar/PSMTabBarCell.m
+++ b/Frameworks/PSMTabBar/PSMTabBarCell.m
@@ -23,7 +23,7 @@
- (id)initWithControlView:(PSMTabBarControl *)controlView
{
if ( (self = [super init]) ) {
- _controlView = controlView;
+ _customControlView = controlView;
_closeButtonTrackingTag = 0;
_cellTrackingTag = 0;
_closeButtonOver = NO;
@@ -45,7 +45,7 @@
- (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView
{
if ( (self = [super init]) ) {
- _controlView = controlView;
+ _customControlView = controlView;
_isPlaceholder = YES;
if (!value) {
if ([controlView orientation] == PSMTabBarHorizontalOrientation) {
@@ -90,15 +90,15 @@
#pragma mark -
#pragma mark Accessors
-- (id)controlView
+- (id)customControlView
{
- return _controlView;
+ return _customControlView;
}
-- (void)setControlView:(id)view
+- (void)setCustomControlView:(id)view
{
// no retain release pattern, as this simply switches a tab to another view.
- _controlView = view;
+ _customControlView = view;
}
- (NSTrackingRectTag)closeButtonTrackingTag
@@ -136,7 +136,7 @@
_frame = rect;
//move the status indicator along with the rest of the cell
- if (![[self indicator] isHidden] && ![_controlView isTabBarHidden]) {
+ if (![[self indicator] isHidden] && ![_customControlView isTabBarHidden]) {
[[self indicator] setFrame:[self indicatorRectForFrame:rect]];
}
}
@@ -146,7 +146,7 @@
[super setStringValue:aString];
_stringSize = [[self attributedStringValue] size];
// need to redisplay now - binding observation was too quick.
- [_controlView update];
+ [_customControlView update];
}
- (NSSize)stringSize
@@ -156,7 +156,7 @@
- (NSAttributedString *)attributedStringValue
{
- return [[(PSMTabBarControl *)_controlView style] attributedStringValueForTabCell:self];
+ return [[(PSMTabBarControl *)_customControlView style] attributedStringValueForTabCell:self];
}
- (NSInteger)tabState
@@ -183,8 +183,8 @@
{
if (_isInOverflowMenu != value) {
_isInOverflowMenu = value;
- if ([[[self controlView] delegate] respondsToSelector:@selector(tabView:tabViewItem:isInOverflowMenu:)]) {
- [[[self controlView] delegate] tabView:[self controlView] tabViewItem:[self representedObject] isInOverflowMenu:_isInOverflowMenu];
+ if ([[[self customControlView] delegate] respondsToSelector:@selector(tabView:tabViewItem:isInOverflowMenu:)]) {
+ [[[self customControlView] delegate] tabView:[self customControlView] tabViewItem:[self representedObject] isInOverflowMenu:_isInOverflowMenu];
}
}
}
@@ -201,7 +201,7 @@
- (BOOL)closeButtonOver
{
- return (_closeButtonOver && ([_controlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSCommandKeyMask));
+ return (_closeButtonOver && ([_customControlView allowsBackgroundTabClosing] || ([self tabState] & PSMTab_SelectedMask) || [[NSApp currentEvent] modifierFlags] & NSCommandKeyMask));
}
- (void)setCloseButtonOver:(BOOL)value
@@ -237,7 +237,7 @@
- (void)setHasIcon:(BOOL)value
{
_hasIcon = value;
- //[_controlView update:[[self controlView] automaticallyAnimates]]; // binding notice is too fast
+ //[_customControlView update:[[self customControlView] automaticallyAnimates]]; // binding notice is too fast
}
- (BOOL)hasLargeImage
@@ -259,7 +259,7 @@
- (void)setCount:(NSInteger)value
{
_count = value;
- //[_controlView update:[[self controlView] automaticallyAnimates]]; // binding notice is too fast
+ //[_customControlView update:[[self customControlView] automaticallyAnimates]]; // binding notice is too fast
}
- (NSColor *)countColor
@@ -307,7 +307,7 @@
- (void)setIsEdited:(BOOL)value
{
_isEdited = value;
- //[_controlView update:[[self controlView] automaticallyAnimates]]; // binding notice is too fast
+ //[_customControlView update:[[self customControlView] automaticallyAnimates]]; // binding notice is too fast
}
- (NSColor *)backgroundColor {
@@ -327,9 +327,9 @@
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
// the progress indicator, label, icon, or count has changed - redraw the control view
- //[_controlView update];
+ //[_customControlView update];
//I seem to have run into some odd issue with update not being called at the right time. This seems to avoid the problem.
- [_controlView performSelector:@selector(update) withObject:nil afterDelay:0.0];
+ [_customControlView performSelector:@selector(update) withObject:nil afterDelay:0.0];
}
#pragma mark -
@@ -337,22 +337,22 @@
- (NSRect)indicatorRectForFrame:(NSRect)cellFrame
{
- return [[(PSMTabBarControl *)_controlView style] indicatorRectForTabCell:self];
+ return [[(PSMTabBarControl *)_customControlView style] indicatorRectForTabCell:self];
}
- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame
{
- return [[(PSMTabBarControl *)_controlView style] closeButtonRectForTabCell:self withFrame:cellFrame];
+ return [[(PSMTabBarControl *)_customControlView style] closeButtonRectForTabCell:self withFrame:cellFrame];
}
- (CGFloat)minimumWidthOfCell
{
- return [[(PSMTabBarControl *)_controlView style] minimumWidthOfTabCell:self];
+ return [[(PSMTabBarControl *)_customControlView style] minimumWidthOfTabCell:self];
}
- (CGFloat)desiredWidthOfCell
{
- return [[(PSMTabBarControl *)_controlView style] desiredWidthOfTabCell:self];
+ return [[(PSMTabBarControl *)_customControlView style] desiredWidthOfTabCell:self];
}
#pragma mark -
@@ -361,14 +361,14 @@
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
if (_isPlaceholder) {
- if (![_controlView usesSafariStyleDragging]) {
+ if (![_customControlView usesSafariStyleDragging]) {
[[NSColor colorWithCalibratedWhite:0.0f alpha:0.2f] set];
NSRectFillUsingOperation(cellFrame, NSCompositeSourceAtop);
}
return;
}
- [[(PSMTabBarControl *)_controlView style] drawTabCell:self];
+ [[(PSMTabBarControl *)_customControlView style] drawTabCell:self];
}
#pragma mark -
@@ -382,15 +382,15 @@
}
if ([theEvent trackingNumber] == _cellTrackingTag) {
[self setHighlighted:YES];
- [_controlView setNeedsDisplay:NO];
+ [_customControlView setNeedsDisplay:NO];
}
// scrubtastic
- if ([_controlView allowsScrubbing] && ([theEvent modifierFlags] & NSAlternateKeyMask))
- [_controlView tabClick:self];
+ if ([_customControlView allowsScrubbing] && ([theEvent modifierFlags] & NSAlternateKeyMask))
+ [_customControlView tabClick:self];
// tell the control we only need to redraw the affected tab
- [_controlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
+ [_customControlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
}
- (void)mouseExited:(NSEvent *)theEvent
@@ -402,11 +402,11 @@
if ([theEvent trackingNumber] == _cellTrackingTag) {
[self setHighlighted:NO];
- [_controlView setNeedsDisplay:NO];
+ [_customControlView setNeedsDisplay:NO];
}
//tell the control we only need to redraw the affected tab
- [_controlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
+ [_customControlView setNeedsDisplayInRect:NSInsetRect([self frame], -2, -2)];
}
#pragma mark -
@@ -414,7 +414,7 @@
- (NSImage *)dragImage
{
- NSRect cellFrame = [(id <PSMTabStyle>)[(PSMTabBarControl *)_controlView style] dragRectForTabCell:self orientation:(PSMTabBarOrientation)[(PSMTabBarControl *)_controlView orientation]];
+ NSRect cellFrame = [(id <PSMTabStyle>)[(PSMTabBarControl *)_customControlView style] dragRectForTabCell:self orientation:(PSMTabBarOrientation)[(PSMTabBarControl *)_customControlView orientation]];
//NSRect cellFrame = [self frame];
// Determine the target coordinates to draw into
@@ -432,7 +432,7 @@
[image lockFocusFlipped:YES];
#endif
[self setFrame:tabDrawFrame];
- [(id <PSMTabStyle>)[(PSMTabBarControl *)_controlView style] drawTabCell:self];
+ [(id <PSMTabStyle>)[(PSMTabBarControl *)_customControlView style] drawTabCell:self];
[self setFrame:oldFrame];
[image unlockFocus];
@@ -515,10 +515,10 @@
if ([attribute isEqualToString: NSAccessibilityRoleAttribute]) {
attributeValue = NSAccessibilityButtonRole;
} else if ([attribute isEqualToString: NSAccessibilityHelpAttribute]) {
- if ([[[self controlView] delegate] respondsToSelector:@selector(accessibilityStringForTabView:objectCount:)]) {
+ if ([[[self customControlView] delegate] respondsToSelector:@selector(accessibilityStringForTabView:objectCount:)]) {
attributeValue = [NSString stringWithFormat:@"%@, %lu %@", [self stringValue],
(unsigned long)[self count],
- [[[self controlView] delegate] accessibilityStringForTabView:[[self controlView] tabView] objectCount:[self count]]];
+ [[[self customControlView] delegate] accessibilityStringForTabView:[[self customControlView] tabView] objectCount:[self count]]];
} else {
attributeValue = [self stringValue];
}
@@ -549,7 +549,7 @@
- (void)accessibilityPerformAction:(NSString *)action {
if ([action isEqualToString:NSAccessibilityPressAction]) {
// this tab was selected
- [_controlView tabClick:self];
+ [_customControlView tabClick:self];
}
}
diff --git a/Frameworks/PSMTabBar/PSMTabDragAssistant.m b/Frameworks/PSMTabBar/PSMTabDragAssistant.m
index db993b81..bb2d255a 100644
--- a/Frameworks/PSMTabBar/PSMTabDragAssistant.m
+++ b/Frameworks/PSMTabBar/PSMTabDragAssistant.m
@@ -367,7 +367,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
}
[[[self destinationTabBar] cells] replaceObjectAtIndex:destinationIndex withObject:[self draggedCell]];
- [[self draggedCell] setControlView:[self destinationTabBar]];
+ [[self draggedCell] setCustomControlView:[self destinationTabBar]];
// move actual NSTabViewItem
if ([self sourceTabBar] != [self destinationTabBar]) {
@@ -474,7 +474,7 @@ static PSMTabDragAssistant *sharedDragAssistant = nil;
//rebind the cell to the new control
[control bindPropertiesForCell:[self draggedCell] andTabViewItem:[[self draggedCell] representedObject]];
- [[self draggedCell] setControlView:control];
+ [[self draggedCell] setCustomControlView:control];
[[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]];
diff --git a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m
index 758ebe21..be14707d 100644
--- a/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMAdiumTabStyle.m
@@ -757,7 +757,7 @@
[bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMaxY(aRect))];
[bezier lineToPoint:NSMakePoint(NSMaxX(aRect), NSMinY(aRect))];
- if ([[cell controlView] frame].size.height < 2) {
+ if ([[cell customControlView] frame].size.height < 2) {
// special case of hidden control; need line across top of cell
[bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y + 0.5)];
[bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y + 0.5)];
@@ -854,7 +854,7 @@
[NSGraphicsContext restoreGraphicsState];
[shadow release];
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}
- (void)drawBackgroundInRect:(NSRect)rect
diff --git a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m
index 161dbe8d..a96724c0 100644
--- a/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMAquaTabStyle.m
@@ -340,7 +340,7 @@
else
currentTint = [cell controlTint];
- if (![[[cell controlView] window] isKeyWindow])
+ if (![[[cell customControlView] window] isKeyWindow])
currentTint = NSClearControlTint;
NSImage *bgImage;
@@ -381,7 +381,7 @@
[aquaDivider compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
}
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}
- (void)drawBackgroundInRect:(NSRect)rect
diff --git a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m
index 44f5b098..d81458f1 100644
--- a/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMCardTabStyle.m
@@ -423,7 +423,7 @@
}
}
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}
@@ -433,7 +433,7 @@
BOOL showsBaselineSeparator = NO;
/*
- NSToolbar *toolbar = [[[cell controlView] window] toolbar];
+ NSToolbar *toolbar = [[[cell customControlView] window] toolbar];
BOOL showsBaselineSeparator = (toolbar && [toolbar respondsToSelector:@selector(showsBaselineSeparator)] && [toolbar showsBaselineSeparator]);
*/
if (!showsBaselineSeparator) {
diff --git a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m
index ace79cf0..cdce6507 100644
--- a/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMMetalTabStyle.m
@@ -373,7 +373,7 @@
[bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width-2.5, aRect.origin.y+aRect.size.height)];
[bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y+aRect.size.height-1.5)];
[bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y)];
- if ([[cell controlView] frame].size.height < 2) {
+ if ([[cell customControlView] frame].size.height < 2) {
// special case of hidden control; need line across top of cell
[bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y+0.5)];
[bezier lineToPoint:NSMakePoint(aRect.origin.x+aRect.size.width, aRect.origin.y+0.5)];
@@ -442,7 +442,7 @@
[NSGraphicsContext restoreGraphicsState];
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}
diff --git a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
index 341b7b7b..5bc8aa3b 100644
--- a/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMSequelProTabStyle.m
@@ -748,7 +748,7 @@ typedef struct {
[NSGraphicsContext restoreGraphicsState];
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}
diff --git a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m b/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m
index dcf99545..882c1741 100644
--- a/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m
+++ b/Frameworks/PSMTabBar/Styles/PSMUnifiedTabStyle.m
@@ -312,7 +312,7 @@
{
NSRect cellFrame = [cell frame];
- NSToolbar *toolbar = [[[cell controlView] window] toolbar];
+ NSToolbar *toolbar = [[[cell customControlView] window] toolbar];
BOOL showsBaselineSeparator = (toolbar && [toolbar respondsToSelector:@selector(showsBaselineSeparator)] && [toolbar showsBaselineSeparator]);
if (!showsBaselineSeparator) {
cellFrame.origin.y += 1.0;
@@ -409,7 +409,7 @@
}
}
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
+ [self drawInteriorWithTabCell:cell inView:[cell customControlView]];
}