2004-09-12 Matt Rice <ratmice@yahoo.com>

* Headers/AppKit/NSCell.h (-_sendsActionOn:): New method.
        * Source/NSCell.m (-_sendsActionOn:): Implement it.
        * Source/NSTextFieldCell.m (-initTextCell:): Change _action_mask to a
        key press.
        * Source/NSTableView.m (-mouseDown:): Use _sendsActionOn: to only modify        the object value and send the event to the cell if the cell works on
        mouse events. (Fixes #9609).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20046 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Matt Rice 2004-09-12 16:58:32 +00:00
parent 55d59ae5c2
commit afaa68f9d5
5 changed files with 77 additions and 33 deletions

View file

@ -1,3 +1,12 @@
2004-09-12 Matt Rice <ratmice@yahoo.com>
* Headers/AppKit/NSCell.h (-_sendsActionOn:): New method.
* Source/NSCell.m (-_sendsActionOn:): Implement it.
* Source/NSTextFieldCell.m (-initTextCell:): Change _action_mask to a
key press.
* Source/NSTableView.m (-mouseDown:): Use _sendsActionOn: to only modify
the object value and send the event to the cell if the cell works on
mouse events. (Fixes #9609).
2004-09-12 Gregory John Casamento <greg_casamento@yahoo.com> 2004-09-12 Gregory John Casamento <greg_casamento@yahoo.com>
* Headers/NSDataLinkPanel.h: Added new attributes. * Headers/NSDataLinkPanel.h: Added new attributes.

View file

@ -456,6 +456,7 @@ typedef enum _NSControlSize {
inFrame: (NSRect)aRect; inFrame: (NSRect)aRect;
- (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect - (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect
isFlipped: (BOOL)flipped; isFlipped: (BOOL)flipped;
- (BOOL) _sendsActionOn:(int)eventTypeMask;
@end @end
// //

View file

@ -2213,6 +2213,10 @@ static NSColor *shadowCol;
[anImage compositeToPoint: position operation: NSCompositeSourceOver]; [anImage compositeToPoint: position operation: NSCompositeSourceOver];
} }
- (BOOL) _sendsActionOn:(int)eventTypeMask
{
return (_action_mask & eventTypeMask);
}
@end @end

View file

@ -3457,10 +3457,36 @@ inline float computePeriod(NSPoint mouseLocationWin,
NSTableColumn *tb; NSTableColumn *tb;
NSCell *cell; NSCell *cell;
NSRect cellFrame; NSRect cellFrame;
int actionMaskForCurrentEvent;
switch ([lastEvent type])
{
case NSLeftMouseDown:
actionMaskForCurrentEvent = NSLeftMouseDownMask
| NSLeftMouseUpMask
| NSLeftMouseDraggedMask;
break;
case NSRightMouseDown:
actionMaskForCurrentEvent = NSRightMouseDownMask
| NSRightMouseUpMask
| NSRightMouseDraggedMask;
break;
case NSOtherMouseDown:
actionMaskForCurrentEvent = NSOtherMouseDownMask
| NSOtherMouseUpMask
| NSOtherMouseDraggedMask;
break;
default:
/* Can't happen */
actionMaskForCurrentEvent = -1;
break;
}
// Prepare the cell // Prepare the cell
tb = [_tableColumns objectAtIndex: _clickedColumn]; tb = [_tableColumns objectAtIndex: _clickedColumn];
cell = [tb dataCellForRow: _clickedRow]; cell = [tb dataCellForRow: _clickedRow];
if ([cell _sendsActionOn: actionMaskForCurrentEvent])
{
[cell setObjectValue: [self _objectValueForTableColumn: tb [cell setObjectValue: [self _objectValueForTableColumn: tb
row: _clickedRow]]; row: _clickedRow]];
cellFrame = [self frameOfCellAtColumn: _clickedColumn cellFrame = [self frameOfCellAtColumn: _clickedColumn
@ -3493,10 +3519,12 @@ inline float computePeriod(NSPoint mouseLocationWin,
&_selectedRow, &_selectedRow,
selectionMode); selectionMode);
} }
[cell setHighlighted: NO]; [cell setHighlighted: NO];
[self setNeedsDisplayInRect: cellFrame]; [self setNeedsDisplayInRect: cellFrame];
lastEvent = [NSApp currentEvent]; lastEvent = [NSApp currentEvent];
} }
}
while (done != YES) while (done != YES)
{ {

View file

@ -35,6 +35,7 @@
#include "AppKit/NSGraphics.h" #include "AppKit/NSGraphics.h"
#include "AppKit/NSTextFieldCell.h" #include "AppKit/NSTextFieldCell.h"
#include "AppKit/NSText.h" #include "AppKit/NSText.h"
#include "AppKit/NSEvent.h"
static NSColor *bgCol; static NSColor *bgCol;
static NSColor *txtCol; static NSColor *txtCol;
@ -94,6 +95,7 @@ static NSColor *txtCol;
ASSIGN(_background_color, bgCol); ASSIGN(_background_color, bgCol);
_textfieldcell_draws_background = NO; _textfieldcell_draws_background = NO;
_textfieldcell_is_opaque = NO; _textfieldcell_is_opaque = NO;
_action_mask = NSKeyUpMask | NSKeyDownMask;
return self; return self;
} }