- rect.origin.y = 0;
- rect.size.height = 17;
- rect.size.width += 1;
-
- [headerCell setState: ([[self cell] isHighlighted]) ? NSOnState : NSOffState];
- [headerCell drawWithFrame:rect inView:nil];
-
- if ([self image]) {
- [[self image] drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
- }
+ NSImage *drawImage;
+
+ rect.origin.y = 0;
+ rect.size.height = 17;
+ rect.size.width += 1;
+
+ [headerCell setState:([[self cell] isHighlighted] ? NSOnState : NSOffState)];
+ [headerCell drawWithFrame:rect inView:nil];
+
+ if ((drawImage = [self image])) {
+ BOOL oldFlipped = [drawImage isFlipped];
+ [drawImage setFlipped:YES];
+ [drawImage drawAtPoint:rect.origin fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0];
+ [drawImage setFlipped:oldFlipped];
+ }
+}
+
+- (void)setImage:(NSImage *)anImage {
+ [super setImage:anImage];
+ [image autorelease];
+ image = [anImage copy];
+}
+
+- (NSImage *)image {
+ return (image ? image : [super image]);