#import "FileOutlineController.h"
#import "Torrent.h"
#import "FileOutlineView.h"
+#import "FilePriorityCell.h"
#import "NSApplicationAdditions.h"
#define ROW_SMALL_HEIGHT 18.0
if ([identifier isEqualToString: @"Check"])
[cell setEnabled: [fTorrent canChangeDownloadCheckForFiles: [item objectForKey: @"Indexes"]]];
else if ([identifier isEqualToString: @"Priority"])
+ {
[cell setRepresentedObject: item];
+ [(FilePriorityCell *)cell setHovered: [NSApp isOnLeopardOrBetter] ? [fOutline hoveredRow] == [fOutline rowForItem: item] : NO];
+ }
else;
}
#import <Cocoa/Cocoa.h>
@class Torrent;
-@class FilePriorityCell;
@class CTGradient;
@interface FileOutlineView : NSOutlineView
CTGradient * fHighPriorityGradient, * fLowPriorityGradient, * fMixedPriorityGradient;
int fMouseRow;
- FilePriorityCell * fMouseCell;
}
- (void) setTorrent: (Torrent *) torrent;
- (Torrent *) torrent;
+- (int) hoveredRow;
+
@end
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
-#warning treat hovering the same as in the table?
-
#import "FileOutlineView.h"
#import "FileNameCell.h"
#import "FilePriorityCell.h"
[fLowPriorityGradient release];
[fMixedPriorityGradient release];
- [fMouseCell release];
-
[super dealloc];
}
}
}
+- (int) hoveredRow
+{
+ return fMouseRow;
+}
+
- (void) mouseEntered: (NSEvent *) event
{
NSNumber * row;
if ((row = [(NSDictionary *)[event userData] objectForKey: @"Row"]))
{
- int rowVal = [row intValue];
- FilePriorityCell * cell = (FilePriorityCell *)[self preparedCellAtColumn: [self columnWithIdentifier: @"Priority"] row: rowVal];
- if (fMouseCell != cell)
- {
- [fMouseCell release];
-
- fMouseRow = rowVal;
- fMouseCell = [cell copy];
-
- [fMouseCell setControlView: self];
- [fMouseCell mouseEntered: event];
- [fMouseCell setRepresentedObject: [cell representedObject]];
- }
+ fMouseRow = [row intValue];
+ [self setNeedsDisplayInRect: [self rectOfRow: fMouseRow]];
}
}
NSNumber * row;
if ((row = [(NSDictionary *)[event userData] objectForKey: @"Row"]))
{
- FilePriorityCell * cell = (FilePriorityCell *)[self preparedCellAtColumn: [self columnWithIdentifier: @"Priority"]
- row: [row intValue]];
- [cell setControlView: self];
- [cell mouseExited: event];
-
- [fMouseCell release];
- fMouseCell = nil;
+ [self setNeedsDisplayInRect: [self rectOfRow: [row intValue]]];
fMouseRow = -1;
}
}
-- (NSCell *) preparedCellAtColumn: (NSInteger) column row: (NSInteger) row
-{
- if (![self selectedCell] && row == fMouseRow && column == [self columnWithIdentifier: @"Priority"])
- return fMouseCell;
- else
- return [super preparedCellAtColumn: column row: row];
-}
-
-- (void) updateCell: (NSCell *) cell
-{
- if (cell == fMouseCell)
- [self setNeedsDisplayInRect: [self frameOfCellAtColumn: [self columnWithIdentifier: @"Priority"] row: fMouseRow]];
- else
- [super updateCell: cell];
-}
-
- (void) drawRow: (int) row clipRect: (NSRect) clipRect
{
if (![self isRowSelected: row])
[area release];
}
-- (void) mouseEntered: (NSEvent *) event
+- (void) setHovered: (BOOL) hovered
{
- fHoverRow = YES;
- [(NSControl *)[self controlView] updateCell: self];
-}
-
-- (void) mouseExited: (NSEvent *) event
-{
- fHoverRow = NO;
- [(NSControl *)[self controlView] updateCell: self];
+ fHoverRow = hovered;
}
- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView