Skip to content
Browse files

Re-organized files & Uncrustified all source

  • Loading branch information...
1 parent c3aefab commit ffd1a8fec71837f2c5be5f5e88716f2d662ade17 @robertjpayne robertjpayne committed Apr 27, 2010
Showing with 7,856 additions and 8,534 deletions.
  1. +1 −1 .gitignore
  2. +0 −21 DemoAppController.m
  3. +0 −95 DemoFakeModel.m
  4. +0 −586 DemoWindowController.m
  5. +0 −39 PSMAdiumTabStyle.h
  6. +0 −38 PSMAquaTabStyle.h
  7. +0 −572 PSMAquaTabStyle.m
  8. +0 −34 PSMMetalTabStyle.h
  9. +0 −651 PSMMetalTabStyle.m
  10. +0 −183 PSMRolloverButton.m
  11. +0 −535 PSMTabBarCell.m
  12. +1 −0 PSMTabBarControl.framework/PSMTabBarControl
  13. +1 −0 PSMTabBarControl.framework/Resources
  14. BIN PSMTabBarControl.framework/Versions/A/PSMTabBarControl
  15. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/32x32_log.png
  16. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/32x32cancel.png
  17. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AdiumGradient.png
  18. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabCloseDirty_Front.png
  19. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabCloseDirty_Front_Pressed.png
  20. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabCloseDirty_Front_Rollover.png
  21. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabClose_Front.png
  22. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabClose_Front_Pressed.png
  23. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabClose_Front_Rollover.png
  24. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabNew.png
  25. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabNewPressed.png
  26. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabNewRollover.png
  27. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabsBackground.png
  28. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabsDown.png
  29. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabsDownGraphite.png
  30. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabsDownNonKey.png
  31. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabsSeparator.png
  32. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/AquaTabsSeparatorDown.png
  33. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/Folder.png
  34. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/Globe.png
  35. +22 −0 PSMTabBarControl.framework/Versions/A/Resources/Info.plist
  36. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabClose_Dirty.png
  37. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabClose_Dirty_Pressed.png
  38. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabClose_Dirty_Rollover.png
  39. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabClose_Front.png
  40. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabClose_Front_Pressed.png
  41. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabClose_Front_Rollover.png
  42. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabControlRep.png
  43. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabIcon.png
  44. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabNewMetal.png
  45. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabNewMetalPressed.png
  46. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/TabNewMetalRollover.png
  47. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/Warning.png
  48. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/largeImage.png
  49. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/mater_large.jpg
  50. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/mcqueen_large.jpg
  51. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/overflowImage.png
  52. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/overflowImagePressed.png
  53. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/pi.png
  54. 0 { → PSMTabBarControl.framework/Versions/A/Resources}/sally_large.jpg
  55. +1 −0 PSMTabBarControl.framework/Versions/Current
  56. BIN PSMTabBarControl.ibplugin/Contents/Frameworks/PSMTabBarControl.framework/Versions/A/PSMTabBarControl
  57. BIN PSMTabBarControl.ibplugin/Contents/MacOS/PSMTabBarControl
  58. BIN PSMTabBarControl.ibplugin/Contents/Resources/PSMTabBarControlInspector.nib
  59. +0 −2,043 PSMTabBarControl.m
  60. +0 −1,000 PSMTabBarControl.xcodeproj/robertpayne.pbxuser
  61. +0 −30 PSMTabBarControlInspector.h
  62. +0 −663 PSMTabBarController.m
  63. +0 −30 PSMUnifiedTabStyle.h
  64. +0 −599 PSMUnifiedTabStyle.m
  65. BIN Source/32x32_log.png
  66. BIN Source/32x32cancel.png
  67. BIN Source/AdiumGradient.png
  68. BIN Source/AquaTabCloseDirty_Front.png
  69. BIN Source/AquaTabCloseDirty_Front_Pressed.png
  70. BIN Source/AquaTabCloseDirty_Front_Rollover.png
  71. BIN Source/AquaTabClose_Front.png
  72. BIN Source/AquaTabClose_Front_Pressed.png
  73. BIN Source/AquaTabClose_Front_Rollover.png
  74. BIN Source/AquaTabNew.png
  75. BIN Source/AquaTabNewPressed.png
  76. BIN Source/AquaTabNewRollover.png
  77. BIN Source/AquaTabsBackground.png
  78. BIN Source/AquaTabsDown.png
  79. BIN Source/AquaTabsDownGraphite.png
  80. BIN Source/AquaTabsDownNonKey.png
  81. BIN Source/AquaTabsSeparator.png
  82. BIN Source/AquaTabsSeparatorDown.png
  83. 0 { → Source}/DemoAppController.h
  84. +21 −0 Source/DemoAppController.m
  85. +5 −5 { → Source}/DemoFakeModel.h
  86. +82 −0 Source/DemoFakeModel.m
  87. +41 −41 { → Source}/DemoWindow.xib
  88. +26 −26 { → Source}/DemoWindowController.h
  89. +536 −0 Source/DemoWindowController.m
  90. 0 { → Source}/English.lproj/InfoPlist.strings
  91. 0 { → Source}/English.lproj/PSMTabBarControlInspector.xib
  92. 0 { → Source}/English.lproj/PSMTabBarControlLibrary.nib/designable.nib
  93. 0 { → Source}/English.lproj/PSMTabBarControlLibrary.nib/keyedobjects.nib
  94. BIN Source/Folder.png
  95. BIN Source/Globe.png
  96. 0 { → Source}/Info.plist
  97. 0 { → Source}/Japanese.lproj/InfoPlist.strings
  98. 0 { → Source}/Japanese.lproj/Inspector.xib
  99. 0 { → Source}/Japanese.lproj/Library.nib/designable.nib
  100. 0 { → Source}/Japanese.lproj/Library.nib/keyedobjects.nib
  101. +2 −2 { → Source}/NSBezierPath_AMShading.h
  102. +39 −47 { → Source}/NSBezierPath_AMShading.m
  103. 0 { → Source}/NSString_AITruncation.h
  104. +6 −8 { → Source}/NSString_AITruncation.m
  105. +46 −0 Source/PSMAdiumTabStyle.h
  106. +416 −457 { → Source}/PSMAdiumTabStyle.m
  107. +38 −0 Source/PSMAquaTabStyle.h
  108. +552 −0 Source/PSMAquaTabStyle.m
  109. +34 −0 Source/PSMMetalTabStyle.h
  110. +631 −0 Source/PSMMetalTabStyle.m
  111. +6 −6 { → Source}/PSMOverflowPopUpButton.h
  112. +59 −68 { → Source}/PSMOverflowPopUpButton.m
  113. +0 −8 { → Source}/PSMProgressIndicator.h
  114. +14 −8 { → Source}/PSMProgressIndicator.m
  115. +4 −5 { → Source}/PSMRolloverButton.h
  116. +168 −0 Source/PSMRolloverButton.m
  117. +24 −25 { → Source}/PSMTabBarCell.h
  118. +489 −0 Source/PSMTabBarCell.m
  119. 0 { → Source}/PSMTabBarControl-Info.plist
  120. 0 { → Source}/PSMTabBarControl.classdescription
  121. +80 −77 { → Source}/PSMTabBarControl.h
  122. +1,926 −0 Source/PSMTabBarControl.m
  123. 0 { → Source}/PSMTabBarControl.xcodeproj/default.pbxuser
  124. +31 −15 { → Source}/PSMTabBarControl.xcodeproj/project.pbxproj
  125. +29 −34 { → Source}/PSMTabBarControl.xcodeproj/robertpayne.mode1v3
  126. +721 −0 Source/PSMTabBarControl.xcodeproj/robertpayne.pbxuser
  127. 0 { → Source}/PSMTabBarControlDemo-Info.plist
  128. 0 { → Source}/PSMTabBarControlDemo.xib
  129. +29 −0 Source/PSMTabBarControlInspector.h
  130. +22 −22 { → Source}/PSMTabBarControlInspector.m
  131. +4 −4 { → Source}/PSMTabBarControlIntegration.m
  132. 0 { → Source}/PSMTabBarControlPlugin.h
  133. +3 −3 { → Source}/PSMTabBarControlPlugin.m
  134. 0 { → Source}/PSMTabBarControl_Prefix.pch
  135. +7 −6 { → Source}/PSMTabBarController.h
  136. +643 −0 Source/PSMTabBarController.m
  137. +23 −22 { → Source}/PSMTabDragAssistant.h
  138. +405 −442 { → Source}/PSMTabDragAssistant.m
  139. +3 −2 { → Source}/PSMTabDragView.h
  140. +10 −16 { → Source}/PSMTabDragView.m
  141. +1 −1 { → Source}/PSMTabDragWindow.h
  142. +10 −13 { → Source}/PSMTabDragWindow.m
  143. +8 −8 { → Source}/PSMTabDragWindowController.h
  144. +29 −37 { → Source}/PSMTabDragWindowController.m
  145. +3 −3 { → Source}/PSMTabStyle.h
  146. +29 −0 Source/PSMUnifiedTabStyle.h
  147. +573 −0 Source/PSMUnifiedTabStyle.m
  148. 0 { → Source}/README
  149. BIN Source/TabClose_Dirty.png
  150. BIN Source/TabClose_Dirty_Pressed.png
  151. BIN Source/TabClose_Dirty_Rollover.png
  152. BIN Source/TabClose_Front.png
  153. BIN Source/TabClose_Front_Pressed.png
  154. BIN Source/TabClose_Front_Rollover.png
  155. BIN Source/TabControlRep.png
  156. BIN Source/TabIcon.png
  157. BIN Source/TabNewMetal.png
  158. BIN Source/TabNewMetalPressed.png
  159. BIN Source/TabNewMetalRollover.png
  160. BIN Source/Warning.png
  161. +2 −3 { → Source}/demo_main.m
  162. BIN Source/largeImage.png
  163. BIN Source/mater_large.jpg
  164. BIN Source/mcqueen_large.jpg
  165. BIN Source/overflowImage.png
  166. BIN Source/overflowImagePressed.png
  167. BIN Source/pi.png
  168. BIN Source/sally_large.jpg
