aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PSMTabBar/PSMTabBarCell.m
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/PSMTabBar/PSMTabBarCell.m
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/PSMTabBar/PSMTabBarCell.m')
-rw-r--r--Frameworks/PSMTabBar/PSMTabBarCell.m68
1 files changed, 34 insertions, 34 deletions
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];
}
}