diff --git a/ChangeLog b/ChangeLog index 15cba501f..912f1fa93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-05-06 German A. Arias + + * Source/NSSearchFieldCell.m: Add method -resetCursorRect:inView: and an + inline method to handle correctly the mouse cursor. + 2013-04-24 05:23-EDT Gregory John Casamento * Headers/AppKit/NSPopover.h: correct delegate method diff --git a/Source/NSSearchFieldCell.m b/Source/NSSearchFieldCell.m index 7744f30af..3150c34a5 100644 --- a/Source/NSSearchFieldCell.m +++ b/Source/NSSearchFieldCell.m @@ -59,6 +59,19 @@ @implementation NSSearchFieldCell +#define ICON_WIDTH 16 + +// Inlined method + +static inline NSRect textCellFrameFromRect(NSRect cellRect) +// Not the drawed part, precises just the part which receives events +{ + return NSMakeRect(cellRect.origin.x + ICON_WIDTH, + NSMinY(cellRect), + NSWidth(cellRect) - 2*ICON_WIDTH, + NSHeight(cellRect)); +} + - (id) initTextCell:(NSString *)aString { self = [super initTextCell: aString]; @@ -306,8 +319,6 @@ [c setKeyEquivalentModifierMask: 0]; } -#define ICON_WIDTH 16 - - (NSRect) cancelButtonRectForBounds: (NSRect)rect { NSRect part, clear; @@ -442,6 +453,12 @@ untilMouseUp: untilMouseUp]; } +- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView *)controlView +{ + [super resetCursorRect: textCellFrameFromRect(cellFrame) + inView: controlView]; +} + - (void) textDidChange: (NSNotification *)notification { NSText *textObject;