adium 5856:6fdd4b9eebcd: Update PSMTabBarControl to github.com/d...

commits at adium.im commits at adium.im
Mon Apr 7 01:23:13 UTC 2014


details:	http://hg.adium.im/adium/rev/6fdd4b9eebcd
revision:	5856:6fdd4b9eebcd
branch:		adium-1.5.10
author:		Frank Dowsett <wixardy at adium.im>
date:		Sat Oct 26 23:01:44 2013 -0400

Update PSMTabBarControl to github.com/dorianj/PSMTabBarControl/commit/1c6eaae fixes #15822 and #16262 and #16426 and #16437.
(transplanted from b3e449c9e778e8308edf0b0d2b4873219ada45fa)
Subject: adium 5857:39020522478a: Fix some breakage with the updated PSMTabBar. The update fixes #16318.

details:	http://hg.adium.im/adium/rev/39020522478a
revision:	5857:39020522478a
branch:		adium-1.5.10
author:		Frank Dowsett <wixardy at adium.im>
date:		Sun Apr 06 21:21:01 2014 -0400

Fix some breakage with the updated PSMTabBar. The update fixes #16318.

diffs (truncated from 1350 to 1000 lines):

diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/NSBezierPath_AMShading.h
--- a/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/NSBezierPath_AMShading.h	Mon Jan 20 13:48:06 2014 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-//
-//  NSBezierPath_AMShading.h
-//  ------------------------
-//
-//  Created by Andreas on 2005-06-01.
-//  Copyright 2005 Andreas Mayer. All rights reserved.
-//
-//	based on http://www.cocoadev.com/index.pl?GradientFill
-
-
-#import <Cocoa/Cocoa.h>
-
- at interface NSBezierPath (AMShading)
-
-- (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor;
-- (void)customVerticalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor;
-
-- (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor;
-- (void)linearVerticalGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor;
-
-- (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor;
-
- at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/NSString_AITruncation.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/NSString_AITruncation.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,12 @@
+//
+//  NSString_AITruncation.h
+//  PSMTabBarControl
+//
+//  Created by Evan Schoenberg on 7/14/07.
+//
+
+#import <Cocoa/Cocoa.h>
+
+ at interface NSString (AITruncation)
+- (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length;
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMAdiumTabStyle.h
--- a/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMAdiumTabStyle.h	Mon Jan 20 13:48:06 2014 -0500
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMAdiumTabStyle.h	Sun Apr 06 21:21:01 2014 -0400
@@ -11,17 +11,19 @@
 
 @interface PSMAdiumTabStyle : NSObject <PSMTabStyle>
 {
-	NSImage *_closeButton, *_closeButtonDown, *_closeButtonOver;
-	NSImage *_closeDirtyButton, *_closeDirtyButtonDown, *_closeDirtyButtonOver;
-	NSImage *_addTabButtonImage, *_addTabButtonPressedImage, *_addTabButtonRolloverImage;
-	NSImage *_gradientImage;
-	
-    NSDictionary *_objectCountStringAttributes;
-    
-	PSMTabBarOrientation orientation;
-	PSMTabBarControl *tabBar;
-	
-	BOOL _drawsUnified, _drawsRight;
+	NSImage					*_closeButton;
+	NSImage					*_closeButtonDown;
+	NSImage					*_closeButtonOver;
+	NSImage					*_closeDirtyButton;
+	NSImage					*_closeDirtyButtonDown;
+	NSImage					*_closeDirtyButtonOver;
+	NSImage					*_addTabButtonImage;
+	NSImage					*_addTabButtonPressedImage;
+	NSImage					*_addTabButtonRolloverImage;
+	NSImage					*_gradientImage;
+
+	BOOL					_drawsUnified;
+	BOOL					_drawsRight;
 }
 
 - (void)loadImages;
@@ -31,8 +33,6 @@
 - (BOOL)drawsRight;
 - (void)setDrawsRight:(BOOL)value;
 
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
 - (void)encodeWithCoder:(NSCoder *)aCoder;
 - (id)initWithCoder:(NSCoder *)aDecoder;
 
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMAquaTabStyle.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMAquaTabStyle.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,35 @@
+//
+//  PSMAquaTabStyle.h
+//  PSMTabBarControl
+//
+//  Created by John Pannell on 2/17/06.
+//  Copyright 2006 Positive Spin Media. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "PSMTabStyle.h"
+
+ at interface PSMAquaTabStyle : NSObject <PSMTabStyle> {
+	NSImage									*aquaTabBg;
+	NSImage									*aquaTabBgDown;
+	NSImage									*aquaTabBgDownGraphite;
+	NSImage									*aquaTabBgDownNonKey;
+	NSImage									*aquaDividerDown;
+	NSImage									*aquaDivider;
+	NSImage									*aquaCloseButton;
+	NSImage									*aquaCloseButtonDown;
+	NSImage									*aquaCloseButtonOver;
+	NSImage									*aquaCloseDirtyButton;
+	NSImage									*aquaCloseDirtyButtonDown;
+	NSImage									*aquaCloseDirtyButtonOver;
+	NSImage									*_addTabButtonImage;
+	NSImage									*_addTabButtonPressedImage;
+	NSImage									*_addTabButtonRolloverImage;
+}
+
+- (void)loadImages;
+
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+- (id)initWithCoder:(NSCoder *)aDecoder;
+
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMCardTabStyle.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMCardTabStyle.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,30 @@
+//
+//  PSMCardTabStyle.h
+//  PSMTabBarControl
+//
+//  Created by Michael Monscheuer on 9/3/12.
+//
+//
+
+#import <Cocoa/Cocoa.h>
+#import "PSMTabStyle.h"
+
+ at interface PSMCardTabStyle : NSObject <PSMTabStyle>
+
+{
+    NSImage *cardCloseButton;
+    NSImage *cardCloseButtonDown;
+    NSImage *cardCloseButtonOver;
+    NSImage *cardCloseDirtyButton;
+    NSImage *cardCloseDirtyButtonDown;
+    NSImage *cardCloseDirtyButtonOver;
+    NSImage *_addTabButtonImage;
+    NSImage *_addTabButtonPressedImage;
+    NSImage *_addTabButtonRolloverImage;
+	    
+    CGFloat _leftMargin;
+}
+
+ at property (assign) CGFloat leftMarginForTabBarControl;
+
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMLiveChatTabStyle.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMLiveChatTabStyle.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,30 @@
+//
+//  PSMLiveChatTabStyle.h
+//  --------------------
+//
+//  Created by Keith Blount on 30/04/2006.
+//  Copyright 2006 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "PSMTabStyle.h"
+
+ at interface PSMLiveChatTabStyle : NSObject <PSMTabStyle> {
+	NSImage				*liveChatCloseButton;
+	NSImage				*liveChatCloseButtonDown;
+	NSImage				*liveChatCloseButtonOver;
+	NSImage				*liveChatCloseDirtyButton;
+	NSImage				*liveChatCloseDirtyButtonDown;
+	NSImage				*liveChatCloseDirtyButtonOver;
+	NSImage				*_addTabButtonImage;
+	NSImage				*_addTabButtonPressedImage;
+	NSImage				*_addTabButtonRolloverImage;
+
+	NSDictionary		*_objectCountStringAttributes;
+
+	CGFloat				_leftMargin;
+}
+
+ at property (assign) CGFloat leftMarginForTabBarControl;
+
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMMetalTabStyle.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMMetalTabStyle.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,29 @@
+//
+//  PSMMetalTabStyle.h
+//  PSMTabBarControl
+//
+//  Created by John Pannell on 2/17/06.
+//  Copyright 2006 Positive Spin Media. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "PSMTabStyle.h"
+
+ at interface PSMMetalTabStyle : NSObject <PSMTabStyle> {
+	NSImage					*metalCloseButton;
+	NSImage					*metalCloseButtonDown;
+	NSImage					*metalCloseButtonOver;
+	NSImage					*metalCloseDirtyButton;
+	NSImage					*metalCloseDirtyButtonDown;
+	NSImage					*metalCloseDirtyButtonOver;
+	NSImage					*_addTabButtonImage;
+	NSImage					*_addTabButtonPressedImage;
+	NSImage					*_addTabButtonRolloverImage;
+
+	NSDictionary			*_objectCountStringAttributes;
+}
+
+- (void)encodeWithCoder:(NSCoder *)aCoder;
+- (id)initWithCoder:(NSCoder *)aDecoder;
+
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMOverflowPopUpButton.h
--- a/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMOverflowPopUpButton.h	Mon Jan 20 13:48:06 2014 -0500
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMOverflowPopUpButton.h	Sun Apr 06 21:21:01 2014 -0400
@@ -10,12 +10,12 @@
 
 
 @interface PSMOverflowPopUpButton : NSPopUpButton {
-    NSImage         *_PSMTabBarOverflowPopUpImage;
-    NSImage         *_PSMTabBarOverflowDownPopUpImage;
-    BOOL            _down;
-	BOOL			_animatingAlternateImage;
-	NSTimer			*_animationTimer;
-	CGFloat			_animationValue;
+	NSImage									*_PSMTabBarOverflowPopUpImage;
+	NSImage									*_PSMTabBarOverflowDownPopUpImage;
+	BOOL									_down;
+	BOOL									_animatingAlternateImage;
+	NSTimer									*_animationTimer;
+	CGFloat									_animationValue;
 }
 
 //alternate image display
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMProgressIndicator.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMProgressIndicator.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,16 @@
+//
+//  PSMProgressIndicator.h
+//  PSMTabBarControl
+//
+//  Created by John Pannell on 2/23/06.
+//  Copyright 2006 Positive Spin Media. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+ at interface PSMProgressIndicator : NSProgressIndicator {
+}
+
+ at end
+
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMRolloverButton.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMRolloverButton.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,19 @@
+//
+//  PSMOverflowPopUpButton.h
+//  NetScrape
+//
+//  Created by John Pannell on 8/4/04.
+//  Copyright 2004 Positive Spin Media. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+ at interface PSMRolloverButton : NSButton {
+	NSImage	*_rolloverImage;
+	NSImage	*_usualImage;
+}
+
+ at property (retain) NSImage *usualImage;
+ at property (retain) NSImage *rolloverImage;
+
+ at end
\ No newline at end of file
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarCell.h
--- a/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarCell.h	Mon Jan 20 13:48:06 2014 -0500
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarCell.h	Sun Apr 06 21:21:01 2014 -0400
@@ -8,97 +8,121 @@
 
 #import <Cocoa/Cocoa.h>
 #import "PSMTabBarControl.h"
+#import "PSMProgressIndicator.h"
 
- at class PSMTabBarControl;
- at class PSMProgressIndicator;
+typedef enum PSMCloseButtonImageType : NSUInteger
+{
+    PSMCloseButtonImageTypeStandard = 0,
+    PSMCloseButtonImageTypeRollover,
+    PSMCloseButtonImageTypePressed,
+    PSMCloseButtonImageTypeDirty,
+    PSMCloseButtonImageTypeDirtyRollover,
+    PSMCloseButtonImageTypeDirtyPressed
+} PSMCloseButtonImageType;
+
+typedef enum PSMTabBarCellTrackingAreaType : NSUInteger
+{
+    PSMTabBarCellTrackingAreaCellFrameType   = 0,
+    PSMTabBarCellTrackingAreaCloseButtonType = 1
+} PSMTabBarCellTrackingAreaType;
 
 @interface PSMTabBarCell : NSActionCell {
-    // sizing
-    NSRect              _frame;
-    NSSize              _stringSize;
-    NSInteger                 _currentStep;
-    BOOL                _isPlaceholder;
-    
-    // state
-    NSInteger                 _tabState;
-    NSTrackingRectTag   _closeButtonTrackingTag;    // left side tracking, if dragging
-    NSTrackingRectTag   _cellTrackingTag;           // right side tracking, if dragging
-    BOOL                _closeButtonOver;
-    BOOL                _closeButtonPressed;
-    PSMProgressIndicator *_indicator;
-    BOOL                _isInOverflowMenu;
-    BOOL                _hasCloseButton;
-    BOOL                _isCloseButtonSuppressed;
-    BOOL                _hasIcon;
-	BOOL				_hasLargeImage;
-    NSInteger                 _count;
-	NSColor				*_countColor;
-    BOOL                _isEdited;
+	// sizing
+	NSRect					_frame;
+	NSSize					_attributedStringSize;
+	NSInteger				_currentStep;
+	BOOL					_isPlaceholder;
+
+	// state
+	PSMTabStateMask		    _tabState;
+	BOOL					_closeButtonOver;
+	BOOL					_closeButtonPressed;
+	PSMProgressIndicator	*_indicator;
+	BOOL					_isInOverflowMenu;
+	BOOL					_hasCloseButton;
+	BOOL					_isCloseButtonSuppressed;
+	BOOL					_hasIcon;
+	BOOL					_hasLargeImage;
+	NSInteger				_count;
+	NSColor                 *_countColor;
+	BOOL					_isEdited;
 }
 
-// creation/destruction
-- (id)initWithControlView:(PSMTabBarControl *)controlView;
-- (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView;
+ at property (assign) PSMTabStateMask tabState;
+ at property (assign) BOOL hasCloseButton;
+ at property (assign) BOOL hasIcon;
+ at property (assign) BOOL hasLargeImage;
+ at property (assign) NSInteger count;
+ at property (retain) NSColor *countColor;
+ at property (assign) BOOL isPlaceholder;
+ at property (assign) BOOL isEdited;
+ at property (assign) BOOL closeButtonPressed;
+
+#pragma mark Creation/Destruction
+- (id)init;
+- (id)initPlaceholderWithFrame:(NSRect) frame expanded:(BOOL) value inTabBarControl:(PSMTabBarControl *)tabBarControl;
 - (void)dealloc;
 
-// accessors
-- (id)controlView;
-- (void)setControlView:(id)view;
-- (NSTrackingRectTag)closeButtonTrackingTag;
-- (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag;
-- (NSTrackingRectTag)cellTrackingTag;
-- (void)setCellTrackingTag:(NSTrackingRectTag)tag;
+#pragma mark Accessors
+- (PSMTabBarControl *)controlView;
+- (void)setControlView:(PSMTabBarControl *)newControl;
 - (CGFloat)width;
 - (NSRect)frame;
 - (void)setFrame:(NSRect)rect;
-- (void)setStringValue:(NSString *)aString;
-- (NSSize)stringSize;
+- (NSSize)attributedStringSize;
 - (NSAttributedString *)attributedStringValue;
-- (NSInteger)tabState;
-- (void)setTabState:(NSInteger)state;
+- (NSAttributedString *)attributedObjectCountStringValue;
 - (NSProgressIndicator *)indicator;
 - (BOOL)isInOverflowMenu;
 - (void)setIsInOverflowMenu:(BOOL)value;
-- (BOOL)closeButtonPressed;
-- (void)setCloseButtonPressed:(BOOL)value;
 - (BOOL)closeButtonOver;
 - (void)setCloseButtonOver:(BOOL)value;
-- (BOOL)hasCloseButton;
-- (void)setHasCloseButton:(BOOL)set;
 - (void)setCloseButtonSuppressed:(BOOL)suppress;
 - (BOOL)isCloseButtonSuppressed;
-- (BOOL)hasIcon;
-- (void)setHasIcon:(BOOL)value;
-- (BOOL)hasLargeImage;
-- (void)setHasLargeImage:(BOOL)value;
-- (NSInteger)count;
-- (void)setCount:(NSInteger)value;
-- (NSColor *)countColor;
-- (void)setCountColor:(NSColor *)value;
-- (BOOL)isPlaceholder;
-- (void)setIsPlaceholder:(BOOL)value;
 - (NSInteger)currentStep;
 - (void)setCurrentStep:(NSInteger)value;
-- (BOOL)isEdited;
-- (void)setIsEdited:(BOOL)value;
 
-// component attributes
-- (NSRect)indicatorRectForFrame:(NSRect)cellFrame;
-- (NSRect)closeButtonRectForFrame:(NSRect)cellFrame;
+#pragma mark Providing Images
+- (NSImage *)closeButtonImageOfType:(PSMCloseButtonImageType)type;
+
+#pragma mark Determining Cell Size
+- (NSRect)drawingRectForBounds:(NSRect)theRect;
+- (NSRect)titleRectForBounds:(NSRect)theRect ;
+- (NSRect)iconRectForBounds:(NSRect)theRect;
+- (NSRect)largeImageRectForBounds:(NSRect)theRect;
+- (NSRect)indicatorRectForBounds:(NSRect)theRect;
+- (NSSize)objectCounterSize;
+- (NSRect)objectCounterRectForBounds:(NSRect)theRect;
+- (NSRect)closeButtonRectForBounds:(NSRect)theRect;
+
 - (CGFloat)minimumWidthOfCell;
 - (CGFloat)desiredWidthOfCell;
 
-// drawing
-- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
+#pragma mark Image Scaling
+- (NSSize)scaleImageWithSize:(NSSize)imageSize toFitInSize:(NSSize)canvasSize scalingType:(NSImageScaling)scalingType;
 
-// tracking the mouse
+#pragma mark Drawing
+- (BOOL)shouldDrawCloseButton;
+- (BOOL)shouldDrawObjectCounter;
+- (void)drawWithFrame:(NSRect) cellFrame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawInteriorWithFrame:(NSRect)cellFrame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawLargeImageWithFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawIconWithFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawTitleWithFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawObjectCounterWithFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawIndicatorWithFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)drawCloseButtonWithFrame:(NSRect)frame inTabBarControl:(PSMTabBarControl *)tabBarControl;
+
+#pragma mark Tracking Area Support
+- (void)addTrackingAreasForView:(NSView *)view inRect:(NSRect)cellFrame withUserInfo:(NSDictionary *)userInfo mouseLocation:(NSPoint)currentPoint;
 - (void)mouseEntered:(NSEvent *)theEvent;
 - (void)mouseExited:(NSEvent *)theEvent;
 
-// drag support
+#pragma mark Drag Support
+- (NSRect)draggingRect;
 - (NSImage *)dragImage;
 
-// archiving
+#pragma mark Archiving
 - (void)encodeWithCoder:(NSCoder *)aCoder;
 - (id)initWithCoder:(NSCoder *)aDecoder;
 
@@ -115,3 +139,5 @@
 - (NSImage *)largeImage;
 
 @end
+
+
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarControl.h
--- a/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarControl.h	Mon Jan 20 13:48:06 2014 -0500
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarControl.h	Sun Apr 06 21:21:01 2014 -0400
@@ -7,120 +7,148 @@
 //
 
 /*
- This view provides a control interface to manage a regular NSTabView.  It looks and works like the tabbed browsing interface of many popular browsers.
+   This view provides a control interface to manage a regular NSTabView.  It looks and works like the tabbed browsing interface of many popular browsers.
  */
 
 #import <Cocoa/Cocoa.h>
 
-#define PSMTabDragDidEndNotification @"PSMTabDragDidEndNotification"
-#define PSMTabDragDidBeginNotification @"PSMTabDragDidBeginNotification"
+#define PSMTabDragDidEndNotification		@ "PSMTabDragDidEndNotification"
+#define PSMTabDragDidBeginNotification	@ "PSMTabDragDidBeginNotification"
 
-#define kPSMTabBarControlHeight 22
+#define kPSMTabBarControlHeight             22
 // internal cell border
-#define MARGIN_X        6
-#define MARGIN_Y        3
+#define MARGIN_X							6
+#define MARGIN_Y							3
 // padding between objects
-#define kPSMTabBarCellPadding 4
+#define kPSMTabBarCellPadding				4
 // fixed size objects
-#define kPSMMinimumTitleWidth 30
-#define kPSMTabBarIndicatorWidth 16.0f
-#define kPSMTabBarIconWidth 16.0f
-#define kPSMHideAnimationSteps 3.0f
+#define kPSMMinimumTitleWidth				30
+#define kPSMTabBarIndicatorWidth			16.0
+#define kPSMTabBarIconWidth					16.0
+#define kPSMHideAnimationSteps				3.0
+#define kPSMObjectCounterMinWidth           20.0
+#define kPSMObjectCounterRadius             7.0
+#define kPSMTabBarControlSourceListHeight   28
 
 // Value used in _currentStep to indicate that resizing operation is not in progress
-#define kPSMIsNotBeingResized -1
+#define kPSMIsNotBeingResized				-1
 
 // Value used in _currentStep when a resizing operation has just been started
-#define kPSMStartResizeAnimation 0
+#define kPSMStartResizeAnimation			0
 
- at class PSMOverflowPopUpButton, PSMRolloverButton, PSMTabBarCell, PSMTabBarController;
+ at class PSMOverflowPopUpButton;
+ at class PSMRolloverButton;
+ at class PSMTabBarCell;
+ at class PSMTabBarController;
 @protocol PSMTabStyle;
 
-typedef enum {
+typedef enum PSMTabBarOrientation : NSUInteger {
 	PSMTabBarHorizontalOrientation,
 	PSMTabBarVerticalOrientation
 } PSMTabBarOrientation;
 
-typedef enum {
+typedef enum PSMTabBarTearOffStyle : NSUInteger {
 	PSMTabBarTearOffAlphaWindow,
 	PSMTabBarTearOffMiniwindow
 } PSMTabBarTearOffStyle;
 
-enum {
-    PSMTab_SelectedMask                 = 1 << 1,
-    PSMTab_LeftIsSelectedMask       = 1 << 2,
-    PSMTab_RightIsSelectedMask          = 1 << 3,
-    PSMTab_PositionLeftMask     = 1 << 4,
-    PSMTab_PositionMiddleMask       = 1 << 5,
-    PSMTab_PositionRightMask        = 1 << 6,
-    PSMTab_PositionSingleMask       = 1 << 7
-};
+typedef enum PSMTabStateMask : NSUInteger {
+	PSMTab_SelectedMask				= 1 << 1,
+	PSMTab_LeftIsSelectedMask		= 1 << 2,
+	PSMTab_RightIsSelectedMask		= 1 << 3,
+	PSMTab_PositionLeftMask			= 1 << 4,
+	PSMTab_PositionMiddleMask		= 1 << 5,
+	PSMTab_PositionRightMask		= 1 << 6,
+	PSMTab_PositionSingleMask		= 1 << 7,
+} PSMTabStateMask;
+
+ at protocol PSMTabBarControlDelegate;
 
 @interface PSMTabBarControl : NSControl {
-    
-    // control basics
-    NSMutableArray              *_cells;                    // the cells that draw the tabs
-    IBOutlet NSTabView          *tabView;                   // the tab view being navigated
-    PSMOverflowPopUpButton      *_overflowPopUpButton;      // for too many tabs
-    PSMRolloverButton           *_addTabButton;
-    PSMTabBarController			*_controller;
+												
+	// control basics
+	NSMutableArray							*_cells;								// the cells that draw the tabs
+	IBOutlet NSTabView						*tabView;								// the tab view being navigated
+	PSMOverflowPopUpButton					*_overflowPopUpButton;				// for too many tabs
+	PSMRolloverButton						*_addTabButton;
+	PSMTabBarController						*_controller;
 
-    // Spring-loading.
-    NSTimer						*_springTimer;
-    NSTabViewItem				*_tabViewItemWithSpring;
-	
-    // drawing style
-    id<PSMTabStyle>             style;
-    BOOL                        _canCloseOnlyTab;
-	BOOL						_disableTabClose;
-    BOOL                        _hideForSingleTab;
-    BOOL                        _showAddTabButton;
-    BOOL                        _sizeCellsToFit;
-    BOOL                        _useOverflowMenu;
-	BOOL						_alwaysShowActiveTab;
-	BOOL						_allowsScrubbing;
-	NSInteger							_resizeAreaCompensation;
-	PSMTabBarOrientation		_orientation;
-	BOOL						_automaticallyAnimates;
-	NSTimer						*_animationTimer;
-	PSMTabBarTearOffStyle		_tearOffStyle;
-	
+	// Spring-loading.
+	NSTimer									*_springTimer;
+	NSTabViewItem							*_tabViewItemWithSpring;
+
+	// drawing style
+	id<PSMTabStyle>							style;
+	BOOL									_canCloseOnlyTab;
+	BOOL									_disableTabClose;
+	BOOL									_hideForSingleTab;
+	BOOL									_showAddTabButton;
+	BOOL									_sizeCellsToFit;
+	BOOL									_useOverflowMenu;
+	BOOL									_alwaysShowActiveTab;
+	BOOL									_allowsScrubbing;
+	NSInteger								_resizeAreaCompensation;
+	PSMTabBarOrientation					_orientation;
+	BOOL									_automaticallyAnimates;
+	NSTimer									*_animationTimer;
+	PSMTabBarTearOffStyle					_tearOffStyle;
+
 	// behavior
-	BOOL						_allowsBackgroundTabClosing;
-	BOOL						_selectsTabsOnMouseDown;
-	
+	BOOL									_allowsBackgroundTabClosing;
+	BOOL									_selectsTabsOnMouseDown;
+
 	// vertical tab resizing
-	BOOL						_allowsResizing;
-	BOOL						_resizing;
-	
-    // cell width
-    NSInteger                         _cellMinWidth;
-    NSInteger                         _cellMaxWidth;
-    NSInteger                         _cellOptimumWidth;
-    
-    // animation for hide/show
-    NSInteger                         _currentStep;
-    BOOL                        _isHidden;
-    IBOutlet id                 partnerView;                // gets resized when hide/show
-    BOOL                        _awakenedFromNib;
-	NSInteger							_tabBarWidth;
-    NSTimer						*_showHideAnimationTimer;
+	BOOL									_allowsResizing;
+	BOOL									_resizing;
 
-    // drag and drop
-    NSEvent                     *_lastMouseDownEvent;      // keep this for dragging reference
-	BOOL						_didDrag;
-	BOOL						_closeClicked;
-    
-    // MVC help
-    IBOutlet id                 delegate;
+	// cell width
+	NSInteger								_cellMinWidth;
+	NSInteger								_cellMaxWidth;
+	NSInteger								_cellOptimumWidth;
+
+	// animation for hide/show
+	NSInteger								_currentStep;
+	BOOL									_isHidden;
+	IBOutlet id								partnerView;							// gets resized when hide/show
+	BOOL									_awakenedFromNib;
+	NSInteger								_tabBarWidth;
+	NSTimer									*_showHideAnimationTimer;
+
+	// drag and drop
+	NSEvent									*_lastMouseDownEvent;				// keep this for dragging reference
+	BOOL									_didDrag;
+	BOOL									_closeClicked;
+
+	// MVC help
+	IBOutlet id<PSMTabBarControlDelegate>	delegate;
 }
 
-// control characteristics
+#pragma mark Control Characteristics
+
 + (NSBundle *)bundle;
 - (CGFloat)availableCellWidth;
+- (CGFloat)availableCellHeight;
 - (NSRect)genericCellRect;
+- (BOOL)isWindowActive;
 
-// control configuration
+#pragma mark Style Class Registry
+
++ (void)registerDefaultTabStyleClasses;
++ (void)registerTabStyleClass:(Class <PSMTabStyle>)aStyleClass;
++ (void)unregisterTabStyleClass:(Class <PSMTabStyle>)aStyleClass;
++ (NSArray *)registeredTabStyleClasses;
++ (Class <PSMTabStyle>)registeredClassForStyleName:(NSString *)name;
+
+#pragma mark Cell Management (KVC Compliant)
+
+- (NSArray *)cells;
+- (void)addCell:(PSMTabBarCell *)aCell;
+- (void)insertCell:(PSMTabBarCell *)aCell atIndex:(NSUInteger)index;
+- (void)removeCellAtIndex:(NSUInteger)index;
+- (void)replaceCellAtIndex:(NSUInteger)index withCell:(PSMTabBarCell *)aCell;
+
+#pragma mark Control Configuration
+
 - (PSMTabBarOrientation)orientation;
 - (void)setOrientation:(PSMTabBarOrientation)value;
 - (BOOL)canCloseOnlyTab;
@@ -159,26 +187,47 @@
 - (void)setAllowsScrubbing:(BOOL)value;
 - (PSMTabBarTearOffStyle)tearOffStyle;
 - (void)setTearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle;
+- (CGFloat)heightOfTabCells;
 
-// accessors
+#pragma mark Accessors 
+
 - (NSTabView *)tabView;
 - (void)setTabView:(NSTabView *)view;
-- (id)delegate;
-- (void)setDelegate:(id)object;
+- (id<PSMTabBarControlDelegate>)delegate;
+- (void)setDelegate:(id<PSMTabBarControlDelegate>)object;
 - (id)partnerView;
 - (void)setPartnerView:(id)view;
 
-// the buttons
+#pragma mark -
+#pragma mark Determining Sizes
+
+- (NSSize)addTabButtonSize;
+- (NSRect)addTabButtonRect;
+- (NSSize)overflowButtonSize;
+- (NSRect)overflowButtonRect;
+
+#pragma mark -
+#pragma mark Determining Margins
+
+- (CGFloat)rightMargin;
+- (CGFloat)leftMargin;
+- (CGFloat)topMargin;
+- (CGFloat)bottomMargin;
+
+#pragma mark The Buttons
+
 - (PSMRolloverButton *)addTabButton;
 - (PSMOverflowPopUpButton *)overflowPopUpButton;
 
-// tab information
+#pragma mark Tab Information
+
 - (NSMutableArray *)representedTabViewItems;
 - (NSInteger)numberOfVisibleTabs;
 - (PSMTabBarCell *)lastVisibleTab;
 
-// special effects
-- (void)hideTabBar:(BOOL)hide animate:(BOOL)animate;
+#pragma mark Special Effects
+
+- (void)hideTabBar:(BOOL) hide animate:(BOOL)animate;
 - (BOOL)isTabBarHidden;
 - (BOOL)isAnimating;
 
@@ -188,20 +237,26 @@
 
 @end
 
+ at protocol PSMTabBarControlDelegate <NSTabViewDelegate>
 
- at interface NSObject (TabBarControlDelegateMethods)
+ at optional
 
 //Standard NSTabView methods
 - (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem;
+- (void)tabView:(NSTabView *)aTabView willCloseTabViewItem:(NSTabViewItem *)tabViewItem;
 - (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem;
+- (void)tabView:(NSTabView *)aTabView didDetachTabViewItem:(NSTabViewItem *)tabViewItem;
 
 //"Spring-loaded" tabs methods
 - (NSArray *)allowedDraggedTypesForTabView:(NSTabView *)aTabView;
-- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>)draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem;
+- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>) draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem;
 
 //Contextual menu method
 - (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem;
 
+//Event method
+- (void)tabView:(NSTabView *)aTabView tabViewItem:(NSTabViewItem *)tabViewItem event:(NSEvent *)event;
+
 //Drag and drop methods
 - (BOOL)tabView:(NSTabView *)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl;
 - (BOOL)tabView:(NSTabView *)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl;
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarController.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabBarController.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,29 @@
+//
+//  PSMTabBarController.h
+//  PSMTabBarControl
+//
+//  Created by Kent Sutherland on 11/24/06.
+//  Copyright 2006 Kent Sutherland. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+ at class PSMTabBarControl, PSMTabBarCell;
+
+ at interface PSMTabBarController : NSObject <NSMenuDelegate>
+{
+	PSMTabBarControl	*_control;
+	NSMutableArray		*_cellFrames;
+	NSMenu				*_overflowMenu;
+}
+
+- (id)initWithTabBarControl:(PSMTabBarControl *)control;
+
+- (NSMenu *)overflowMenu;
+- (NSRect)cellFrameAtIndex:(NSInteger)index;
+
+- (void)setSelectedCell:(PSMTabBarCell *)cell;
+
+- (void)layoutCells;
+
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragAssistant.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragAssistant.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,90 @@
+//
+//  PSMTabDragAssistant.h
+//  PSMTabBarControl
+//
+//  Created by John Pannell on 4/10/06.
+//  Copyright 2006 Positive Spin Media. All rights reserved.
+//
+
+/*
+   This class is a sigleton that manages the details of a tab drag and drop.  The details were beginning to overwhelm me when keeping all of this in the control and cells :-)
+ */
+
+#import <Cocoa/Cocoa.h>
+#import "PSMTabBarControl.h"
+
+#define kPSMTabDragAnimationSteps 8
+
+ at class PSMTabBarCell, PSMTabDragWindowController;
+
+ at interface PSMTabDragAssistant : NSObject {
+	PSMTabBarControl					*_sourceTabBar;
+	PSMTabBarControl					*_destinationTabBar;
+	NSMutableSet						*_participatingTabBars;
+	PSMTabBarCell						*_draggedCell;
+	NSInteger							_draggedCellIndex;					// for snap back
+	BOOL								_isDragging;
+
+	// Support for dragging into new windows
+	PSMTabDragWindowController		*_draggedTab;
+	PSMTabDragWindowController		*_draggedView;
+	NSSize								_dragWindowOffset;
+	NSTimer							*_fadeTimer;
+	BOOL								_centersDragWindows;
+	PSMTabBarTearOffStyle			_currentTearOffStyle;
+
+	// Animation
+	NSTimer							*_animationTimer;
+	NSMutableArray					*_sineCurveWidths;
+	NSPoint							_currentMouseLoc;
+	PSMTabBarCell						*_targetCell;
+}
+
+// Creation/destruction
++ (PSMTabDragAssistant *)sharedDragAssistant;
+
+// Accessors
+- (PSMTabBarControl *)sourceTabBar;
+- (void)setSourceTabBar:(PSMTabBarControl *)tabBar;
+- (PSMTabBarControl *)destinationTabBar;
+- (void)setDestinationTabBar:(PSMTabBarControl *)tabBar;
+- (PSMTabBarCell *)draggedCell;
+- (void)setDraggedCell:(PSMTabBarCell *)cell;
+- (NSInteger)draggedCellIndex;
+- (void)setDraggedCellIndex:(NSInteger)value;
+- (BOOL)isDragging;
+- (void)setIsDragging:(BOOL)value;
+- (NSPoint)currentMouseLoc;
+- (void)setCurrentMouseLoc:(NSPoint)point;
+- (PSMTabBarCell *)targetCell;
+- (void)setTargetCell:(PSMTabBarCell *)cell;
+
+// Functionality
+- (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBarControl:(PSMTabBarControl *)tabBarControl withMouseDownEvent:(NSEvent *)event;
+- (void)draggingEnteredTabBarControl:(PSMTabBarControl *)tabBarControl atPoint:(NSPoint)mouseLoc;
+- (void)draggingUpdatedInTabBarControl:(PSMTabBarControl *)tabBarControl atPoint:(NSPoint)mouseLoc;
+- (void)draggingExitedTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)performDragOperation;
+- (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation;
+- (void)finishDrag;
+
+- (void)draggingBeganAt:(NSPoint)aPoint;
+- (void)draggingMovedTo:(NSPoint)aPoint;
+
+// Animation
+- (void)animateDrag:(NSTimer *)timer;
+- (void)calculateDragAnimationForTabBarControl:(PSMTabBarControl *)tabBarControl;
+
+// Placeholder
+- (void)distributePlaceholdersInTabBarControl:(PSMTabBarControl *)tabBarControl withDraggedCell:(PSMTabBarCell *)cell;
+- (void)distributePlaceholdersInTabBarControl:(PSMTabBarControl *)tabBarControl;
+- (void)removeAllPlaceholdersFromTabBarControl:(PSMTabBarControl *)tabBarControl;
+
+ at end
+
+void CGContextCopyWindowCaptureContentsToRect(void *grafport, CGRect rect, NSInteger cid, NSInteger wid, NSInteger zero);
+OSStatus CGSSetWindowTransform(NSInteger cid, NSInteger wid, CGAffineTransform transform);
+
+ at interface NSApplication (CoreGraphicsUndocumented)
+- (NSInteger)contextID;
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragView.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragView.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,21 @@
+//
+//  PSMTabDragView.h
+//  PSMTabBarControl
+//
+//  Created by Kent Sutherland on 6/17/07.
+//  Copyright 2007 Kent Sutherland. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+ at interface PSMTabDragView : NSView {
+	NSImage					*_image;
+	NSImage					*_alternateImage;
+	CGFloat					_alpha;
+}
+- (void)setFadeValue:(CGFloat)value;
+- (NSImage *)image;
+- (void)setImage:(NSImage *)image;
+- (NSImage *)alternateImage;
+- (void)setAlternateImage:(NSImage *)image;
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragWindow.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragWindow.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,20 @@
+//
+//  PSMTabDragWindow.h
+//  PSMTabBarControl
+//
+//  Created by Kent Sutherland on 6/1/06.
+//  Copyright 2006 Kent Sutherland. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+ at class PSMTabDragView;
+
+ at interface PSMTabDragWindow : NSWindow {
+	PSMTabDragView					*_dragView;
+}
++ (PSMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask;
+
+- (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask;
+- (PSMTabDragView *)dragView;
+ at end
diff -r b484898a0d0d -r 39020522478a Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragWindowController.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Frameworks/PSMTabBarControl.framework/Versions/A/Headers/PSMTabDragWindowController.h	Sun Apr 06 21:21:01 2014 -0400
@@ -0,0 +1,33 @@
+//
+//  PSMTabDragWindowController.h
+//  PSMTabBarControl
+//
+//  Created by Kent Sutherland on 6/18/07.
+//  Copyright 2007 Kent Sutherland. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+#import "PSMTabBarControl.h"
+
+#define kPSMTabDragWindowAlpha 0.75
+#define kPSMTabDragAlphaInterval 0.15
+
+ at class PSMTabDragView;
+
+ at interface PSMTabDragWindowController : NSWindowController {
+	PSMTabBarTearOffStyle				_tearOffStyle;
+	PSMTabDragView						*_view;
+	NSAnimation							*_animation;
+	NSTimer								*_timer;




More information about the commits mailing list