1414
1515
1616@implementation PSMTabBarCell
17+ @dynamic controlView;
1718
1819#pragma mark -
1920#pragma mark Creation/Destruction
2021- (id )initWithControlView : (PSMTabBarControl *)controlView
2122{
2223 self = [super init ];
2324 if (self){
24- _controlView = controlView;
25+ self. controlView = controlView;
2526 _closeButtonTrackingTag = 0 ;
2627 _cellTrackingTag = 0 ;
2728 _closeButtonOver = NO ;
@@ -41,7 +42,7 @@ - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:
4142{
4243 self = [super init ];
4344 if (self){
44- _controlView = controlView;
45+ self. controlView = controlView;
4546 _isPlaceholder = YES ;
4647 if (!value)
4748 frame.size .width = 0.0 ;
@@ -76,17 +77,6 @@ - (void)dealloc
7677#pragma mark -
7778#pragma mark Accessors
7879
79- - (id )controlView
80- {
81- return _controlView;
82- }
83-
84- - (void )setControlView : (id )view
85- {
86- // no retain release pattern, as this simply switches a tab to another view.
87- _controlView = view;
88- }
89-
9080- (NSTrackingRectTag )closeButtonTrackingTag
9181{
9282 return _closeButtonTrackingTag;
@@ -127,7 +117,7 @@ - (void)setStringValue:(NSString *)aString
127117 [super setStringValue: aString];
128118 _stringSize = [[self attributedStringValue ] size ];
129119 // need to redisplay now - binding observation was too quick.
130- [_controlView update ];
120+ [self .controlView update ];
131121}
132122
133123- (NSSize )stringSize
@@ -137,7 +127,7 @@ - (NSSize)stringSize
137127
138128- (NSAttributedString *)attributedStringValue
139129{
140- return [[_controlView psmTabStyle ] attributedStringValueForTabCell: self ];
130+ return [[self .controlView psmTabStyle ] attributedStringValueForTabCell: self ];
141131}
142132
143133- (int )tabState
@@ -213,7 +203,7 @@ - (BOOL)hasIcon
213203- (void )setHasIcon : (BOOL )value
214204{
215205 _hasIcon = value;
216- [_controlView update ]; // binding notice is too fast
206+ [self .controlView update ]; // binding notice is too fast
217207}
218208
219209- (int )count
@@ -224,7 +214,7 @@ - (int)count
224214- (void )setCount : (int )value
225215{
226216 _count = value;
227- [_controlView update ]; // binding notice is too fast
217+ [self .controlView update ]; // binding notice is too fast
228218}
229219
230220- (BOOL )isPlaceholder
@@ -271,22 +261,22 @@ - (void)setToolTip:(NSString *)tip
271261
272262- (NSRect )indicatorRectForFrame : (NSRect )cellFrame
273263{
274- return [[_controlView psmTabStyle ] indicatorRectForTabCell: self ];
264+ return [[self .controlView psmTabStyle ] indicatorRectForTabCell: self ];
275265}
276266
277267- (NSRect )closeButtonRectForFrame : (NSRect )cellFrame
278268{
279- return [[_controlView psmTabStyle ] closeButtonRectForTabCell: self ];
269+ return [[self .controlView psmTabStyle ] closeButtonRectForTabCell: self ];
280270}
281271
282272- (float )minimumWidthOfCell
283273{
284- return [[_controlView psmTabStyle ] minimumWidthOfTabCell: self ];
274+ return [[self .controlView psmTabStyle ] minimumWidthOfTabCell: self ];
285275}
286276
287277- (float )desiredWidthOfCell
288278{
289- return [[_controlView psmTabStyle ] desiredWidthOfTabCell: self ];
279+ return [[self .controlView psmTabStyle ] desiredWidthOfTabCell: self ];
290280}
291281
292282#pragma mark -
@@ -300,7 +290,7 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
300290 return ;
301291 }
302292
303- [[_controlView psmTabStyle ] drawTabCell: self ];
293+ [[self .controlView psmTabStyle ] drawTabCell: self ];
304294}
305295
306296#pragma mark -
@@ -315,7 +305,7 @@ - (void)mouseEntered:(NSEvent *)theEvent
315305 if ([theEvent trackingNumber ] == _cellTrackingTag){
316306 [self setHighlighted: YES ];
317307 }
318- [_controlView setNeedsDisplay ];
308+ [self .controlView setNeedsDisplay ];
319309}
320310
321311- (void )mouseExited : (NSEvent *)theEvent
@@ -327,22 +317,22 @@ - (void)mouseExited:(NSEvent *)theEvent
327317 if ([theEvent trackingNumber ] == _cellTrackingTag){
328318 [self setHighlighted: NO ];
329319 }
330- [_controlView setNeedsDisplay ];
320+ [self .controlView setNeedsDisplay ];
331321}
332322
333323#pragma mark -
334324#pragma mark Drag Support
335325
336326- (NSImage *)dragImageForRect : (NSRect )cellFrame
337327{
338- if (([self state ] == NSOnState ) && ([[_controlView styleName ] isEqualToString: @" Metal" ]))
328+ if (([self state ] == NSOnState ) && ([[self .controlView styleName ] isEqualToString: @" Metal" ]))
339329 cellFrame.size .width += 1.0 ;
340- [_controlView lockFocus ];
330+ [self .controlView lockFocus ];
341331
342332 NSBitmapImageRep *rep = [[self controlView ] bitmapImageRepForCachingDisplayInRect: cellFrame];
343333 [[self controlView ] cacheDisplayInRect: cellFrame toBitmapImageRep: rep];
344334
345- [_controlView unlockFocus ];
335+ [self .controlView unlockFocus ];
346336 NSImage *image = [[[NSImage alloc ] initWithSize: [rep size ]] autorelease ];
347337 [image addRepresentation: rep];
348338 NSImage *returnImage = [[[NSImage alloc ] initWithSize: [rep size ]] autorelease ];
@@ -353,7 +343,7 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame
353343 NSImage *pi = [[NSImage alloc ] initByReferencingFile: [[PSMTabBarControl bundle ] pathForImageResource: @" pi" ]];
354344 [returnImage lockFocus ];
355345 NSPoint indicatorPoint = NSMakePoint ([self frame ].size .width - MARGIN_X - kPSMTabBarIndicatorWidth , MARGIN_Y);
356- if (([self state ] == NSOnState ) && ([[_controlView styleName ] isEqualToString: @" Metal" ]))
346+ if (([self state ] == NSOnState ) && ([[self .controlView styleName ] isEqualToString: @" Metal" ]))
357347 indicatorPoint.y += 1.0 ;
358348 [pi drawAtPoint: indicatorPoint fromRect: NSZeroRect operation: NSCompositingOperationSourceOver fraction: 0.7 ];
359349 [returnImage unlockFocus ];
0 commit comments