get button hilighting working correctly when it assumes it's inside the button

This commit is contained in:
Mitchell Livingston
2008-01-15 19:48:19 +00:00
parent 3c4ad2caec
commit 2402b1df2e
3 changed files with 18 additions and 3 deletions

View File

@@ -363,9 +363,8 @@
NSTrackingAreaOptions controlOptions = options;
if (NSMouseInRect(mouseLocation, controlButtonRect, [controlView isFlipped]))
{
#warning update control view
controlOptions |= NSTrackingAssumeInside;
[controlView setNeedsDisplayInRect: controlButtonRect];
[(TorrentTableView *)controlView setControlButtonHover: [[userInfo objectForKey: @"Row"] intValue]];
}
NSMutableDictionary * controlInfo = [userInfo mutableCopy];
@@ -382,7 +381,7 @@
if (NSMouseInRect(mouseLocation, revealButtonRect, [controlView isFlipped]))
{
revealOptions |= NSTrackingAssumeInside;
[controlView setNeedsDisplayInRect: revealButtonRect];
[(TorrentTableView *)controlView setRevealButtonHover: [[userInfo objectForKey: @"Row"] intValue]];
}
NSMutableDictionary * revealInfo = [userInfo mutableCopy];

View File

@@ -49,6 +49,8 @@
- (void) setTorrents: (NSArray *) torrents;
- (void) removeButtonTrackingAreas;
- (void) setControlButtonHover: (int) row;
- (void) setRevealButtonHover: (int) row;
- (void) toggleControlForTorrent: (Torrent *) torrent;

View File

@@ -128,6 +128,20 @@
}
}
- (void) setControlButtonHover: (int) row
{
fMouseControlRow = row;
if (row >= 0)
[self setNeedsDisplayInRect: [self rectOfRow: row]];
}
- (void) setRevealButtonHover: (int) row
{
fMouseRevealRow = row;
if (row >= 0)
[self setNeedsDisplayInRect: [self rectOfRow: row]];
}
- (void) mouseEntered: (NSEvent *) event
{
NSDictionary * dict = (NSDictionary *)[event userData];