View
2 .gitignore
@@ -1 +1 @@
-build/
+Source/build/
View
21 DemoAppController.m
@@ -1,21 +0,0 @@
-#import "DemoAppController.h"
-#import "DemoWindowController.h"
-
-
-@implementation DemoAppController
-
-- (void)applicationDidFinishLaunching:(NSNotification *)pNotification {
- [self newWindow:self];
- [self newWindow:self];
- NSRect frontFrame = [[NSApp keyWindow] frame];
- frontFrame.origin.x += 400;
- [[NSApp keyWindow] setFrame:frontFrame display:YES];
-}
-- (IBAction)newWindow:(id)sender {
- // put up a window
- DemoWindowController *newWindow = [[DemoWindowController alloc] initWithWindowNibName:@"DemoWindow"];
- [newWindow showWindow:self];
- [newWindow addDefaultTabs];
-}
-
-@end
View
95 DemoFakeModel.m
@@ -1,95 +0,0 @@
-//
-// FakeModel.m
-// TabBarControl
-//
-// Created by John Pannell on 12/19/05.
-// Copyright 2005 Positive Spin Media. All rights reserved.
-//
-
-#import "DemoFakeModel.h"
-
-
-@implementation DemoFakeModel
-
-- (id)init
-{
- if ( (self == [super init]) ) {
- _isProcessing = NO;
- _icon = nil;
- _iconName = nil;
- _objectCount = 2;
- _isEdited = NO;
- }
- return self;
-}
-
-
-// accessors
-- (BOOL)isProcessing
-{
- return _isProcessing;
-}
-
-- (void)setIsProcessing:(BOOL)value
-{
- _isProcessing = value;
-}
-
-- (NSImage *)icon
-{
- return _icon;
-}
-
-- (void)setIcon:(NSImage *)icon
-{
- [icon retain];
- [_icon release];
- _icon = icon;
-}
-
-- (NSString *)iconName
-{
- return _iconName;
-}
-
-- (void)setIconName:(NSString *)iconName
-{
- [iconName retain];
- [_iconName release];
- _iconName = iconName;
-}
-
-- (NSInteger)objectCount
-{
- return _objectCount;
-}
-
-- (void)setObjectCount:(NSInteger)value
-{
- _objectCount = value;
-}
-
-- (BOOL)isEdited
-{
- return _isEdited;
-}
-
-- (void)setIsEdited:(BOOL)value
-{
- _isEdited = value;
-}
-
-
-- (NSImage *)largeImage
-{
- return [NSImage imageNamed:@"largeImage"];
-}
-
-- (void)setLargeImage:(NSImage *)icon
-{
- [icon retain];
- [_icon release];
- _icon = icon;
-}
-
-@end
View
586 DemoWindowController.m
@@ -1,586 +0,0 @@
-//
-// WindowController.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 4/6/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import "DemoWindowController.h"
-#import "DemoFakeModel.h"
-#import "PSMTabBarControl.h"
-#import "PSMTabStyle.h"
-
-@interface DemoWindowController (PRIVATE)
-- (void)configureTabBarInitially;
-@end
-
-@implementation DemoWindowController
-
-- (void)awakeFromNib
-{
- [[NSUserDefaults standardUserDefaults] registerDefaults:
- [NSDictionary dictionaryWithObjectsAndKeys:
- @"Metal", @"Style",
- @"Horizontal", @"Orientation",
- @"Alpha Window", @"Tear-Off",
- @"100", @"TabMinWidth",
- @"280", @"TabMaxWidth",
- @"130", @"TabOptimalWidth",
- [NSNumber numberWithBool:YES], @"UseOverflowMenu",
- nil]];
-
- // toolbar
- NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"DemoToolbar"];
- [toolbar setDelegate:self];
- [toolbar setAllowsUserCustomization:YES];
- [toolbar setAutosavesConfiguration:YES];
- SInt32 MacVersion;
- if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr) {
- if (MacVersion >= 0x1040) {
- // this call is Tiger only
- [toolbar setShowsBaselineSeparator:NO];
- }
- }
- [[self window] setToolbar:[toolbar autorelease]];
-
- // hook up add tab button
- [[tabBar addTabButton] setTarget:self];
- [[tabBar addTabButton] setAction:@selector(addNewTab:)];
-
- // remove any tabs present in the nib
- NSArray *existingItems = [tabView tabViewItems];
- NSEnumerator *e = [existingItems objectEnumerator];
- NSTabViewItem *item;
- while (item = [e nextObject]) {
- [tabView removeTabViewItem:item];
- }
-
- [self performSelector:@selector(configureTabBarInitially)
- withObject:nil
- afterDelay:0];
-
- // open drawer
- //[drawer toggle:self];
-}
-
-- (void)addDefaultTabs
-{
- [self addNewTab:self];
- [self addNewTab:self];
- [self addNewTab:self];
- [[tabView tabViewItemAtIndex:0] setLabel:@"Tab"];
- [[tabView tabViewItemAtIndex:1] setLabel:@"Bar"];
- [[tabView tabViewItemAtIndex:2] setLabel:@"Control"];
- NSRect tabViewBounds = [[[tabView tabViewItemAtIndex:0] view] bounds];
- [[tabView tabViewItemAtIndex:0] setView:[[NSImageView alloc] initWithFrame:tabViewBounds]];
- [[[tabView tabViewItemAtIndex:0] view] setImage:[NSImage imageNamed:@"mcqueen_large"]];
- [[tabView tabViewItemAtIndex:1] setView:[[NSImageView alloc] initWithFrame:tabViewBounds]];
- [[[tabView tabViewItemAtIndex:1] view] setImage:[NSImage imageNamed:@"mater_large"]];
- [[tabView tabViewItemAtIndex:2] setView:[[NSImageView alloc] initWithFrame:tabViewBounds]];
- [[[tabView tabViewItemAtIndex:2] view] setImage:[NSImage imageNamed:@"sally_large"]];
-}
-
-- (IBAction)addNewTab:(id)sender
-{
- DemoFakeModel *newModel = [[DemoFakeModel alloc] init];
- NSTabViewItem *newItem = [[[NSTabViewItem alloc] initWithIdentifier:newModel] autorelease];
- [newItem setLabel:@"Untitled"];
- [tabView addTabViewItem:newItem];
- [tabView selectTabViewItem:newItem]; // this is optional, but expected behavior
- [newModel release];
-}
-
-- (IBAction)closeTab:(id)sender
-{
- [tabView removeTabViewItem:[tabView selectedTabViewItem]];
-}
-
-- (void)stopProcessing:(id)sender
-{
- [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:NO] forKeyPath:@"isProcessing"];
-}
-
-- (void)setIconNamed:(id)sender
-{
- NSString *iconName = [sender titleOfSelectedItem];
- if ([iconName isEqualToString:@"None"]) {
- [[[tabView selectedTabViewItem] identifier] setValue:nil forKeyPath:@"icon"];
- [[[tabView selectedTabViewItem] identifier] setValue:@"None" forKeyPath:@"iconName"];
- } else {
- NSImage *newIcon = [NSImage imageNamed:iconName];
- [[[tabView selectedTabViewItem] identifier] setValue:newIcon forKeyPath:@"icon"];
- [[[tabView selectedTabViewItem] identifier] setValue:iconName forKeyPath:@"iconName"];
- }
-}
-
-- (void)setObjectCount:(id)sender
-{
- [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithInteger:[sender integerValue]] forKeyPath:@"objectCount"];
-}
-
-- (IBAction)isProcessingAction:(id)sender
-{
- [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:[sender state]] forKeyPath:@"isProcessing"];
-}
-
-- (IBAction)isEditedAction:(id)sender
-{
- [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:[sender state]] forKeyPath:@"isEdited"];
-}
-
-- (IBAction)setTabLabel:(id)sender
-{
- [[tabView selectedTabViewItem] setLabel:[sender stringValue]];
-}
-
-- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
-{
- if ([menuItem action] == @selector(closeTab:)) {
- if (![tabBar canCloseOnlyTab] && ([tabView numberOfTabViewItems] <= 1)) {
- return NO;
- }
- }
- return YES;
-}
-
-- (PSMTabBarControl *)tabBar
-{
- return tabBar;
-}
-
-- (void)windowWillClose:(NSNotification *)note
-{
- [self autorelease];
-}
-
-#pragma mark -
-#pragma mark ---- tab bar config ----
-
-- (void)configStyle:(id)sender
-{
- [tabBar setStyleNamed:[sender titleOfSelectedItem]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[sender titleOfSelectedItem]
- forKey:@"Style"];
-}
-
-- (void)configOrientation:(id)sender
-{
- PSMTabBarOrientation orientation = ([sender indexOfSelectedItem] == 0) ? PSMTabBarHorizontalOrientation : PSMTabBarVerticalOrientation;
-
- if (orientation == [tabBar orientation]) {
- return;
- }
-
- //change the frame of the tab bar according to the orientation
- NSRect tabBarFrame = [tabBar frame], tabViewFrame = [tabView frame];
- NSRect totalFrame = NSUnionRect(tabBarFrame, tabViewFrame);
-
- if (orientation == PSMTabBarHorizontalOrientation) {
- tabBarFrame.size.height = [tabBar isTabBarHidden] ? 1 : 22;
- tabBarFrame.size.width = totalFrame.size.width;
- tabBarFrame.origin.y = totalFrame.origin.y + totalFrame.size.height - tabBarFrame.size.height;
- tabViewFrame.origin.x = 13;
- tabViewFrame.size.width = totalFrame.size.width - 23;
- tabViewFrame.size.height = totalFrame.size.height - tabBarFrame.size.height - 2;
- [tabBar setAutoresizingMask:NSViewMinYMargin | NSViewWidthSizable];
- } else {
- tabBarFrame.size.height = totalFrame.size.height;
- tabBarFrame.size.width = [tabBar isTabBarHidden] ? 1 : 120;
- tabBarFrame.origin.y = totalFrame.origin.y;
- tabViewFrame.origin.x = tabBarFrame.origin.x + tabBarFrame.size.width;
- tabViewFrame.size.width = totalFrame.size.width - tabBarFrame.size.width;
- tabViewFrame.size.height = totalFrame.size.height;
- [tabBar setAutoresizingMask:NSViewHeightSizable];
- }
-
- tabBarFrame.origin.x = totalFrame.origin.x;
- tabViewFrame.origin.y = totalFrame.origin.y;
-
- [tabView setFrame:tabViewFrame];
- [tabBar setFrame:tabBarFrame];
-
- [tabBar setOrientation:orientation];
- [[self window] display];
-
- [[NSUserDefaults standardUserDefaults] setObject:[sender title]
- forKey:@"Orientation"];
-}
-
-- (void)configCanCloseOnlyTab:(id)sender
-{
- [tabBar setCanCloseOnlyTab:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
- forKey:@"CanCloseOnlyTab"];
-}
-
-- (void)configDisableTabClose:(id)sender
-{
- [tabBar setDisableTabClose:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
- forKey:@"DisableTabClose"];
-}
-
-- (void)configHideForSingleTab:(id)sender
-{
- [tabBar setHideForSingleTab:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
- forKey:@"HideForSingleTab"];
-}
-
-- (void)configAddTabButton:(id)sender
-{
- [tabBar setShowAddTabButton:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
- forKey:@"ShowAddTabButton"];
-}
-
-- (void)configTabMinWidth:(id)sender
-{
- if ([tabBar cellOptimumWidth] < [sender integerValue]) {
- [tabBar setCellMinWidth:[tabBar cellOptimumWidth]];
- [sender setIntegerValue:[tabBar cellOptimumWidth]];
- return;
- }
-
- [tabBar setCellMinWidth:[sender integerValue]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:[sender integerValue]]
- forKey:@"TabMinWidth"];
-}
-
-- (void)configTabMaxWidth:(id)sender
-{
- if ([tabBar cellOptimumWidth] > [sender integerValue]) {
- [tabBar setCellMaxWidth:[tabBar cellOptimumWidth]];
- [sender setIntegerValue:[tabBar cellOptimumWidth]];
- return;
- }
-
- [tabBar setCellMaxWidth:[sender integerValue]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:[sender integerValue]]
- forKey:@"TabMaxWidth"];
-}
-
-- (void)configTabOptimumWidth:(id)sender
-{
- if ([tabBar cellMaxWidth] < [sender integerValue]) {
- [tabBar setCellOptimumWidth:[tabBar cellMaxWidth]];
- [sender setIntegerValue:[tabBar cellMaxWidth]];
- return;
- }
-
- if ([tabBar cellMinWidth] > [sender integerValue]) {
- [tabBar setCellOptimumWidth:[tabBar cellMinWidth]];
- [sender setIntegerValue:[tabBar cellMinWidth]];
- return;
- }
-
- [tabBar setCellOptimumWidth:[sender integerValue]];
-
-}
-
-- (void)configTabSizeToFit:(id)sender
-{
- [tabBar setSizeCellsToFit:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
- forKey:@"SizeToFit"];
-}
-
-- (void)configTearOffStyle:(id)sender
-{
- [tabBar setTearOffStyle:([sender indexOfSelectedItem] == 0) ? PSMTabBarTearOffAlphaWindow : PSMTabBarTearOffMiniwindow];
-
- [[NSUserDefaults standardUserDefaults] setObject:[sender title]
- forKey:@"Tear-Off"];
-}
-
-- (void)configUseOverflowMenu:(id)sender
-{
- [tabBar setUseOverflowMenu:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
- forKey:@"UseOverflowMenu"];
-}
-
-- (void)configAutomaticallyAnimates:(id)sender
-{
- [tabBar setAutomaticallyAnimates:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
- forKey:@"AutomaticallyAnimates"];
-}
-
-- (void)configAllowsScrubbing:(id)sender
-{
- [tabBar setAllowsScrubbing:[sender state]];
-
- [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
- forKey:@"AllowScrubbing"];
-}
-
-#pragma mark -
-#pragma mark ---- delegate ----
-
-- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
-{
- // need to update bound values to match the selected tab
- if ([[tabViewItem identifier] respondsToSelector:@selector(objectCount)]) {
- [objectCounterField setIntegerValue:[[tabViewItem identifier] objectCount]];
- }
-
- if ([[tabViewItem identifier] respondsToSelector:@selector(isProcessing)]) {
- [isProcessingButton setState:[[tabViewItem identifier] isProcessing]];
- }
-
- if ([[tabViewItem identifier] respondsToSelector:@selector(isEdited)]) {
- [isEditedButton setState:[[tabViewItem identifier] isEdited]];
- }
-
- if ([[tabViewItem identifier] respondsToSelector:@selector(iconName)]) {
- NSString *newName = [[tabViewItem identifier] iconName];
- if (newName) {
- [iconButton selectItem:[[iconButton menu] itemWithTitle:newName]];
- } else {
- [iconButton selectItem:[[iconButton menu] itemWithTitle:@"None"]];
- }
- }
-}
-
-- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem
-{
- if ([[tabViewItem label] isEqualToString:@"Drake"]) {
- NSAlert *drakeAlert = [NSAlert alertWithMessageText:@"No Way!" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"I refuse to close a tab named \"Drake\""];
- [drakeAlert beginSheetModalForWindow:[NSApp keyWindow] modalDelegate:nil didEndSelector:nil contextInfo:nil];
- return NO;
- }
- return YES;
-}
-
-- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem
-{
- NSLog(@"didCloseTabViewItem: %@", [tabViewItem label]);
-}
-
-- (NSArray *)allowedDraggedTypesForTabView:(NSTabView *)aTabView
-{
- return [NSArray arrayWithObjects:NSFilenamesPboardType, NSStringPboardType, nil];
-}
-
-- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>)draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem
-{
- NSLog(@"acceptedDraggingInfo: %@ onTabViewItem: %@", [[draggingInfo draggingPasteboard] stringForType:[[[draggingInfo draggingPasteboard] types] objectAtIndex:0]], [tabViewItem label]);
-}
-
-- (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem
-{
- NSLog(@"menuForTabViewItem: %@", [tabViewItem label]);
- return nil;
-}
-
-- (BOOL)tabView:(NSTabView*)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl
-{
- return YES;
-}
-
-- (BOOL)tabView:(NSTabView*)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl
-{
- return YES;
-}
-
-- (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl
-{
- NSLog(@"didDropTabViewItem: %@ inTabBar: %@", [tabViewItem label], tabBarControl);
-}
-
-- (NSImage *)tabView:(NSTabView *)aTabView imageForTabViewItem:(NSTabViewItem *)tabViewItem offset:(NSSize *)offset styleMask:(NSUInteger *)styleMask
-{
- // grabs whole window image
- NSImage *viewImage = [[[NSImage alloc] init] autorelease];
- NSRect contentFrame = [[[self window] contentView] frame];
- [[[self window] contentView] lockFocus];
- NSBitmapImageRep *viewRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:contentFrame] autorelease];
- [viewImage addRepresentation:viewRep];
- [[[self window] contentView] unlockFocus];
-
- // grabs snapshot of dragged tabViewItem's view (represents content being dragged)
- NSView *viewForImage = [tabViewItem view];
- NSRect viewRect = [viewForImage frame];
- NSImage *tabViewImage = [[[NSImage alloc] initWithSize:viewRect.size] autorelease];
- [tabViewImage lockFocus];
- [viewForImage drawRect:[viewForImage bounds]];
- [tabViewImage unlockFocus];
-
- [viewImage lockFocus];
- NSPoint tabOrigin = [tabView frame].origin;
- tabOrigin.x += 10;
- tabOrigin.y += 13;
- [tabViewImage compositeToPoint:tabOrigin operation:NSCompositeSourceOver];
- [viewImage unlockFocus];
-
- //draw over where the tab bar would usually be
- NSRect tabFrame = [tabBar frame];
- [viewImage lockFocus];
- [[NSColor windowBackgroundColor] set];
- NSRectFill(tabFrame);
- //draw the background flipped, which is actually the right way up
- NSAffineTransform *transform = [NSAffineTransform transform];
- [transform scaleXBy:1.0 yBy:-1.0];
- [transform concat];
- tabFrame.origin.y = -tabFrame.origin.y - tabFrame.size.height;
- [(id <PSMTabStyle>)[[aTabView delegate] style] drawBackgroundInRect:tabFrame];
- [transform invert];
- [transform concat];
-
- [viewImage unlockFocus];
-
- if ([(PSMTabBarControl *)[aTabView delegate] orientation] == PSMTabBarHorizontalOrientation) {
- offset->width = [(id <PSMTabStyle>)[[aTabView delegate] style] leftMarginForTabBarControl];
- offset->height = 22;
- } else {
- offset->width = 0;
- offset->height = 22 + [(id <PSMTabStyle>)[[aTabView delegate] style] leftMarginForTabBarControl];
- }
-
- if (styleMask) {
- *styleMask = NSTitledWindowMask | NSTexturedBackgroundWindowMask;
- }
-
- return viewImage;
-}
-
-- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point
-{
- NSLog(@"newTabBarForDraggedTabViewItem: %@ atPoint: %@", [tabViewItem label], NSStringFromPoint(point));
-
- //create a new window controller with no tab items
- DemoWindowController *controller = [[DemoWindowController alloc] initWithWindowNibName:@"DemoWindow"];
- id <PSMTabStyle> style = (id <PSMTabStyle>)[[aTabView delegate] style];
-
- NSRect windowFrame = [[controller window] frame];
- point.y += windowFrame.size.height - [[[controller window] contentView] frame].size.height;
- point.x -= [style leftMarginForTabBarControl];
-
- [[controller window] setFrameTopLeftPoint:point];
- [[controller tabBar] setStyle:style];
-
- return [controller tabBar];
-}
-
-- (void)tabView:(NSTabView *)aTabView closeWindowForLastTabViewItem:(NSTabViewItem *)tabViewItem
-{
- NSLog(@"closeWindowForLastTabViewItem: %@", [tabViewItem label]);
- [[self window] close];
-}
-
-- (void)tabView:(NSTabView *)aTabView tabBarDidHide:(PSMTabBarControl *)tabBarControl
-{
- NSLog(@"tabBarDidHide: %@", tabBarControl);
-}
-
-- (void)tabView:(NSTabView *)aTabView tabBarDidUnhide:(PSMTabBarControl *)tabBarControl
-{
- NSLog(@"tabBarDidUnhide: %@", tabBarControl);
-}
-
-- (NSString *)tabView:(NSTabView *)aTabView toolTipForTabViewItem:(NSTabViewItem *)tabViewItem
-{
- return [tabViewItem label];
-}
-
-- (NSString *)accessibilityStringForTabView:(NSTabView *)aTabView objectCount:(NSInteger)objectCount
-{
- return (objectCount == 1) ? @"item" : @"items";
-}
-
-#pragma mark -
-#pragma mark ---- toolbar ----
-
-- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
-{
- NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
-
- if ([itemIdentifier isEqualToString:@"TabField"]) {
- [item setPaletteLabel:@"Tab Label"];
- [item setLabel:@"Tab Label"];
- [item setView:tabField];
- [item setMinSize:NSMakeSize(100, [tabField frame].size.height)];
- [item setMaxSize:NSMakeSize(500, [tabField frame].size.height)];
- } else if ([itemIdentifier isEqualToString:@"DrawerItem"]) {
- [item setPaletteLabel:@"Configuration"];
- [item setLabel:@"Configuration"];
- [item setToolTip:@"Configuration"];
- [item setImage:[NSImage imageNamed:@"32x32_log"]];
- [item setTarget:drawer];
- [item setAction:@selector(toggle:)];
- }
-
- return [item autorelease];
-}
-
-- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
-{
- return [NSArray arrayWithObjects:@"TabField",
- NSToolbarFlexibleSpaceItemIdentifier,
- @"DrawerItem",
- nil];
-}
-
-- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
-{
- return [NSArray arrayWithObjects:@"TabField",
- NSToolbarFlexibleSpaceItemIdentifier,
- @"DrawerItem",
- nil];
-}
-
-- (IBAction)toggleToolbar:(id)sender
-{
- [[[self window] toolbar] setVisible:![[[self window] toolbar] isVisible]];
-}
-
-- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
-{
- return YES;
-}
-
-
-- (void)configureTabBarInitially
-{
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- [popUp_style selectItemWithTitle:[defaults stringForKey:@"Style"]];
- [popUp_orientation selectItemWithTitle:[defaults stringForKey:@"Orientation"]];
- [popUp_tearOff selectItemWithTitle:[defaults stringForKey:@"Tear-Off"]];
-
- [button_canCloseOnlyTab setState:[defaults boolForKey:@"CanCloseOnlyTab"]];
- [button_disableTabClosing setState:[defaults boolForKey:@"DisableTabClosing"]];
- [button_hideForSingleTab setState:[defaults boolForKey:@"HideForSingleTab"]];
- [button_showAddTab setState:[defaults boolForKey:@"ShowAddTabButton"]];
- [button_sizeToFit setState:[defaults boolForKey:@"SizeToFit"]];
- [button_useOverflow setState:[defaults boolForKey:@"UseOverflowMenu"]];
- [button_automaticallyAnimate setState:[defaults boolForKey:@"AutomaticallyAnimates"]];
- [button_allowScrubbing setState:[defaults boolForKey:@"AllowScrubbing"]];
-
- [self configStyle:popUp_style];
- [self configOrientation:popUp_orientation];
- [self configCanCloseOnlyTab:button_canCloseOnlyTab];
- [self configDisableTabClose:button_disableTabClosing];
- [self configHideForSingleTab:button_hideForSingleTab];
- [self configAddTabButton:button_showAddTab];
- [self configTabMinWidth:textField_minWidth];
- [self configTabMaxWidth:textField_maxWidth];
- [self configTabOptimumWidth:textField_optimumWidth];
- [self configTabSizeToFit:button_sizeToFit];
- [self configTearOffStyle:popUp_tearOff];
- [self configUseOverflowMenu:button_useOverflow];
- [self configAutomaticallyAnimates:button_automaticallyAnimate];
- [self configAllowsScrubbing:button_allowScrubbing];
-}
-@end
View
39 PSMAdiumTabStyle.h
@@ -1,39 +0,0 @@
-//
-// PSMAdiumTabStyle.h
-// PSMTabBarControl
-//
-// Created by Kent Sutherland on 5/26/06.
-// Copyright 2006 Kent Sutherland. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "PSMTabStyle.h"
-
-@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;
-}
-
-- (void)loadImages;
-
-- (BOOL)drawsUnified;
-- (void)setDrawsUnified:(BOOL)value;
-- (BOOL)drawsRight;
-- (void)setDrawsRight:(BOOL)value;
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-@end
View
38 PSMAquaTabStyle.h
@@ -1,38 +0,0 @@
-//
-// 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"
-
-@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;
-
- NSDictionary *_objectCountStringAttributes;
- PSMTabBarControl *tabBar;
-}
-
-- (void)loadImages;
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-@end
View
572 PSMAquaTabStyle.m
@@ -1,572 +0,0 @@
-//
-// PSMAquaTabStyle.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/17/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMAquaTabStyle.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-
-#define kPSMAquaObjectCounterRadius 7.0
-#define kPSMAquaCounterMinWidth 20
-
-@implementation PSMAquaTabStyle
-
-- (NSString *)name
-{
- return @"Aqua";
-}
-
-#pragma mark -
-#pragma mark Creation/Destruction
-
-- (id) init
-{
- if ( (self = [super init]) ) {
- [self loadImages];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
- }
- return self;
-}
-
-- (void) loadImages
-{
- // Aqua Tabs Images
- aquaTabBg = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsBackground"]];
- [aquaTabBg setFlipped:YES];
-
- aquaTabBgDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDown"]];
- [aquaTabBgDown setFlipped:YES];
-
- aquaTabBgDownGraphite = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownGraphite"]];
- [aquaTabBgDown setFlipped:YES];
-
- aquaTabBgDownNonKey = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownNonKey"]];
- [aquaTabBgDown setFlipped:YES];
-
- aquaDividerDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparatorDown"]];
- [aquaDivider setFlipped:NO];
-
- aquaDivider = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparator"]];
- [aquaDivider setFlipped:NO];
-
- aquaCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]];
- aquaCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]];
- aquaCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]];
-
- aquaCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
- aquaCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
- aquaCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]];
-
- _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNew"]];
- _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewPressed"]];
- _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewRollover"]];
-}
-
-- (void)dealloc
-{
- [aquaTabBg release];
- [aquaTabBgDown release];
- [aquaDividerDown release];
- [aquaDivider release];
- [aquaCloseButton release];
- [aquaCloseButtonDown release];
- [aquaCloseButtonOver release];
- [aquaCloseDirtyButton release];
- [aquaCloseDirtyButtonDown release];
- [aquaCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specifics
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return 0.0f;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 0.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
-
-}
-
-#pragma mark -
-#pragma mark Add Tab Button
-
-- (NSImage *)addTabButtonImage
-{
- return _addTabButtonImage;
-}
-
-- (NSImage *)addTabButtonPressedImage
-{
- return _addTabButtonPressedImage;
-}
-
-- (NSImage *)addTabButtonRolloverImage
-{
- return _addTabButtonRolloverImage;
-}
-
-#pragma mark -
-#pragma mark Cell Specifics
-
-- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation
-{
- return [cell frame];
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- if ([cell hasCloseButton] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = [aquaCloseButton size];
- result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0;
-
- return result;
-}
-
-- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
-
- if ([cell hasIcon] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth);
- result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y;
-
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- result.origin.x += [aquaCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- return result;
-}
-
-- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
-
- if ([[cell indicator] isHidden]) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth);
- result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth;
- result.origin.y = cellFrame.origin.y + MARGIN_Y;
-
- return result;
-}
-
-- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
-
- if ([cell count] == 0) {
- return NSZeroRect;
- }
-
- CGFloat countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width;
- countWidth += (2 * kPSMAquaObjectCounterRadius - 6.0);
- if (countWidth < kPSMAquaCounterMinWidth) {
- countWidth = kPSMAquaCounterMinWidth;
- }
-
- NSRect result;
- result.size = NSMakeSize(countWidth, 2 * kPSMAquaObjectCounterRadius); // temp
- result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- if (![[cell indicator] isHidden]) {
- result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding;
- }
-
- return result;
-}
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = MARGIN_X;
-
- // close button?
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed])
- resultWidth += [aquaCloseButton size].width + kPSMTabBarCellPadding;
-
- // icon?
- if ([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
- }
-
- // the label
- resultWidth += kPSMMinimumTitleWidth;
-
- // object counter?
- if ([cell count] > 0) {
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
- }
-
- // indicator?
- if ([[cell indicator] isHidden] == NO) {
- resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
- }
-
- // right margin
- resultWidth += MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = MARGIN_X;
-
- // close button?
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- resultWidth += [aquaCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- // icon?
- if ([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
- }
-
- // the label
- resultWidth += [[cell attributedStringValue] size].width;
-
- // object counter?
- if ([cell count] > 0) {
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
- }
-
- // indicator?
- if ([[cell indicator] isHidden] == NO) {
- resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
- }
-
- // right margin
- resultWidth += MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)tabCellHeight
-{
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell
-{
- NSMutableAttributedString *attrStr;
- NSString * contents = [cell stringValue];
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
- NSRange range = NSMakeRange(0, [contents length]);
-
- [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
-
- // Paragraph Style for Truncating Long Text
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
- [TruncatingTailParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range];
-
- return attrStr;
-}
-
-#pragma mark -
-#pragma mark Drawing
-
-- (void)drawTabCell:(PSMTabBarCell *)cell;
-{
- NSRect cellFrame = [cell frame];
-
- // Selected Tab
- if ([cell state] == NSOnState) {
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height-2.5);
- aRect.size.height -= 0.5;
-
- // proper tint
- NSControlTint currentTint;
- if ([cell controlTint] == NSDefaultControlTint)
- currentTint = [NSColor currentControlTint];
- else
- currentTint = [cell controlTint];
-
- if (![[[cell controlView] window] isKeyWindow])
- currentTint = NSClearControlTint;
-
- NSImage *bgImage;
- switch (currentTint) {
- case NSGraphiteControlTint:
- bgImage = aquaTabBgDownGraphite;
- break;
- case NSClearControlTint:
- bgImage = aquaTabBgDownNonKey;
- break;
- case NSBlueControlTint:
- default:
- bgImage = aquaTabBgDown;
- break;
- }
-
- [bgImage drawInRect:cellFrame fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0];
- [aquaDivider compositeToPoint:NSMakePoint(cellFrame.origin.x + cellFrame.size.width - 1.0, cellFrame.origin.y + cellFrame.size.height) operation:NSCompositeSourceOver];
-
- aRect.size.height+=0.5;
-
- } else { // Unselected Tab
-
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height);
- aRect.origin.y += 0.5;
- aRect.origin.x += 1.5;
- aRect.size.width -= 1;
-
- aRect.origin.x -= 1;
- aRect.size.width += 1;
-
- // Rollover
- if ([cell isHighlighted]) {
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set];
- NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
- }
-
- [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]];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- if (rect.size.height <= 22.0) {
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- [aquaTabBg drawInRect:rect fromRect:NSMakeRect(0.0, 0.0, 1.0, 22.0) operation:NSCompositeSourceOver fraction:1.0];
- }
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- if (tabBar != bar) {
- tabBar = bar;
- }
-
- [self drawBackgroundInRect:rect];
-
- // no tab view == not connected
- if (![bar tabView]) {
- NSRect labelRect = rect;
- labelRect.size.height -= 4.0;
- labelRect.origin.y += 4.0;
- NSMutableAttributedString *attrStr;
- NSString *contents = @"PSMTabBarControl";
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
- NSRange range = NSMakeRange(0, [contents length]);
- [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // Draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [cell drawWithFrame:[cell frame] inView:bar];
- }
- }
-}
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
- CGFloat labelPosition = cellFrame.origin.x + MARGIN_X;
-
- // close button
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- NSSize closeButtonSize = NSZeroSize;
- NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame];
- NSImage *closeButton = nil;
-
- closeButton = [cell isEdited] ? aquaCloseDirtyButton : aquaCloseButton;
-
- if ([cell closeButtonOver]) closeButton = [cell isEdited] ? aquaCloseDirtyButtonOver : aquaCloseButtonOver;
- if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? aquaCloseDirtyButtonDown : aquaCloseButtonDown;
-
- closeButtonSize = [closeButton size];
-
- if ([controlView isFlipped]) {
- closeButtonRect.origin.y += closeButtonRect.size.height;
- }
-
- [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if ([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[cell representedObject] identifier] icon];
- if ([controlView isFlipped]) {
- iconRect.origin.y += iconRect.size.height;
- }
-
- // center in available space (in case icon image is smaller than kPSMTabBarIconWidth)
- if ([icon size].width < kPSMTabBarIconWidth) {
- iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width) / 2.0;
- }
-
- if ([icon size].height < kPSMTabBarIconWidth) {
- iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height) / 2.0;
- }
-
- [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // label rect
- NSRect labelRect;
- labelRect.origin.x = labelPosition;
- labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding;
- labelRect.size.height = cellFrame.size.height;
- labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- if (![[cell indicator] isHidden]) {
- labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding);
- }
-
- // object counter
- if ([cell count] > 0) {
- [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3 alpha:0.45] set];
- NSBezierPath *path = [NSBezierPath bezierPath];
- NSRect myRect = [self objectCounterRectForTabCell:cell];
- [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y)];
- [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMAquaObjectCounterRadius, myRect.origin.y)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMAquaObjectCounterRadius, myRect.origin.y + kPSMAquaObjectCounterRadius) radius:kPSMAquaObjectCounterRadius startAngle:270.0 endAngle:90.0];
- [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y + myRect.size.height)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMAquaObjectCounterRadius, myRect.origin.y + kPSMAquaObjectCounterRadius) radius:kPSMAquaObjectCounterRadius startAngle:90.0 endAngle:270.0];
- [path fill];
-
- // draw attributed string centered in area
- NSRect counterStringRect;
- NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell];
- counterStringRect.size = [counterString size];
- counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25;
- counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
- [counterString drawInRect:counterStringRect];
-
- labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding;
- }
-
- // Draw Label
- [[cell attributedStringValue] drawInRect:labelRect];
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder {
- //[super encodeWithCoder:aCoder];
- if ([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:aquaTabBg forKey:@"aquaTabBg"];
- [aCoder encodeObject:aquaTabBgDown forKey:@"aquaTabBgDown"];
- [aCoder encodeObject:aquaTabBgDownGraphite forKey:@"aquaTabBgDownGraphite"];
- [aCoder encodeObject:aquaTabBgDownNonKey forKey:@"aquaTabBgDownNonKey"];
- [aCoder encodeObject:aquaDividerDown forKey:@"aquaDividerDown"];
- [aCoder encodeObject:aquaDivider forKey:@"aquaDivider"];
- [aCoder encodeObject:aquaCloseButton forKey:@"aquaCloseButton"];
- [aCoder encodeObject:aquaCloseButtonDown forKey:@"aquaCloseButtonDown"];
- [aCoder encodeObject:aquaCloseButtonOver forKey:@"aquaCloseButtonOver"];
- [aCoder encodeObject:aquaCloseDirtyButton forKey:@"aquaCloseDirtyButton"];
- [aCoder encodeObject:aquaCloseDirtyButtonDown forKey:@"aquaCloseDirtyButtonDown"];
- [aCoder encodeObject:aquaCloseDirtyButtonOver forKey:@"aquaCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder {
- //self = [super initWithCoder:aDecoder];
- //if (self) {
- if ([aDecoder allowsKeyedCoding]) {
- aquaTabBg = [[aDecoder decodeObjectForKey:@"aquaTabBg"] retain];
- aquaTabBgDown = [[aDecoder decodeObjectForKey:@"aquaTabBgDown"] retain];
- aquaTabBgDownGraphite = [[aDecoder decodeObjectForKey:@"aquaTabBgDownGraphite"] retain];
- aquaTabBgDownNonKey = [[aDecoder decodeObjectForKey:@"aquaTabBgDownNonKey"] retain];
- aquaDividerDown = [[aDecoder decodeObjectForKey:@"aquaDividerDown"] retain];
- aquaDivider = [[aDecoder decodeObjectForKey:@"aquaDivider"] retain];
- aquaCloseButton = [[aDecoder decodeObjectForKey:@"aquaCloseButton"] retain];
- aquaCloseButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseButtonDown"] retain];
- aquaCloseButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseButtonOver"] retain];
- aquaCloseDirtyButton = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButton"] retain];
- aquaCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonDown"] retain];
- aquaCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"aquaCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
- //}
- return self;
-}
-
-@end
View
34 PSMMetalTabStyle.h
@@ -1,34 +0,0 @@
-//
-// 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"
-
-@interface PSMMetalTabStyle : NSObject <PSMTabStyle> {
- NSImage *metalCloseButton;
- NSImage *metalCloseButtonDown;
- NSImage *metalCloseButtonOver;
- NSImage *metalCloseDirtyButton;
- NSImage *metalCloseDirtyButtonDown;
- NSImage *metalCloseDirtyButtonOver;
- NSImage *_addTabButtonImage;
- NSImage *_addTabButtonPressedImage;
- NSImage *_addTabButtonRolloverImage;
-
- NSDictionary *_objectCountStringAttributes;
-
- PSMTabBarOrientation orientation;
- PSMTabBarControl *tabBar;
-}
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
-
-- (void)encodeWithCoder:(NSCoder *)aCoder;
-- (id)initWithCoder:(NSCoder *)aDecoder;
-
-@end
View
651 PSMMetalTabStyle.m
@@ -1,651 +0,0 @@
-//
-// PSMMetalTabStyle.m
-// PSMTabBarControl
-//
-// Created by John Pannell on 2/17/06.
-// Copyright 2006 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMMetalTabStyle.h"
-#import "PSMTabBarCell.h"
-#import "PSMTabBarControl.h"
-
-#define kPSMMetalObjectCounterRadius 7.0
-#define kPSMMetalCounterMinWidth 20
-
-@implementation PSMMetalTabStyle
-
-- (NSString *)name
-{
- return @"Metal";
-}
-
-#pragma mark -
-#pragma mark Creation/Destruction
-
-- (id) init
-{
- if ( (self = [super init]) ) {
- metalCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front"]];
- metalCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Pressed"]];
- metalCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Front_Rollover"]];
-
- metalCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Dirty"]];
- metalCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Dirty_Pressed"]];
- metalCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabClose_Dirty_Rollover"]];
-
- _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetal"]];
- _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalPressed"]];
- _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"TabNewMetalRollover"]];
-
- _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
- [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
- nil, nil];
- }
- return self;
-}
-
-- (void)dealloc
-{
- [metalCloseButton release];
- [metalCloseButtonDown release];
- [metalCloseButtonOver release];
- [metalCloseDirtyButton release];
- [metalCloseDirtyButtonDown release];
- [metalCloseDirtyButtonOver release];
- [_addTabButtonImage release];
- [_addTabButtonPressedImage release];
- [_addTabButtonRolloverImage release];
-
- [_objectCountStringAttributes release];
-
- [super dealloc];
-}
-
-#pragma mark -
-#pragma mark Control Specific
-
-- (CGFloat)leftMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (CGFloat)rightMarginForTabBarControl
-{
- return 24.0f;
-}
-
-- (CGFloat)topMarginForTabBarControl
-{
- return 10.0f;
-}
-
-- (void)setOrientation:(PSMTabBarOrientation)value
-{
- orientation = value;
-}
-
-#pragma mark -
-#pragma mark Add Tab Button
-
-- (NSImage *)addTabButtonImage
-{
- return _addTabButtonImage;
-}
-
-- (NSImage *)addTabButtonPressedImage
-{
- return _addTabButtonPressedImage;
-}
-
-- (NSImage *)addTabButtonRolloverImage
-{
- return _addTabButtonRolloverImage;
-}
-
-#pragma mark -
-#pragma mark Cell Specific
-
-- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)tabOrientation
-{
- NSRect dragRect = [cell frame];
- dragRect.size.width++;
-
- if ([cell tabState] & PSMTab_SelectedMask) {
- if (tabOrientation == PSMTabBarHorizontalOrientation) {
- dragRect.size.height -= 2.0;
- } else {
- dragRect.size.height += 1.0;
- dragRect.origin.y -= 1.0;
- dragRect.origin.x += 2.0;
- dragRect.size.width -= 3.0;
- }
- } else if (tabOrientation == PSMTabBarVerticalOrientation) {
- dragRect.origin.x--;
- }
-
- return dragRect;
-}
-
-- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
-{
- if ([cell hasCloseButton] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = [metalCloseButton size];
- result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0;
-
- if ([cell state] == NSOnState) {
- result.origin.y -= 1;
- }
-
- return result;
-}
-
-- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
-
- if ([cell hasIcon] == NO) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth);
- result.origin.x = cellFrame.origin.x + MARGIN_X;
- result.origin.y = cellFrame.origin.y + MARGIN_Y;
-
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- result.origin.x += [metalCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- if ([cell state] == NSOnState) {
- result.origin.y -= 1;
- }
-
- return result;
-}
-
-- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
-
- if ([[cell indicator] isHidden]) {
- return NSZeroRect;
- }
-
- NSRect result;
- result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth);
- result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth;
- result.origin.y = cellFrame.origin.y + MARGIN_Y;
-
- if ([cell state] == NSOnState) {
- result.origin.y -= 1;
- }
-
- return result;
-}
-
-- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
-
- if ([cell count] == 0) {
- return NSZeroRect;
- }
-
- CGFloat countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width;
- countWidth += (2 * kPSMMetalObjectCounterRadius - 6.0);
- if (countWidth < kPSMMetalCounterMinWidth) {
- countWidth = kPSMMetalCounterMinWidth;
- }
-
- NSRect result;
- result.size = NSMakeSize(countWidth, 2 * kPSMMetalObjectCounterRadius); // temp
- result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width;
- result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- if (![[cell indicator] isHidden]) {
- result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding;
- }
-
- return result;
-}
-
-
-- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = MARGIN_X;
-
- // close button?
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- resultWidth += [metalCloseButton size].width + kPSMTabBarCellPadding;
- }
-
- // icon?
- if ([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
- }
-
- // the label
- resultWidth += kPSMMinimumTitleWidth;
-
- // object counter?
- if ([cell count] > 0) {
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
- }
-
- // indicator?
- if ([[cell indicator] isHidden] == NO)
- resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
-
- // right margin
- resultWidth += MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
-{
- CGFloat resultWidth = 0.0;
-
- // left margin
- resultWidth = MARGIN_X;
-
- // close button?
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed])
- resultWidth += [metalCloseButton size].width + kPSMTabBarCellPadding;
-
- // icon?
- if ([cell hasIcon]) {
- resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
- }
-
- // the label
- resultWidth += [[cell attributedStringValue] size].width;
-
- // object counter?
- if ([cell count] > 0) {
- resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
- }
-
- // indicator?
- if ([[cell indicator] isHidden] == NO)
- resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
-
- // right margin
- resultWidth += MARGIN_X;
-
- return ceil(resultWidth);
-}
-
-- (CGFloat)tabCellHeight
-{
- return kPSMTabBarControlHeight;
-}
-
-#pragma mark -
-#pragma mark Cell Values
-
-- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
-{
- NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
- return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
-}
-
-- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell
-{
- NSMutableAttributedString *attrStr;
- NSString *contents = [cell stringValue];
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
- NSRange range = NSMakeRange(0, [contents length]);
-
- // Add font attribute
- [attrStr addAttribute:NSFontAttributeName value:[NSFont boldSystemFontOfSize:11.0] range:range];
- [attrStr addAttribute:NSForegroundColorAttributeName value:[[NSColor textColor] colorWithAlphaComponent:0.75] range:range];
-
- // Add shadow attribute
- NSShadow* shadow;
- shadow = [[[NSShadow alloc] init] autorelease];
- CGFloat shadowAlpha;
- if (([cell state] == NSOnState) || [cell isHighlighted]) {
- shadowAlpha = 0.8;
- } else {
- shadowAlpha = 0.5;
- }
- [shadow setShadowColor:[NSColor colorWithCalibratedWhite:1.0 alpha:shadowAlpha]];
- [shadow setShadowOffset:NSMakeSize(0, -1)];
- [shadow setShadowBlurRadius:1.0];
- [attrStr addAttribute:NSShadowAttributeName value:shadow range:range];
-
- // Paragraph Style for Truncating Long Text
- static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
- if (!TruncatingTailParagraphStyle) {
- TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
- [TruncatingTailParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range];
-
- return attrStr;
-}
-
-#pragma mark -
-#pragma mark ---- drawing ----
-
-- (void)drawTabCell:(PSMTabBarCell *)cell
-{
- NSRect cellFrame = [cell frame];
- NSColor *lineColor = nil;
- NSBezierPath *bezier = [NSBezierPath bezierPath];
- lineColor = [NSColor darkGrayColor];
-
- //disable antialiasing of bezier paths
- [NSGraphicsContext saveGraphicsState];
- [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-
- if ([cell state] == NSOnState) {
- // selected tab
- if (orientation == PSMTabBarHorizontalOrientation) {
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height-2.5);
-
- // background
- aRect.origin.x += 1.0;
- aRect.size.width--;
- aRect.size.height -= 0.5;
- NSDrawWindowBackground(aRect);
- aRect.size.width++;
- aRect.size.height += 0.5;
-
- // frame
- aRect.origin.x -= 0.5;
- [lineColor set];
- [bezier setLineWidth:1.0];
- [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y+aRect.size.height-1.5)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x+1.5, aRect.origin.y+aRect.size.height)];
- [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) {
- // 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)];
- }
- } else {
- NSRect aRect = NSMakeRect(cellFrame.origin.x + 2, cellFrame.origin.y, cellFrame.size.width - 2, cellFrame.size.height);
-
- // background
- aRect.origin.x++;
- aRect.size.height--;
- NSDrawWindowBackground(aRect);
- aRect.origin.x--;
- aRect.size.height++;
-
- // frame
- [lineColor set];
- [bezier setLineWidth:1.0];
- [bezier moveToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 2, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5, aRect.origin.y + 2)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 0.5, aRect.origin.y + aRect.size.height - 3)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + 3, aRect.origin.y + aRect.size.height)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)];
- }
-
- [bezier stroke];
- } else {
-
- // unselected tab
- NSRect aRect = NSMakeRect(cellFrame.origin.x, cellFrame.origin.y, cellFrame.size.width, cellFrame.size.height);
- aRect.origin.y += 0.5;
- aRect.origin.x += 1.5;
- aRect.size.width -= 1;
-
- // rollover
- if ([cell isHighlighted]) {
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.1] set];
- NSRectFillUsingOperation(aRect, NSCompositeSourceAtop);
- }
-
- [lineColor set];
-
- if (orientation == PSMTabBarHorizontalOrientation) {
- aRect.origin.x -= 1;
- aRect.size.width += 1;
-
- // frame
- [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)];
- if (!([cell tabState] & PSMTab_RightIsSelectedMask)) {
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)];
- }
- } else {
- if (!([cell tabState] & PSMTab_LeftIsSelectedMask)) {
- [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y)];
- }
-
- if (!([cell tabState] & PSMTab_RightIsSelectedMask)) {
- [bezier moveToPoint:NSMakePoint(aRect.origin.x, aRect.origin.y + aRect.size.height)];
- [bezier lineToPoint:NSMakePoint(aRect.origin.x + aRect.size.width, aRect.origin.y + aRect.size.height)];
- }
- }
- [bezier stroke];
- }
-
- [NSGraphicsContext restoreGraphicsState];
-
- [self drawInteriorWithTabCell:cell inView:[cell controlView]];
-}
-
-
-- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView
-{
- NSRect cellFrame = [cell frame];
- CGFloat labelPosition = cellFrame.origin.x + MARGIN_X;
-
- // close button
- if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
- NSSize closeButtonSize = NSZeroSize;
- NSRect closeButtonRect = [cell closeButtonRectForFrame:cellFrame];
- NSImage * closeButton = nil;
-
- closeButton = [cell isEdited] ? metalCloseDirtyButton : metalCloseButton;
- if ([cell closeButtonOver]) closeButton = [cell isEdited] ? metalCloseDirtyButtonOver : metalCloseButtonOver;
- if ([cell closeButtonPressed]) closeButton = [cell isEdited] ? metalCloseDirtyButtonDown : metalCloseButtonDown;
-
- closeButtonSize = [closeButton size];
- if ([controlView isFlipped]) {
- closeButtonRect.origin.y += closeButtonRect.size.height;
- }
-
- [closeButton compositeToPoint:closeButtonRect.origin operation:NSCompositeSourceOver fraction:1.0];
-
- // scoot label over
- labelPosition += closeButtonSize.width + kPSMTabBarCellPadding;
- }
-
- // icon
- if ([cell hasIcon]) {
- NSRect iconRect = [self iconRectForTabCell:cell];
- NSImage *icon = [[[cell representedObject] identifier] icon];
-
- if ([controlView isFlipped]) {
- iconRect.origin.y += iconRect.size.height;
- }
-
- // center in available space (in case icon image is smaller than kPSMTabBarIconWidth)
- if ([icon size].width < kPSMTabBarIconWidth) {
- iconRect.origin.x += (kPSMTabBarIconWidth - [icon size].width)/2.0;
- }
- if ([icon size].height < kPSMTabBarIconWidth) {
- iconRect.origin.y -= (kPSMTabBarIconWidth - [icon size].height)/2.0;
- }
-
- [icon compositeToPoint:iconRect.origin operation:NSCompositeSourceOver fraction:1.0];
-
- // scoot label over
- labelPosition += iconRect.size.width + kPSMTabBarCellPadding;
- }
-
- // label rect
- NSRect labelRect;
- labelRect.origin.x = labelPosition;
- labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding;
- labelRect.size.height = cellFrame.size.height;
- labelRect.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
-
- if ([cell state] == NSOnState) {
- labelRect.origin.y -= 1;
- }
-
- if (![[cell indicator] isHidden]) {
- labelRect.size.width -= (kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding);
- }
-
- // object counter
- if ([cell count] > 0) {
- [[cell countColor] ?: [NSColor colorWithCalibratedWhite:0.3 alpha:0.6] set];
- NSBezierPath *path = [NSBezierPath bezierPath];
- NSRect myRect = [self objectCounterRectForTabCell:cell];
- if ([cell state] == NSOnState) {
- myRect.origin.y -= 1.0;
- }
- [path moveToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y)];
- [path lineToPoint:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + myRect.size.width - kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:270.0 endAngle:90.0];
- [path lineToPoint:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + myRect.size.height)];
- [path appendBezierPathWithArcWithCenter:NSMakePoint(myRect.origin.x + kPSMMetalObjectCounterRadius, myRect.origin.y + kPSMMetalObjectCounterRadius) radius:kPSMMetalObjectCounterRadius startAngle:90.0 endAngle:270.0];
- [path fill];
-
- // draw attributed string centered in area
- NSRect counterStringRect;
- NSAttributedString *counterString = [self attributedObjectCountValueForTabCell:cell];
- counterStringRect.size = [counterString size];
- counterStringRect.origin.x = myRect.origin.x + ((myRect.size.width - counterStringRect.size.width) / 2.0) + 0.25;
- counterStringRect.origin.y = myRect.origin.y + ((myRect.size.height - counterStringRect.size.height) / 2.0) + 0.5;
- [counterString drawInRect:counterStringRect];
-
- // shrink label width to make room for object counter
- labelRect.size.width -= myRect.size.width + kPSMTabBarCellPadding;
- }
-
- // draw label
- [[cell attributedStringValue] drawInRect:labelRect];
-}
-
-- (void)drawBackgroundInRect:(NSRect)rect
-{
- //Draw for our whole bounds; it'll be automatically clipped to fit the appropriate drawing area
- rect = [tabBar bounds];
-
- if (orientation == PSMTabBarVerticalOrientation && [tabBar frame].size.width < 2) {
- return;
- }
-
- [NSGraphicsContext saveGraphicsState];
- [[NSGraphicsContext currentContext] setShouldAntialias:NO];
-
- [[NSColor colorWithCalibratedWhite:0.0 alpha:0.2] set];
- NSRectFillUsingOperation(rect, NSCompositeSourceAtop);
- [[NSColor darkGrayColor] set];
-
- if (orientation == PSMTabBarHorizontalOrientation) {
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + 0.5) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + 0.5)];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height - 0.5) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height - 0.5)];
- } else {
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x, rect.origin.y + 0.5) toPoint:NSMakePoint(rect.origin.x, rect.origin.y + rect.size.height + 0.5)];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + 0.5) toPoint:NSMakePoint(rect.origin.x + rect.size.width, rect.origin.y + rect.size.height + 0.5)];
- }
-
- [NSGraphicsContext restoreGraphicsState];
-}
-
-- (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect
-{
- if (orientation != [bar orientation]) {
- orientation = [bar orientation];
- }
-
- if (tabBar != bar) {
- tabBar = bar;
- }
-
- [self drawBackgroundInRect:rect];
-
- // no tab view == not connected
- if (![bar tabView]) {
- NSRect labelRect = rect;
- labelRect.size.height -= 4.0;
- labelRect.origin.y += 4.0;
- NSMutableAttributedString *attrStr;
- NSString *contents = @"PSMTabBarControl";
- attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
- NSRange range = NSMakeRange(0, [contents length]);
- [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
- NSMutableParagraphStyle *centeredParagraphStyle = nil;
- if (!centeredParagraphStyle) {
- centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
- [centeredParagraphStyle setAlignment:NSCenterTextAlignment];
- }
- [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range];
- [attrStr drawInRect:labelRect];
- return;
- }
-
- // draw cells
- NSEnumerator *e = [[bar cells] objectEnumerator];
- PSMTabBarCell *cell;
- while ( (cell = [e nextObject]) ) {
- if ([bar isAnimating] || (![cell isInOverflowMenu] && NSIntersectsRect([cell frame], rect))) {
- [cell drawWithFrame:[cell frame] inView:bar];
- }
- }
-}
-
-#pragma mark -
-#pragma mark Archiving
-
-- (void)encodeWithCoder:(NSCoder *)aCoder
-{
- //[super encodeWithCoder:aCoder];
- if ([aCoder allowsKeyedCoding]) {
- [aCoder encodeObject:metalCloseButton forKey:@"metalCloseButton"];
- [aCoder encodeObject:metalCloseButtonDown forKey:@"metalCloseButtonDown"];
- [aCoder encodeObject:metalCloseButtonOver forKey:@"metalCloseButtonOver"];
- [aCoder encodeObject:metalCloseDirtyButton forKey:@"metalCloseDirtyButton"];
- [aCoder encodeObject:metalCloseDirtyButtonDown forKey:@"metalCloseDirtyButtonDown"];
- [aCoder encodeObject:metalCloseDirtyButtonOver forKey:@"metalCloseDirtyButtonOver"];
- [aCoder encodeObject:_addTabButtonImage forKey:@"addTabButtonImage"];
- [aCoder encodeObject:_addTabButtonPressedImage forKey:@"addTabButtonPressedImage"];
- [aCoder encodeObject:_addTabButtonRolloverImage forKey:@"addTabButtonRolloverImage"];
- }
-}
-
-- (id)initWithCoder:(NSCoder *)aDecoder
-{
- // self = [super initWithCoder:aDecoder];
- //if (self) {
- if ([aDecoder allowsKeyedCoding]) {
- metalCloseButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain];
- metalCloseButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain];
- metalCloseButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain];
- metalCloseDirtyButton = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButton"] retain];
- metalCloseDirtyButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButtonDown"] retain];
- metalCloseDirtyButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseDirtyButtonOver"] retain];
- _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain];
- _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain];
- _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain];
- }
- //}
- return self;
-}
-
-@end
View
183 PSMRolloverButton.m
@@ -1,183 +0,0 @@
-//
-// PSMOverflowPopUpButton.m
-// NetScrape
-//
-// Created by John Pannell on 8/4/04.
-// Copyright 2004 Positive Spin Media. All rights reserved.
-//
-
-#import "PSMRolloverButton.h"
-
-@implementation PSMRolloverButton
-
-- (void)awakeFromNib
-{
- if ([[self superclass] instancesRespondToSelector:@selector(awakeFromNib)]) {
- [super awakeFromNib];
- }
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(rolloverFrameDidChange:)
- name:NSViewFrameDidChangeNotification
- object:self];
- [self setPostsFrameChangedNotifications:YES];
- [self resetCursorRects];
-
- _myTrackingRectTag = -1;
-}
-