Prepare USB_DataHddFileEnd with a separate function.
[MacTF.git] / ROTableView.m
blobf655cf77b05881fc476176e2625df5a501b1b6d0
1 #import "ROTableView.h"
4 @implementation ROTableView
5 - (void)awakeFromNib
7         [[self window] setAcceptsMouseMovedEvents:YES];
8         trackingTag = [self addTrackingRect:[self frame] owner:self userData:nil assumeInside:NO];
9         mouseOverView = NO;
10         mouseOverRow = -1;
11         lastOverRow = -1;
14 - (void)dealloc
16         [self removeTrackingRect:trackingTag];
17         [super dealloc];
20 - (void)mouseEntered:(NSEvent*)theEvent
22         mouseOverView = YES;
25 - (void)mouseMoved:(NSEvent*)theEvent
27         id myDelegate = [self delegate];
29         if (!myDelegate)
30                 return; // No delegate, no need to track the mouse.
31         if (![myDelegate respondsToSelector:@selector(tableView:willDisplayCell:forTableColumn:row:)])
32                 return; // If the delegate doesn't modify the drawing, don't track.
34         if (mouseOverView) {
35                 mouseOverRow = [self rowAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]];
36                 
37                 if (lastOverRow == mouseOverRow)
38                         return;
39                 else {
40                         [self setNeedsDisplayInRect:[self rectOfRow:lastOverRow]];
41                         lastOverRow = mouseOverRow;
42                 }
44         [self setNeedsDisplayInRect:[self rectOfRow:mouseOverRow]];
45         }
48 - (void)mouseExited:(NSEvent *)theEvent
50         mouseOverView = NO;
51         [self setNeedsDisplayInRect:[self rectOfRow:mouseOverRow]];
52         mouseOverRow = -1;
53         lastOverRow = -1;
56 - (int)mouseOverRow
58         return mouseOverRow;
61 - (void)viewDidEndLiveResize
63         [super viewDidEndLiveResize];
65         [self removeTrackingRect:trackingTag];
66         trackingTag = [self addTrackingRect:[self frame] owner:self userData:nil assumeInside:NO];
69 @end