mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 20:50:38 +00:00
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:
parent
55d59ae5c2
commit
afaa68f9d5
5 changed files with 77 additions and 33 deletions
|
@ -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.
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -3457,45 +3457,73 @@ 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];
|
||||||
[cell setObjectValue: [self _objectValueForTableColumn: tb
|
if ([cell _sendsActionOn: actionMaskForCurrentEvent])
|
||||||
row: _clickedRow]];
|
|
||||||
cellFrame = [self frameOfCellAtColumn: _clickedColumn
|
|
||||||
row: _clickedRow];
|
|
||||||
[cell setHighlighted: YES];
|
|
||||||
[self setNeedsDisplayInRect: cellFrame];
|
|
||||||
/* give delegate a chance to i.e set target */
|
|
||||||
[self _willDisplayCell: cell
|
|
||||||
forTableColumn: tb
|
|
||||||
row: _clickedRow];
|
|
||||||
if ([cell trackMouse: lastEvent
|
|
||||||
inRect: cellFrame
|
|
||||||
ofView: self
|
|
||||||
untilMouseUp: [[cell class] prefersTrackingUntilMouseUp]])
|
|
||||||
{
|
{
|
||||||
if ([tb isEditable])
|
[cell setObjectValue: [self _objectValueForTableColumn: tb
|
||||||
{
|
row: _clickedRow]];
|
||||||
[self _setObjectValue: [cell objectValue]
|
cellFrame = [self frameOfCellAtColumn: _clickedColumn
|
||||||
forTableColumn: tb
|
row: _clickedRow];
|
||||||
row: _clickedRow];
|
[cell setHighlighted: YES];
|
||||||
}
|
[self setNeedsDisplayInRect: cellFrame];
|
||||||
done = YES;
|
/* give delegate a chance to i.e set target */
|
||||||
currentRow = _clickedRow;
|
[self _willDisplayCell: cell
|
||||||
computeNewSelection(self,
|
forTableColumn: tb
|
||||||
oldSelectedRows,
|
row: _clickedRow];
|
||||||
_selectedRows,
|
if ([cell trackMouse: lastEvent
|
||||||
originalRow,
|
inRect: cellFrame
|
||||||
oldRow,
|
ofView: self
|
||||||
currentRow,
|
untilMouseUp: [[cell class] prefersTrackingUntilMouseUp]])
|
||||||
&_selectedRow,
|
{
|
||||||
selectionMode);
|
if ([tb isEditable])
|
||||||
|
{
|
||||||
|
[self _setObjectValue: [cell objectValue]
|
||||||
|
forTableColumn: tb
|
||||||
|
row: _clickedRow];
|
||||||
|
}
|
||||||
|
done = YES;
|
||||||
|
currentRow = _clickedRow;
|
||||||
|
computeNewSelection(self,
|
||||||
|
oldSelectedRows,
|
||||||
|
_selectedRows,
|
||||||
|
originalRow,
|
||||||
|
oldRow,
|
||||||
|
currentRow,
|
||||||
|
&_selectedRow,
|
||||||
|
selectionMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[cell setHighlighted: NO];
|
||||||
|
[self setNeedsDisplayInRect: cellFrame];
|
||||||
|
lastEvent = [NSApp currentEvent];
|
||||||
}
|
}
|
||||||
[cell setHighlighted: NO];
|
|
||||||
[self setNeedsDisplayInRect: cellFrame];
|
|
||||||
lastEvent = [NSApp currentEvent];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (done != YES)
|
while (done != YES)
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue