Revision: 5301
http://skim-app.svn.sourceforge.net/skim-app/?rev=5301&view=rev
Author: hofman
Date: 2009-04-03 14:10:17 +0000 (Fri, 03 Apr 2009)
Log Message:
-----------
make full text content of textfield cells with icons editable
Modified Paths:
--------------
trunk/SKTextWithIconCell.m
Modified: trunk/SKTextWithIconCell.m
===================================================================
--- trunk/SKTextWithIconCell.m 2009-04-03 11:08:19 UTC (rev 5300)
+++ trunk/SKTextWithIconCell.m 2009-04-03 14:10:17 UTC (rev 5301)
@@ -142,6 +142,24 @@
[super selectWithFrame:[self textRectForBounds:aRect] inView:controlView
editor:textObj delegate:anObject start:selStart length:selLength];
}
+- (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];
+ NSPoint mouseLoc = [controlView convertPoint:[event locationInWindow]
fromView:nil];
+ if (NSMouseInRect(mouseLoc, iconRect, [controlView isFlipped])) {
+ hit = NSCellHitContentArea;
+ } else {
+ NSRect textRect = [self textRectForBounds:cellFrame];
+ float textWidth = [super cellSize].width;
+ if (textWidth < NSWidth(textRect))
+ textRect.size.width = textWidth;
+ if (NSMouseInRect(mouseLoc, textRect, [controlView isFlipped]))
+ hit = NSCellHitContentArea | NSCellHitEditableTextArea;
+ }
+ return hit;
+}
+
- (void)setObjectValue:(id <NSCopying>)obj {
// the objectValue should be an object that's KVC compliant for the
"string" and "image" keys
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit