This repository was archived by the owner on Nov 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,39 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell {
197
197
#pragma mark -
198
198
#pragma mark Determining Cell Size
199
199
200
+ - (CGFloat )desiredWidthOfTabCell : (PSMTabBarCell *)cell {
201
+ CGFloat resultWidth = 0.0 ;
202
+
203
+ // left margin
204
+ resultWidth = MARGIN_X;
205
+
206
+ // icon or close button?
207
+ if ([cell hasIcon ]) {
208
+ resultWidth += kPSMTabBarIconWidth + kPSMTabBarCellPadding ;
209
+ } else if ([cell shouldDrawCloseButton ]) {
210
+ NSImage *image = [cell closeButtonImageOfType: PSMCloseButtonImageTypeStandard];
211
+ resultWidth += [image size ].width + kPSMTabBarCellPadding ;
212
+ }
213
+
214
+ // the label
215
+ resultWidth += [[cell attributedStringValue ] size ].width ;
216
+
217
+ // object counter?
218
+ if ([cell count ] > 0 ) {
219
+ resultWidth += [cell objectCounterSize ].width + kPSMTabBarCellPadding ;
220
+ }
221
+
222
+ // indicator?
223
+ if ([[cell indicator ] isHidden ] == NO ) {
224
+ resultWidth += kPSMTabBarCellPadding + kPSMTabBarIndicatorWidth ;
225
+ }
226
+
227
+ // right margin
228
+ resultWidth += MARGIN_X;
229
+
230
+ return ceil (resultWidth);
231
+ }
232
+
200
233
- (CGFloat )heightOfTabCellsForTabBarControl : (PSMTabBarControl *)tabBarControl {
201
234
PSMTabBarOrientation orientation = [tabBarControl orientation ];
202
235
return ((orientation == PSMTabBarHorizontalOrientation) ? kPSMTabBarControlHeight : kPSMTabBarControlSourceListHeight );
Original file line number Diff line number Diff line change @@ -353,7 +353,7 @@ - (NSRect)closeButtonRectForBounds:(NSRect)theRect {
353
353
- (CGFloat )minimumWidthOfCell {
354
354
355
355
id < PSMTabStyle > style = [[self controlView ] style ];
356
- if ([style respondsToSelector: @selector (minimumWidthOfTabCell )]) {
356
+ if ([style respondsToSelector: @selector (minimumWidthOfTabCell: )]) {
357
357
return [style minimumWidthOfTabCell: self ];
358
358
} else {
359
359
return [self _minimumWidthOfCell ];
@@ -363,7 +363,7 @@ - (CGFloat)minimumWidthOfCell {
363
363
- (CGFloat )desiredWidthOfCell {
364
364
365
365
id < PSMTabStyle > style = [[self controlView ] style ];
366
- if ([style respondsToSelector: @selector (desiredWidthOfTabCell )]) {
366
+ if ([style respondsToSelector: @selector (desiredWidthOfTabCell: )]) {
367
367
return [style desiredWidthOfTabCell: self ];
368
368
} else {
369
369
return [self _desiredWidthOfCell ];
You can’t perform that action at this time.
0 commit comments