Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Re-organized files & Uncrustified all source

  • Loading branch information...
commit ffd1a8fec71837f2c5be5f5e88716f2d662ade17 1 parent c3aefab
Robert Payne robertjpayne authored

Showing 168 changed files with 7,856 additions and 8,534 deletions. Show diff stats Hide diff stats

  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
2  .gitignore
... ... @@ -1 +1 @@
1   -build/
  1 +Source/build/
21 DemoAppController.m
... ... @@ -1,21 +0,0 @@
1   -#import "DemoAppController.h"
2   -#import "DemoWindowController.h"
3   -
4   -
5   -@implementation DemoAppController
6   -
7   -- (void)applicationDidFinishLaunching:(NSNotification *)pNotification {
8   - [self newWindow:self];
9   - [self newWindow:self];
10   - NSRect frontFrame = [[NSApp keyWindow] frame];
11   - frontFrame.origin.x += 400;
12   - [[NSApp keyWindow] setFrame:frontFrame display:YES];
13   -}
14   -- (IBAction)newWindow:(id)sender {
15   - // put up a window
16   - DemoWindowController *newWindow = [[DemoWindowController alloc] initWithWindowNibName:@"DemoWindow"];
17   - [newWindow showWindow:self];
18   - [newWindow addDefaultTabs];
19   -}
20   -
21   -@end
95 DemoFakeModel.m
... ... @@ -1,95 +0,0 @@
1   -//
2   -// FakeModel.m
3   -// TabBarControl
4   -//
5   -// Created by John Pannell on 12/19/05.
6   -// Copyright 2005 Positive Spin Media. All rights reserved.
7   -//
8   -
9   -#import "DemoFakeModel.h"
10   -
11   -
12   -@implementation DemoFakeModel
13   -
14   -- (id)init
15   -{
16   - if ( (self == [super init]) ) {
17   - _isProcessing = NO;
18   - _icon = nil;
19   - _iconName = nil;
20   - _objectCount = 2;
21   - _isEdited = NO;
22   - }
23   - return self;
24   -}
25   -
26   -
27   -// accessors
28   -- (BOOL)isProcessing
29   -{
30   - return _isProcessing;
31   -}
32   -
33   -- (void)setIsProcessing:(BOOL)value
34   -{
35   - _isProcessing = value;
36   -}
37   -
38   -- (NSImage *)icon
39   -{
40   - return _icon;
41   -}
42   -
43   -- (void)setIcon:(NSImage *)icon
44   -{
45   - [icon retain];
46   - [_icon release];
47   - _icon = icon;
48   -}
49   -
50   -- (NSString *)iconName
51   -{
52   - return _iconName;
53   -}
54   -
55   -- (void)setIconName:(NSString *)iconName
56   -{
57   - [iconName retain];
58   - [_iconName release];
59   - _iconName = iconName;
60   -}
61   -
62   -- (NSInteger)objectCount
63   -{
64   - return _objectCount;
65   -}
66   -
67   -- (void)setObjectCount:(NSInteger)value
68   -{
69   - _objectCount = value;
70   -}
71   -
72   -- (BOOL)isEdited
73   -{
74   - return _isEdited;
75   -}
76   -
77   -- (void)setIsEdited:(BOOL)value
78   -{
79   - _isEdited = value;
80   -}
81   -
82   -
83   -- (NSImage *)largeImage
84   -{
85   - return [NSImage imageNamed:@"largeImage"];
86   -}
87   -
88   -- (void)setLargeImage:(NSImage *)icon
89   -{
90   - [icon retain];
91   - [_icon release];
92   - _icon = icon;
93   -}
94   -
95   -@end
586 DemoWindowController.m
... ... @@ -1,586 +0,0 @@
1   -//
2   -// WindowController.m
3   -// PSMTabBarControl
4   -//
5   -// Created by John Pannell on 4/6/06.
6   -// Copyright 2006 Positive Spin Media. All rights reserved.
7   -//
8   -
9   -#import "DemoWindowController.h"
10   -#import "DemoFakeModel.h"
11   -#import "PSMTabBarControl.h"
12   -#import "PSMTabStyle.h"
13   -
14   -@interface DemoWindowController (PRIVATE)
15   -- (void)configureTabBarInitially;
16   -@end
17   -
18   -@implementation DemoWindowController
19   -
20   -- (void)awakeFromNib
21   -{
22   - [[NSUserDefaults standardUserDefaults] registerDefaults:
23   - [NSDictionary dictionaryWithObjectsAndKeys:
24   - @"Metal", @"Style",
25   - @"Horizontal", @"Orientation",
26   - @"Alpha Window", @"Tear-Off",
27   - @"100", @"TabMinWidth",
28   - @"280", @"TabMaxWidth",
29   - @"130", @"TabOptimalWidth",
30   - [NSNumber numberWithBool:YES], @"UseOverflowMenu",
31   - nil]];
32   -
33   - // toolbar
34   - NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@"DemoToolbar"];
35   - [toolbar setDelegate:self];
36   - [toolbar setAllowsUserCustomization:YES];
37   - [toolbar setAutosavesConfiguration:YES];
38   - SInt32 MacVersion;
39   - if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr) {
40   - if (MacVersion >= 0x1040) {
41   - // this call is Tiger only
42   - [toolbar setShowsBaselineSeparator:NO];
43   - }
44   - }
45   - [[self window] setToolbar:[toolbar autorelease]];
46   -
47   - // hook up add tab button
48   - [[tabBar addTabButton] setTarget:self];
49   - [[tabBar addTabButton] setAction:@selector(addNewTab:)];
50   -
51   - // remove any tabs present in the nib
52   - NSArray *existingItems = [tabView tabViewItems];
53   - NSEnumerator *e = [existingItems objectEnumerator];
54   - NSTabViewItem *item;
55   - while (item = [e nextObject]) {
56   - [tabView removeTabViewItem:item];
57   - }
58   -
59   - [self performSelector:@selector(configureTabBarInitially)
60   - withObject:nil
61   - afterDelay:0];
62   -
63   - // open drawer
64   - //[drawer toggle:self];
65   -}
66   -
67   -- (void)addDefaultTabs
68   -{
69   - [self addNewTab:self];
70   - [self addNewTab:self];
71   - [self addNewTab:self];
72   - [[tabView tabViewItemAtIndex:0] setLabel:@"Tab"];
73   - [[tabView tabViewItemAtIndex:1] setLabel:@"Bar"];
74   - [[tabView tabViewItemAtIndex:2] setLabel:@"Control"];
75   - NSRect tabViewBounds = [[[tabView tabViewItemAtIndex:0] view] bounds];
76   - [[tabView tabViewItemAtIndex:0] setView:[[NSImageView alloc] initWithFrame:tabViewBounds]];
77   - [[[tabView tabViewItemAtIndex:0] view] setImage:[NSImage imageNamed:@"mcqueen_large"]];
78   - [[tabView tabViewItemAtIndex:1] setView:[[NSImageView alloc] initWithFrame:tabViewBounds]];
79   - [[[tabView tabViewItemAtIndex:1] view] setImage:[NSImage imageNamed:@"mater_large"]];
80   - [[tabView tabViewItemAtIndex:2] setView:[[NSImageView alloc] initWithFrame:tabViewBounds]];
81   - [[[tabView tabViewItemAtIndex:2] view] setImage:[NSImage imageNamed:@"sally_large"]];
82   -}
83   -
84   -- (IBAction)addNewTab:(id)sender
85   -{
86   - DemoFakeModel *newModel = [[DemoFakeModel alloc] init];
87   - NSTabViewItem *newItem = [[[NSTabViewItem alloc] initWithIdentifier:newModel] autorelease];
88   - [newItem setLabel:@"Untitled"];
89   - [tabView addTabViewItem:newItem];
90   - [tabView selectTabViewItem:newItem]; // this is optional, but expected behavior
91   - [newModel release];
92   -}
93   -
94   -- (IBAction)closeTab:(id)sender
95   -{
96   - [tabView removeTabViewItem:[tabView selectedTabViewItem]];
97   -}
98   -
99   -- (void)stopProcessing:(id)sender
100   -{
101   - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:NO] forKeyPath:@"isProcessing"];
102   -}
103   -
104   -- (void)setIconNamed:(id)sender
105   -{
106   - NSString *iconName = [sender titleOfSelectedItem];
107   - if ([iconName isEqualToString:@"None"]) {
108   - [[[tabView selectedTabViewItem] identifier] setValue:nil forKeyPath:@"icon"];
109   - [[[tabView selectedTabViewItem] identifier] setValue:@"None" forKeyPath:@"iconName"];
110   - } else {
111   - NSImage *newIcon = [NSImage imageNamed:iconName];
112   - [[[tabView selectedTabViewItem] identifier] setValue:newIcon forKeyPath:@"icon"];
113   - [[[tabView selectedTabViewItem] identifier] setValue:iconName forKeyPath:@"iconName"];
114   - }
115   -}
116   -
117   -- (void)setObjectCount:(id)sender
118   -{
119   - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithInteger:[sender integerValue]] forKeyPath:@"objectCount"];
120   -}
121   -
122   -- (IBAction)isProcessingAction:(id)sender
123   -{
124   - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:[sender state]] forKeyPath:@"isProcessing"];
125   -}
126   -
127   -- (IBAction)isEditedAction:(id)sender
128   -{
129   - [[[tabView selectedTabViewItem] identifier] setValue:[NSNumber numberWithBool:[sender state]] forKeyPath:@"isEdited"];
130   -}
131   -
132   -- (IBAction)setTabLabel:(id)sender
133   -{
134   - [[tabView selectedTabViewItem] setLabel:[sender stringValue]];
135   -}
136   -
137   -- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
138   -{
139   - if ([menuItem action] == @selector(closeTab:)) {
140   - if (![tabBar canCloseOnlyTab] && ([tabView numberOfTabViewItems] <= 1)) {
141   - return NO;
142   - }
143   - }
144   - return YES;
145   -}
146   -
147   -- (PSMTabBarControl *)tabBar
148   -{
149   - return tabBar;
150   -}
151   -
152   -- (void)windowWillClose:(NSNotification *)note
153   -{
154   - [self autorelease];
155   -}
156   -
157   -#pragma mark -
158   -#pragma mark ---- tab bar config ----
159   -
160   -- (void)configStyle:(id)sender
161   -{
162   - [tabBar setStyleNamed:[sender titleOfSelectedItem]];
163   -
164   - [[NSUserDefaults standardUserDefaults] setObject:[sender titleOfSelectedItem]
165   - forKey:@"Style"];
166   -}
167   -
168   -- (void)configOrientation:(id)sender
169   -{
170   - PSMTabBarOrientation orientation = ([sender indexOfSelectedItem] == 0) ? PSMTabBarHorizontalOrientation : PSMTabBarVerticalOrientation;
171   -
172   - if (orientation == [tabBar orientation]) {
173   - return;
174   - }
175   -
176   - //change the frame of the tab bar according to the orientation
177   - NSRect tabBarFrame = [tabBar frame], tabViewFrame = [tabView frame];
178   - NSRect totalFrame = NSUnionRect(tabBarFrame, tabViewFrame);
179   -
180   - if (orientation == PSMTabBarHorizontalOrientation) {
181   - tabBarFrame.size.height = [tabBar isTabBarHidden] ? 1 : 22;
182   - tabBarFrame.size.width = totalFrame.size.width;
183   - tabBarFrame.origin.y = totalFrame.origin.y + totalFrame.size.height - tabBarFrame.size.height;
184   - tabViewFrame.origin.x = 13;
185   - tabViewFrame.size.width = totalFrame.size.width - 23;
186   - tabViewFrame.size.height = totalFrame.size.height - tabBarFrame.size.height - 2;
187   - [tabBar setAutoresizingMask:NSViewMinYMargin | NSViewWidthSizable];
188   - } else {
189   - tabBarFrame.size.height = totalFrame.size.height;
190   - tabBarFrame.size.width = [tabBar isTabBarHidden] ? 1 : 120;
191   - tabBarFrame.origin.y = totalFrame.origin.y;
192   - tabViewFrame.origin.x = tabBarFrame.origin.x + tabBarFrame.size.width;
193   - tabViewFrame.size.width = totalFrame.size.width - tabBarFrame.size.width;
194   - tabViewFrame.size.height = totalFrame.size.height;
195   - [tabBar setAutoresizingMask:NSViewHeightSizable];
196   - }
197   -
198   - tabBarFrame.origin.x = totalFrame.origin.x;
199   - tabViewFrame.origin.y = totalFrame.origin.y;
200   -
201   - [tabView setFrame:tabViewFrame];
202   - [tabBar setFrame:tabBarFrame];
203   -
204   - [tabBar setOrientation:orientation];
205   - [[self window] display];
206   -
207   - [[NSUserDefaults standardUserDefaults] setObject:[sender title]
208   - forKey:@"Orientation"];
209   -}
210   -
211   -- (void)configCanCloseOnlyTab:(id)sender
212   -{
213   - [tabBar setCanCloseOnlyTab:[sender state]];
214   -
215   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
216   - forKey:@"CanCloseOnlyTab"];
217   -}
218   -
219   -- (void)configDisableTabClose:(id)sender
220   -{
221   - [tabBar setDisableTabClose:[sender state]];
222   -
223   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
224   - forKey:@"DisableTabClose"];
225   -}
226   -
227   -- (void)configHideForSingleTab:(id)sender
228   -{
229   - [tabBar setHideForSingleTab:[sender state]];
230   -
231   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
232   - forKey:@"HideForSingleTab"];
233   -}
234   -
235   -- (void)configAddTabButton:(id)sender
236   -{
237   - [tabBar setShowAddTabButton:[sender state]];
238   -
239   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender state]]
240   - forKey:@"ShowAddTabButton"];
241   -}
242   -
243   -- (void)configTabMinWidth:(id)sender
244   -{
245   - if ([tabBar cellOptimumWidth] < [sender integerValue]) {
246   - [tabBar setCellMinWidth:[tabBar cellOptimumWidth]];
247   - [sender setIntegerValue:[tabBar cellOptimumWidth]];
248   - return;
249   - }
250   -
251   - [tabBar setCellMinWidth:[sender integerValue]];
252   -
253   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:[sender integerValue]]
254   - forKey:@"TabMinWidth"];
255   -}
256   -
257   -- (void)configTabMaxWidth:(id)sender
258   -{
259   - if ([tabBar cellOptimumWidth] > [sender integerValue]) {
260   - [tabBar setCellMaxWidth:[tabBar cellOptimumWidth]];
261   - [sender setIntegerValue:[tabBar cellOptimumWidth]];
262   - return;
263   - }
264   -
265   - [tabBar setCellMaxWidth:[sender integerValue]];
266   -
267   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:[sender integerValue]]
268   - forKey:@"TabMaxWidth"];
269   -}
270   -
271   -- (void)configTabOptimumWidth:(id)sender
272   -{
273   - if ([tabBar cellMaxWidth] < [sender integerValue]) {
274   - [tabBar setCellOptimumWidth:[tabBar cellMaxWidth]];
275   - [sender setIntegerValue:[tabBar cellMaxWidth]];
276   - return;
277   - }
278   -
279   - if ([tabBar cellMinWidth] > [sender integerValue]) {
280   - [tabBar setCellOptimumWidth:[tabBar cellMinWidth]];
281   - [sender setIntegerValue:[tabBar cellMinWidth]];
282   - return;
283   - }
284   -
285   - [tabBar setCellOptimumWidth:[sender integerValue]];
286   -
287   -}
288   -
289   -- (void)configTabSizeToFit:(id)sender
290   -{
291   - [tabBar setSizeCellsToFit:[sender state]];
292   -
293   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
294   - forKey:@"SizeToFit"];
295   -}
296   -
297   -- (void)configTearOffStyle:(id)sender
298   -{
299   - [tabBar setTearOffStyle:([sender indexOfSelectedItem] == 0) ? PSMTabBarTearOffAlphaWindow : PSMTabBarTearOffMiniwindow];
300   -
301   - [[NSUserDefaults standardUserDefaults] setObject:[sender title]
302   - forKey:@"Tear-Off"];
303   -}
304   -
305   -- (void)configUseOverflowMenu:(id)sender
306   -{
307   - [tabBar setUseOverflowMenu:[sender state]];
308   -
309   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
310   - forKey:@"UseOverflowMenu"];
311   -}
312   -
313   -- (void)configAutomaticallyAnimates:(id)sender
314   -{
315   - [tabBar setAutomaticallyAnimates:[sender state]];
316   -
317   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
318   - forKey:@"AutomaticallyAnimates"];
319   -}
320   -
321   -- (void)configAllowsScrubbing:(id)sender
322   -{
323   - [tabBar setAllowsScrubbing:[sender state]];
324   -
325   - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:[sender integerValue]]
326   - forKey:@"AllowScrubbing"];
327   -}
328   -
329   -#pragma mark -
330   -#pragma mark ---- delegate ----
331   -
332   -- (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem
333   -{
334   - // need to update bound values to match the selected tab
335   - if ([[tabViewItem identifier] respondsToSelector:@selector(objectCount)]) {
336   - [objectCounterField setIntegerValue:[[tabViewItem identifier] objectCount]];
337   - }
338   -
339   - if ([[tabViewItem identifier] respondsToSelector:@selector(isProcessing)]) {
340   - [isProcessingButton setState:[[tabViewItem identifier] isProcessing]];
341   - }
342   -
343   - if ([[tabViewItem identifier] respondsToSelector:@selector(isEdited)]) {
344   - [isEditedButton setState:[[tabViewItem identifier] isEdited]];
345   - }
346   -
347   - if ([[tabViewItem identifier] respondsToSelector:@selector(iconName)]) {
348   - NSString *newName = [[tabViewItem identifier] iconName];
349   - if (newName) {
350   - [iconButton selectItem:[[iconButton menu] itemWithTitle:newName]];
351   - } else {
352   - [iconButton selectItem:[[iconButton menu] itemWithTitle:@"None"]];
353   - }
354   - }
355   -}
356   -
357   -- (BOOL)tabView:(NSTabView *)aTabView shouldCloseTabViewItem:(NSTabViewItem *)tabViewItem
358   -{
359   - if ([[tabViewItem label] isEqualToString:@"Drake"]) {
360   - NSAlert *drakeAlert = [NSAlert alertWithMessageText:@"No Way!" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"I refuse to close a tab named \"Drake\""];
361   - [drakeAlert beginSheetModalForWindow:[NSApp keyWindow] modalDelegate:nil didEndSelector:nil contextInfo:nil];
362   - return NO;
363   - }
364   - return YES;
365   -}
366   -
367   -- (void)tabView:(NSTabView *)aTabView didCloseTabViewItem:(NSTabViewItem *)tabViewItem
368   -{
369   - NSLog(@"didCloseTabViewItem: %@", [tabViewItem label]);
370   -}
371   -
372   -- (NSArray *)allowedDraggedTypesForTabView:(NSTabView *)aTabView
373   -{
374   - return [NSArray arrayWithObjects:NSFilenamesPboardType, NSStringPboardType, nil];
375   -}
376   -
377   -- (void)tabView:(NSTabView *)aTabView acceptedDraggingInfo:(id <NSDraggingInfo>)draggingInfo onTabViewItem:(NSTabViewItem *)tabViewItem
378   -{
379   - NSLog(@"acceptedDraggingInfo: %@ onTabViewItem: %@", [[draggingInfo draggingPasteboard] stringForType:[[[draggingInfo draggingPasteboard] types] objectAtIndex:0]], [tabViewItem label]);
380   -}
381   -
382   -- (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem
383   -{
384   - NSLog(@"menuForTabViewItem: %@", [tabViewItem label]);
385   - return nil;
386   -}
387   -
388   -- (BOOL)tabView:(NSTabView*)aTabView shouldDragTabViewItem:(NSTabViewItem *)tabViewItem fromTabBar:(PSMTabBarControl *)tabBarControl
389   -{
390   - return YES;
391   -}
392   -
393   -- (BOOL)tabView:(NSTabView*)aTabView shouldDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl
394   -{
395   - return YES;
396   -}
397   -
398   -- (void)tabView:(NSTabView*)aTabView didDropTabViewItem:(NSTabViewItem *)tabViewItem inTabBar:(PSMTabBarControl *)tabBarControl
399   -{
400   - NSLog(@"didDropTabViewItem: %@ inTabBar: %@", [tabViewItem label], tabBarControl);
401   -}
402   -
403   -- (NSImage *)tabView:(NSTabView *)aTabView imageForTabViewItem:(NSTabViewItem *)tabViewItem offset:(NSSize *)offset styleMask:(NSUInteger *)styleMask
404   -{
405   - // grabs whole window image
406   - NSImage *viewImage = [[[NSImage alloc] init] autorelease];
407   - NSRect contentFrame = [[[self window] contentView] frame];
408   - [[[self window] contentView] lockFocus];
409   - NSBitmapImageRep *viewRep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect:contentFrame] autorelease];
410   - [viewImage addRepresentation:viewRep];
411   - [[[self window] contentView] unlockFocus];
412   -
413   - // grabs snapshot of dragged tabViewItem's view (represents content being dragged)
414   - NSView *viewForImage = [tabViewItem view];
415   - NSRect viewRect = [viewForImage frame];
416   - NSImage *tabViewImage = [[[NSImage alloc] initWithSize:viewRect.size] autorelease];
417   - [tabViewImage lockFocus];
418   - [viewForImage drawRect:[viewForImage bounds]];
419   - [tabViewImage unlockFocus];
420   -
421   - [viewImage lockFocus];
422   - NSPoint tabOrigin = [tabView frame].origin;
423   - tabOrigin.x += 10;
424   - tabOrigin.y += 13;
425   - [tabViewImage compositeToPoint:tabOrigin operation:NSCompositeSourceOver];
426   - [viewImage unlockFocus];
427   -
428   - //draw over where the tab bar would usually be
429   - NSRect tabFrame = [tabBar frame];
430   - [viewImage lockFocus];
431   - [[NSColor windowBackgroundColor] set];
432   - NSRectFill(tabFrame);
433   - //draw the background flipped, which is actually the right way up
434   - NSAffineTransform *transform = [NSAffineTransform transform];
435   - [transform scaleXBy:1.0 yBy:-1.0];
436   - [transform concat];
437   - tabFrame.origin.y = -tabFrame.origin.y - tabFrame.size.height;
438   - [(id <PSMTabStyle>)[[aTabView delegate] style] drawBackgroundInRect:tabFrame];
439   - [transform invert];
440   - [transform concat];
441   -
442   - [viewImage unlockFocus];
443   -
444   - if ([(PSMTabBarControl *)[aTabView delegate] orientation] == PSMTabBarHorizontalOrientation) {
445   - offset->width = [(id <PSMTabStyle>)[[aTabView delegate] style] leftMarginForTabBarControl];
446   - offset->height = 22;
447   - } else {
448   - offset->width = 0;
449   - offset->height = 22 + [(id <PSMTabStyle>)[[aTabView delegate] style] leftMarginForTabBarControl];
450   - }
451   -
452   - if (styleMask) {
453   - *styleMask = NSTitledWindowMask | NSTexturedBackgroundWindowMask;
454   - }
455   -
456   - return viewImage;
457   -}
458   -
459   -- (PSMTabBarControl *)tabView:(NSTabView *)aTabView newTabBarForDraggedTabViewItem:(NSTabViewItem *)tabViewItem atPoint:(NSPoint)point
460   -{
461   - NSLog(@"newTabBarForDraggedTabViewItem: %@ atPoint: %@", [tabViewItem label], NSStringFromPoint(point));
462   -
463   - //create a new window controller with no tab items
464   - DemoWindowController *controller = [[DemoWindowController alloc] initWithWindowNibName:@"DemoWindow"];
465   - id <PSMTabStyle> style = (id <PSMTabStyle>)[[aTabView delegate] style];
466   -
467   - NSRect windowFrame = [[controller window] frame];
468   - point.y += windowFrame.size.height - [[[controller window] contentView] frame].size.height;
469   - point.x -= [style leftMarginForTabBarControl];
470   -
471   - [[controller window] setFrameTopLeftPoint:point];
472   - [[controller tabBar] setStyle:style];
473   -
474   - return [controller tabBar];
475   -}
476   -
477   -- (void)tabView:(NSTabView *)aTabView closeWindowForLastTabViewItem:(NSTabViewItem *)tabViewItem
478   -{
479   - NSLog(@"closeWindowForLastTabViewItem: %@", [tabViewItem label]);
480   - [[self window] close];
481   -}
482   -
483   -- (void)tabView:(NSTabView *)aTabView tabBarDidHide:(PSMTabBarControl *)tabBarControl
484   -{
485   - NSLog(@"tabBarDidHide: %@", tabBarControl);
486   -}
487   -
488   -- (void)tabView:(NSTabView *)aTabView tabBarDidUnhide:(PSMTabBarControl *)tabBarControl
489   -{
490   - NSLog(@"tabBarDidUnhide: %@", tabBarControl);
491   -}
492   -
493   -- (NSString *)tabView:(NSTabView *)aTabView toolTipForTabViewItem:(NSTabViewItem *)tabViewItem
494   -{
495   - return [tabViewItem label];
496   -}
497   -
498   -- (NSString *)accessibilityStringForTabView:(NSTabView *)aTabView objectCount:(NSInteger)objectCount
499   -{
500   - return (objectCount == 1) ? @"item" : @"items";
501   -}
502   -
503   -#pragma mark -
504   -#pragma mark ---- toolbar ----
505   -
506   -- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
507   -{
508   - NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier];
509   -
510   - if ([itemIdentifier isEqualToString:@"TabField"]) {
511   - [item setPaletteLabel:@"Tab Label"];
512   - [item setLabel:@"Tab Label"];
513   - [item setView:tabField];
514   - [item setMinSize:NSMakeSize(100, [tabField frame].size.height)];
515   - [item setMaxSize:NSMakeSize(500, [tabField frame].size.height)];
516   - } else if ([itemIdentifier isEqualToString:@"DrawerItem"]) {
517   - [item setPaletteLabel:@"Configuration"];
518   - [item setLabel:@"Configuration"];
519   - [item setToolTip:@"Configuration"];
520   - [item setImage:[NSImage imageNamed:@"32x32_log"]];
521   - [item setTarget:drawer];
522   - [item setAction:@selector(toggle:)];
523   - }
524   -
525   - return [item autorelease];
526   -}
527   -
528   -- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar*)toolbar
529   -{
530   - return [NSArray arrayWithObjects:@"TabField",
531   - NSToolbarFlexibleSpaceItemIdentifier,
532   - @"DrawerItem",
533   - nil];
534   -}
535   -
536   -- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
537   -{
538   - return [NSArray arrayWithObjects:@"TabField",
539   - NSToolbarFlexibleSpaceItemIdentifier,
540   - @"DrawerItem",
541   - nil];
542   -}
543   -
544   -- (IBAction)toggleToolbar:(id)sender
545   -{
546   - [[[self window] toolbar] setVisible:![[[self window] toolbar] isVisible]];
547   -}
548   -
549   -- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
550   -{
551   - return YES;
552   -}
553   -
554   -
555   -- (void)configureTabBarInitially
556   -{
557   - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
558   - [popUp_style selectItemWithTitle:[defaults stringForKey:@"Style"]];
559   - [popUp_orientation selectItemWithTitle:[defaults stringForKey:@"Orientation"]];
560   - [popUp_tearOff selectItemWithTitle:[defaults stringForKey:@"Tear-Off"]];
561   -
562   - [button_canCloseOnlyTab setState:[defaults boolForKey:@"CanCloseOnlyTab"]];
563   - [button_disableTabClosing setState:[defaults boolForKey:@"DisableTabClosing"]];
564   - [button_hideForSingleTab setState:[defaults boolForKey:@"HideForSingleTab"]];
565   - [button_showAddTab setState:[defaults boolForKey:@"ShowAddTabButton"]];
566   - [button_sizeToFit setState:[defaults boolForKey:@"SizeToFit"]];
567   - [button_useOverflow setState:[defaults boolForKey:@"UseOverflowMenu"]];
568   - [button_automaticallyAnimate setState:[defaults boolForKey:@"AutomaticallyAnimates"]];
569   - [button_allowScrubbing setState:[defaults boolForKey:@"AllowScrubbing"]];
570   -
571   - [self configStyle:popUp_style];
572   - [self configOrientation:popUp_orientation];
573   - [self configCanCloseOnlyTab:button_canCloseOnlyTab];
574   - [self configDisableTabClose:button_disableTabClosing];
575   - [self configHideForSingleTab:button_hideForSingleTab];
576   - [self configAddTabButton:button_showAddTab];
577   - [self configTabMinWidth:textField_minWidth];
578   - [self configTabMaxWidth:textField_maxWidth];
579   - [self configTabOptimumWidth:textField_optimumWidth];
580   - [self configTabSizeToFit:button_sizeToFit];
581   - [self configTearOffStyle:popUp_tearOff];
582   - [self configUseOverflowMenu:button_useOverflow];
583   - [self configAutomaticallyAnimates:button_automaticallyAnimate];
584   - [self configAllowsScrubbing:button_allowScrubbing];
585   -}
586   -@end
39 PSMAdiumTabStyle.h
... ... @@ -1,39 +0,0 @@
1   -//
2   -// PSMAdiumTabStyle.h
3   -// PSMTabBarControl
4   -//
5   -// Created by Kent Sutherland on 5/26/06.
6   -// Copyright 2006 Kent Sutherland. All rights reserved.
7   -//
8   -
9   -#import <Cocoa/Cocoa.h>
10   -#import "PSMTabStyle.h"
11   -
12   -@interface PSMAdiumTabStyle : NSObject <PSMTabStyle>
13   -{
14   - NSImage *_closeButton, *_closeButtonDown, *_closeButtonOver;
15   - NSImage *_closeDirtyButton, *_closeDirtyButtonDown, *_closeDirtyButtonOver;
16   - NSImage *_addTabButtonImage, *_addTabButtonPressedImage, *_addTabButtonRolloverImage;
17   - NSImage *_gradientImage;
18   -
19   - NSDictionary *_objectCountStringAttributes;
20   -
21   - PSMTabBarOrientation orientation;
22   - PSMTabBarControl *tabBar;
23   -
24   - BOOL _drawsUnified, _drawsRight;
25   -}
26   -
27   -- (void)loadImages;
28   -
29   -- (BOOL)drawsUnified;
30   -- (void)setDrawsUnified:(BOOL)value;
31   -- (BOOL)drawsRight;
32   -- (void)setDrawsRight:(BOOL)value;
33   -
34   -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
35   -
36   -- (void)encodeWithCoder:(NSCoder *)aCoder;
37   -- (id)initWithCoder:(NSCoder *)aDecoder;
38   -
39   -@end
38 PSMAquaTabStyle.h
... ... @@ -1,38 +0,0 @@
1   -//
2   -// PSMAquaTabStyle.h
3   -// PSMTabBarControl
4   -//
5   -// Created by John Pannell on 2/17/06.
6   -// Copyright 2006 Positive Spin Media. All rights reserved.
7   -//
8   -
9   -#import <Cocoa/Cocoa.h>
10   -#import "PSMTabStyle.h"
11   -
12   -@interface PSMAquaTabStyle : NSObject <PSMTabStyle> {
13   - NSImage *aquaTabBg;
14   - NSImage *aquaTabBgDown;
15   - NSImage *aquaTabBgDownGraphite;
16   - NSImage *aquaTabBgDownNonKey;
17   - NSImage *aquaDividerDown;
18   - NSImage *aquaDivider;
19   - NSImage *aquaCloseButton;
20   - NSImage *aquaCloseButtonDown;
21   - NSImage *aquaCloseButtonOver;
22   - NSImage *aquaCloseDirtyButton;
23   - NSImage *aquaCloseDirtyButtonDown;
24   - NSImage *aquaCloseDirtyButtonOver;
25   - NSImage *_addTabButtonImage;
26   - NSImage *_addTabButtonPressedImage;
27   - NSImage *_addTabButtonRolloverImage;
28   -
29   - NSDictionary *_objectCountStringAttributes;
30   - PSMTabBarControl *tabBar;
31   -}
32   -
33   -- (void)loadImages;
34   -- (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView;
35   -
36   -- (void)encodeWithCoder:(NSCoder *)aCoder;
37   -- (id)initWithCoder:(NSCoder *)aDecoder;
38   -@end
572 PSMAquaTabStyle.m
... ... @@ -1,572 +0,0 @@
1   -//
2   -// PSMAquaTabStyle.m
3   -// PSMTabBarControl
4   -//
5   -// Created by John Pannell on 2/17/06.
6   -// Copyright 2006 Positive Spin Media. All rights reserved.
7   -//
8   -
9   -#import "PSMAquaTabStyle.h"
10   -#import "PSMTabBarCell.h"
11   -#import "PSMTabBarControl.h"
12   -
13   -#define kPSMAquaObjectCounterRadius 7.0
14   -#define kPSMAquaCounterMinWidth 20
15   -
16   -@implementation PSMAquaTabStyle
17   -
18   -- (NSString *)name
19   -{
20   - return @"Aqua";
21   -}
22   -
23   -#pragma mark -
24   -#pragma mark Creation/Destruction
25   -
26   -- (id) init
27   -{
28   - if ( (self = [super init]) ) {
29   - [self loadImages];
30   -
31   - _objectCountStringAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:[[NSFontManager sharedFontManager] convertFont:[NSFont fontWithName:@"Helvetica" size:11.0] toHaveTrait:NSBoldFontMask], NSFontAttributeName,
32   - [[NSColor whiteColor] colorWithAlphaComponent:0.85], NSForegroundColorAttributeName,
33   - nil, nil];
34   - }
35   - return self;
36   -}
37   -
38   -- (void) loadImages
39   -{
40   - // Aqua Tabs Images
41   - aquaTabBg = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsBackground"]];
42   - [aquaTabBg setFlipped:YES];
43   -
44   - aquaTabBgDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDown"]];
45   - [aquaTabBgDown setFlipped:YES];
46   -
47   - aquaTabBgDownGraphite = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownGraphite"]];
48   - [aquaTabBgDown setFlipped:YES];
49   -
50   - aquaTabBgDownNonKey = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsDownNonKey"]];
51   - [aquaTabBgDown setFlipped:YES];
52   -
53   - aquaDividerDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparatorDown"]];
54   - [aquaDivider setFlipped:NO];
55   -
56   - aquaDivider = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabsSeparator"]];
57   - [aquaDivider setFlipped:NO];
58   -
59   - aquaCloseButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front"]];
60   - aquaCloseButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Pressed"]];
61   - aquaCloseButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabClose_Front_Rollover"]];
62   -
63   - aquaCloseDirtyButton = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front"]];
64   - aquaCloseDirtyButtonDown = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Pressed"]];
65   - aquaCloseDirtyButtonOver = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabCloseDirty_Front_Rollover"]];
66   -
67   - _addTabButtonImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNew"]];
68   - _addTabButtonPressedImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewPressed"]];
69   - _addTabButtonRolloverImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"AquaTabNewRollover"]];
70   -}
71   -
72   -- (void)dealloc
73   -{
74   - [aquaTabBg release];
75   - [aquaTabBgDown release];
76   - [aquaDividerDown release];
77   - [aquaDivider release];
78   - [aquaCloseButton release];
79   - [aquaCloseButtonDown release];
80   - [aquaCloseButtonOver release];
81   - [aquaCloseDirtyButton release];
82   - [aquaCloseDirtyButtonDown release];
83   - [aquaCloseDirtyButtonOver release];
84   - [_addTabButtonImage release];
85   - [_addTabButtonPressedImage release];
86   - [_addTabButtonRolloverImage release];
87   -
88   - [_objectCountStringAttributes release];
89   -
90   - [super dealloc];
91   -}
92   -
93   -#pragma mark -
94   -#pragma mark Control Specifics
95   -
96   -- (CGFloat)leftMarginForTabBarControl
97   -{
98   - return 0.0f;
99   -}
100   -
101   -- (CGFloat)rightMarginForTabBarControl
102   -{
103   - return 24.0f;
104   -}
105   -
106   -- (CGFloat)topMarginForTabBarControl
107   -{
108   - return 0.0f;
109   -}
110   -
111   -- (void)setOrientation:(PSMTabBarOrientation)value
112   -{
113   -
114   -}
115   -
116   -#pragma mark -
117   -#pragma mark Add Tab Button
118   -
119   -- (NSImage *)addTabButtonImage
120   -{
121   - return _addTabButtonImage;
122   -}
123   -
124   -- (NSImage *)addTabButtonPressedImage
125   -{
126   - return _addTabButtonPressedImage;
127   -}
128   -
129   -- (NSImage *)addTabButtonRolloverImage
130   -{
131   - return _addTabButtonRolloverImage;
132   -}
133   -
134   -#pragma mark -
135   -#pragma mark Cell Specifics
136   -
137   -- (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation
138   -{
139   - return [cell frame];
140   -}
141   -
142   -- (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame
143   -{
144   - if ([cell hasCloseButton] == NO) {
145   - return NSZeroRect;
146   - }
147   -
148   - NSRect result;
149   - result.size = [aquaCloseButton size];
150   - result.origin.x = cellFrame.origin.x + MARGIN_X;
151   - result.origin.y = cellFrame.origin.y + MARGIN_Y + 2.0;
152   -
153   - return result;
154   -}
155   -
156   -- (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell
157   -{
158   - NSRect cellFrame = [cell frame];
159   -
160   - if ([cell hasIcon] == NO) {
161   - return NSZeroRect;
162   - }
163   -
164   - NSRect result;
165   - result.size = NSMakeSize(kPSMTabBarIconWidth, kPSMTabBarIconWidth);
166   - result.origin.x = cellFrame.origin.x + MARGIN_X;
167   - result.origin.y = cellFrame.origin.y + MARGIN_Y;
168   -
169   - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
170   - result.origin.x += [aquaCloseButton size].width + kPSMTabBarCellPadding;
171   - }
172   -
173   - return result;
174   -}
175   -
176   -- (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell
177   -{
178   - NSRect cellFrame = [cell frame];
179   -
180   - if ([[cell indicator] isHidden]) {
181   - return NSZeroRect;
182   - }
183   -
184   - NSRect result;
185   - result.size = NSMakeSize(kPSMTabBarIndicatorWidth, kPSMTabBarIndicatorWidth);
186   - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - kPSMTabBarIndicatorWidth;
187   - result.origin.y = cellFrame.origin.y + MARGIN_Y;
188   -
189   - return result;
190   -}
191   -
192   -- (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell
193   -{
194   - NSRect cellFrame = [cell frame];
195   -
196   - if ([cell count] == 0) {
197   - return NSZeroRect;
198   - }
199   -
200   - CGFloat countWidth = [[self attributedObjectCountValueForTabCell:cell] size].width;
201   - countWidth += (2 * kPSMAquaObjectCounterRadius - 6.0);
202   - if (countWidth < kPSMAquaCounterMinWidth) {
203   - countWidth = kPSMAquaCounterMinWidth;
204   - }
205   -
206   - NSRect result;
207   - result.size = NSMakeSize(countWidth, 2 * kPSMAquaObjectCounterRadius); // temp
208   - result.origin.x = cellFrame.origin.x + cellFrame.size.width - MARGIN_X - result.size.width;
209   - result.origin.y = cellFrame.origin.y + MARGIN_Y + 1.0;
210   -
211   - if (![[cell indicator] isHidden]) {
212   - result.origin.x -= kPSMTabBarIndicatorWidth + kPSMTabBarCellPadding;
213   - }
214   -
215   - return result;
216   -}
217   -
218   -- (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell
219   -{
220   - CGFloat resultWidth = 0.0;
221   -
222   - // left margin
223   - resultWidth = MARGIN_X;
224   -
225   - // close button?
226   - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed])
227   - resultWidth += [aquaCloseButton size].width + kPSMTabBarCellPadding;
228   -
229   - // icon?
230   - if ([cell hasIcon]) {
231   - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
232   - }
233   -
234   - // the label
235   - resultWidth += kPSMMinimumTitleWidth;
236   -
237   - // object counter?
238   - if ([cell count] > 0) {
239   - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
240   - }
241   -
242   - // indicator?
243   - if ([[cell indicator] isHidden] == NO) {
244   - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
245   - }
246   -
247   - // right margin
248   - resultWidth += MARGIN_X;
249   -
250   - return ceil(resultWidth);
251   -}
252   -
253   -- (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell
254   -{
255   - CGFloat resultWidth = 0.0;
256   -
257   - // left margin
258   - resultWidth = MARGIN_X;
259   -
260   - // close button?
261   - if ([cell hasCloseButton] && ![cell isCloseButtonSuppressed]) {
262   - resultWidth += [aquaCloseButton size].width + kPSMTabBarCellPadding;
263   - }
264   -
265   - // icon?
266   - if ([cell hasIcon]) {
267   - resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding;
268   - }
269   -
270   - // the label
271   - resultWidth += [[cell attributedStringValue] size].width;
272   -
273   - // object counter?
274   - if ([cell count] > 0) {
275   - resultWidth += [self objectCounterRectForTabCell:cell].size.width + kPSMTabBarCellPadding;
276   - }
277   -
278   - // indicator?
279   - if ([[cell indicator] isHidden] == NO) {
280   - resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth;
281   - }
282   -
283   - // right margin
284   - resultWidth += MARGIN_X;
285   -
286   - return ceil(resultWidth);
287   -}
288   -
289   -- (CGFloat)tabCellHeight
290   -{
291   - return kPSMTabBarControlHeight;
292   -}
293   -
294   -#pragma mark -
295   -#pragma mark Cell Values
296   -
297   -- (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell
298   -{
299   - NSString *contents = [NSString stringWithFormat:@"%lu", (unsigned long)[cell count]];
300   - return [[[NSMutableAttributedString alloc] initWithString:contents attributes:_objectCountStringAttributes] autorelease];
301   -}
302   -
303   -- (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell
304   -{
305   - NSMutableAttributedString *attrStr;
306   - NSString * contents = [cell stringValue];
307   - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease];
308   - NSRange range = NSMakeRange(0, [contents length]);
309   -
310   - [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range];
311   -
312   - // Paragraph Style for Truncating Long Text
313   - static NSMutableParagraphStyle *TruncatingTailParagraphStyle = nil;
314   - if (!TruncatingTailParagraphStyle) {
315   - TruncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain];
316   - [TruncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
317   - [TruncatingTailParagraphStyle setAlignment:NSCenterTextAlignment];
318   - }
319   - [attrStr addAttribute:NSParagraphStyleAttributeName value:TruncatingTailParagraphStyle range:range];
320   -