Revision: 5317
http://skim-app.svn.sourceforge.net/skim-app/?rev=5317&view=rev
Author: hofman
Date: 2009-04-17 09:58:07 +0000 (Fri, 17 Apr 2009)
Log Message:
-----------
simplify hit testing in SKTextWithIconCell, use super and return None when
outside text or icon.
Modified Paths:
--------------
trunk/SKTextWithIconCell.m
Modified: trunk/SKTextWithIconCell.m
===================================================================
--- trunk/SKTextWithIconCell.m 2009-04-16 16:39:13 UTC (rev 5316)
+++ trunk/SKTextWithIconCell.m 2009-04-17 09:58:07 UTC (rev 5317)
@@ -143,20 +143,13 @@
}
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame
ofView:(NSView *)controlView {
- NSUInteger hit = [super hitTestForEvent:event inRect:cellFrame
ofView:controlView];
- // super returns 0 for button clicks, so -[NSTableView mouseDown:] doesn't
track the cell
- NSRect iconRect = [self iconRectForBounds:cellFrame];
+ NSRect textRect = [self textRectForBounds:cellFrame];
NSPoint mouseLoc = [controlView convertPoint:[event locationInWindow]
fromView:nil];
- if (NSMouseInRect(mouseLoc, iconRect, [controlView isFlipped])) {
+ NSUInteger hit = NSCellHitNone;
+ if (NSMouseInRect(mouseLoc, textRect, [controlView isFlipped]))
+ hit = [super hitTestForEvent:event inRect:textRect ofView:controlView];
+ else if (NSMouseInRect(mouseLoc, [self iconRectForBounds:cellFrame],
[controlView isFlipped]))
hit = NSCellHitContentArea;
- } else {
- NSRect textRect = [self textRectForBounds:cellFrame];
- CGFloat textWidth = [super cellSize].width;
- if (textWidth < NSWidth(textRect) && [[self stringValue] length])
- textRect.size.width = textWidth;
- if (NSMouseInRect(mouseLoc, textRect, [controlView isFlipped]))
- hit = NSCellHitContentArea | NSCellHitEditableTextArea;
- }
return hit;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit