* Source/NSButtonCell.m ([NSButtonCell -drawInteriorWithFrame:

inView:]): fix mask if cell is highlighted and it isn't in off state.

* Source/NSCell.m ([NSCell -trackMouse:inRect:ofView:untilMouseUp:]):
set next cell state and send action after -stopTracking:

* Source/NSBrowser.m ([NSBrowser -keyDown:]): does nothing for arrow up
and down.
([NSBrowser -moveUp:]): removed.
([NSBrowser -moveDown:]): removed.
([NSBrowser -_performLoadOfColumn:]): fix matrix creation, enable
matrix autoscroll.
([NSBrowser -_performLoadOfColumn:]): implemented reusesColumns.

* Source/NSMatrix.m ([NSMatrix -keyDown:]): implemented keyboard
navigation.
([NSMatrix -moveUp:]): likewise.
([NSMatrix -moveDown:]): likewise.
([NSMatrix -moveLeft:]): likewise.
([NSMatrix -moveRight:]): likewise.
([NSMatrix -performClick:]): implemented.
([NSMatrix -mouseDown:]): scroll rect only if autoscroll is enabled,
do not hightlight a cell directly but use the matrix method.
Now it handles only NSListModeMatrix mode to reduce complexity
introduced by other modes.
([NSMatrix -_mouseDownNonListMode:]): fixed.
([NSMatrix -highlightCell:atRow:column:]): enable the cell dotted
outline.
([NSMatrix -drawCellAtRow:column:]): likewise.
([NSMatrix -drawRect:]): removed drawing of dotted outline. Rewritten
due to changes in -getRow:column:forPoint:
([NSMatrix -getRow:column:forPoint:]): set row and column to -1 if
point is not inside a cell.
([NSMatrix -_selectCell:atRow:column:]): use mnemonic value for cell
state, does not enable dotted outline and check for nil aCell.
([NSMatrix -selectTextAtRow:column:]): likewise.
([NSMatrix -_setState:highlight:startIndex:endIndex:]): use matrix
highlightCell: method and mnemonic for cell state.
([NSMatrix -deselectAllCells]): likewise.
([NSMatrix -selectAll:]): likewise.
([NSMatrix -setSelectionFrom:to:anchor:highlight:]): likewise.
([NSMatrix -performKeyEquivalent:]): select next cell state.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9594 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mirko 2001-04-16 19:52:52 +00:00
parent dd51dba9d6
commit 8f6950db88
5 changed files with 933 additions and 475 deletions

View file

@ -1,3 +1,48 @@
2001-04-16 Mirko Viviani <mirko.viviani@rccr.cremona.it>
* Source/NSButtonCell.m ([NSButtonCell -drawInteriorWithFrame:
inView:]): fix mask if cell is highlighted and it isn't in off state.
* Source/NSCell.m ([NSCell -trackMouse:inRect:ofView:untilMouseUp:]):
set next cell state and send action after -stopTracking:
* Source/NSBrowser.m ([NSBrowser -keyDown:]): does nothing for arrow up
and down.
([NSBrowser -moveUp:]): removed.
([NSBrowser -moveDown:]): removed.
([NSBrowser -_performLoadOfColumn:]): fix matrix creation, enable
matrix autoscroll.
([NSBrowser -_performLoadOfColumn:]): implemented reusesColumns.
* Source/NSMatrix.m ([NSMatrix -keyDown:]): implemented keyboard
navigation.
([NSMatrix -moveUp:]): likewise.
([NSMatrix -moveDown:]): likewise.
([NSMatrix -moveLeft:]): likewise.
([NSMatrix -moveRight:]): likewise.
([NSMatrix -performClick:]): implemented.
([NSMatrix -mouseDown:]): scroll rect only if autoscroll is enabled,
do not hightlight a cell directly but use the matrix method.
Now it handles only NSListModeMatrix mode to reduce complexity
introduced by other modes.
([NSMatrix -_mouseDownNonListMode:]): fixed.
([NSMatrix -highlightCell:atRow:column:]): enable the cell dotted
outline.
([NSMatrix -drawCellAtRow:column:]): likewise.
([NSMatrix -drawRect:]): removed drawing of dotted outline. Rewritten
due to changes in -getRow:column:forPoint:
([NSMatrix -getRow:column:forPoint:]): set row and column to -1 if
point is not inside a cell.
([NSMatrix -_selectCell:atRow:column:]): use mnemonic value for cell
state, does not enable dotted outline and check for nil aCell.
([NSMatrix -selectTextAtRow:column:]): likewise.
([NSMatrix -_setState:highlight:startIndex:endIndex:]): use matrix
highlightCell: method and mnemonic for cell state.
([NSMatrix -deselectAllCells]): likewise.
([NSMatrix -selectAll:]): likewise.
([NSMatrix -setSelectionFrom:to:anchor:highlight:]): likewise.
([NSMatrix -performKeyEquivalent:]): select next cell state.
2001-04-15 Adam Fedor <fedor@gnu.org> 2001-04-15 Adam Fedor <fedor@gnu.org>
* Source/NSView.m (_invalidateCoordinates): release the gstate. * Source/NSView.m (_invalidateCoordinates): release the gstate.

View file

@ -2539,148 +2539,6 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
{ {
} }
- (void)moveUp:(id)sender
{
if (_acceptsArrowKeys == YES)
{
NSArray *cells;
NSMatrix *matrix;
NSBrowserCell *selectedCell;
BOOL firstPass = YES;
int selectedRow, oldSelectedRow, selectedColumn, numberOfRows;
selectedColumn = [self selectedColumn];
if (selectedColumn == -1)
{
matrix = [self matrixInColumn: 0];
cells = [matrix cells];
numberOfRows = [cells count];
oldSelectedRow = selectedRow = numberOfRows - 1;
}
else
{
matrix = [self matrixInColumn: selectedColumn];
cells = [matrix cells];
numberOfRows = [cells count];
oldSelectedRow = selectedRow = [matrix selectedRow];
}
while (1)
{
if (selectedColumn == -1)
{
if (numberOfRows)
{
[matrix selectCellAtRow: selectedRow column: 0];
[_window makeFirstResponder: matrix];
[self doClick: matrix];
selectedColumn = 0;
}
else
return;
}
else
{
if (!selectedRow)
{
numberOfRows = [cells count];
if(numberOfRows <= 1)
return;
selectedRow = numberOfRows;
firstPass = NO;
}
selectedRow--;
[matrix deselectAllCells];
[matrix selectCellAtRow: selectedRow column: 0];
[_window makeFirstResponder: matrix];
[self doClick: matrix];
}
selectedCell = [matrix selectedCell];
if (selectedCell ||
(firstPass == NO && selectedRow == oldSelectedRow))
break;
}
if (_sendsActionOnArrowKeys == YES)
[super sendAction: _action to: _target];
}
}
- (void)moveDown:(id)sender
{
if (_acceptsArrowKeys)
{
NSArray *cells;
NSMatrix *matrix;
NSBrowserCell *selectedCell;
BOOL firstPass = YES;
int selectedRow, oldSelectedRow, selectedColumn, numberOfRows;
selectedColumn = [self selectedColumn];
if (selectedColumn == -1)
{
matrix = [self matrixInColumn: 0];
oldSelectedRow = selectedRow = 0;
}
else
{
matrix = [self matrixInColumn: selectedColumn];
oldSelectedRow = selectedRow = [matrix selectedRow];
}
cells = [matrix cells];
numberOfRows = [cells count];
while (1)
{
if (selectedColumn == -1)
{
if (numberOfRows)
{
[matrix selectCellAtRow: 0 column: 0];
[_window makeFirstResponder: matrix];
[self doClick: matrix];
selectedColumn = 0;
}
else
return;
}
else
{
selectedRow++;
if (selectedRow >= numberOfRows)
{
if (numberOfRows <= 1)
return;
selectedRow = 0;
firstPass = NO;
}
[matrix deselectAllCells];
[matrix selectCellAtRow: selectedRow column: 0];
[_window makeFirstResponder: matrix];
[self doClick: matrix];
}
selectedCell = [matrix selectedCell];
if (selectedCell ||
(firstPass == NO && selectedRow == oldSelectedRow))
break;
}
if (_sendsActionOnArrowKeys == YES)
[super sendAction: _action to: _target];
}
}
- (void)moveLeft:(id)sender - (void)moveLeft:(id)sender
{ {
if (_acceptsArrowKeys) if (_acceptsArrowKeys)
@ -2768,10 +2626,7 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
switch (character) switch (character)
{ {
case NSUpArrowFunctionKey: case NSUpArrowFunctionKey:
[self moveUp:self];
return;
case NSDownArrowFunctionKey: case NSDownArrowFunctionKey:
[self moveDown:self];
return; return;
case NSLeftArrowFunctionKey: case NSLeftArrowFunctionKey:
[self moveLeft:self]; [self moveLeft:self];
@ -3025,7 +2880,7 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
- (void)_performLoadOfColumn: (int)column - (void)_performLoadOfColumn: (int)column
{ {
id bc, sc, matrix = nil; id bc, sc, matrix;
NSRect matrixRect = {{0, 0}, {100, 100}}; NSRect matrixRect = {{0, 0}, {100, 100}};
NSSize matrixIntercellSpace = {0, 0}; NSSize matrixIntercellSpace = {0, 0};
@ -3038,28 +2893,37 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
if (!(sc = [bc columnScrollView])) if (!(sc = [bc columnScrollView]))
return; return;
matrix = [bc columnMatrix];
// Loading is different based upon passive/active delegate // Loading is different based upon passive/active delegate
if (_passiveDelegate) if (_passiveDelegate)
{ {
// Ask the delegate for the number of rows // Ask the delegate for the number of rows
int n = [_browserDelegate browser: self numberOfRowsInColumn: column]; int i, n = [_browserDelegate browser: self numberOfRowsInColumn: column];
if (_reusesColumns) if (_reusesColumns && matrix)
{ {
[matrix renewRows: n columns: 1];
[sc setDocumentView: matrix];
for (i = 0; i < n; i++)
{
[[matrix cellAtRow: i column: 0] setLoaded: NO];
[self loadedCellAtRow: i column: column];
}
} }
else else
{ {
int i;
// create a new col matrix // create a new col matrix
matrix = [_browserMatrixClass alloc]; matrix = [[_browserMatrixClass alloc]
matrix = [matrix initWithFrame: matrixRect initWithFrame: matrixRect
mode: NSListModeMatrix mode: NSListModeMatrix
prototype: _browserCellPrototype prototype: _browserCellPrototype
numberOfRows: n numberOfRows: n
numberOfColumns: 1]; numberOfColumns: 1];
[matrix setIntercellSpacing:matrixIntercellSpace]; [matrix setIntercellSpacing:matrixIntercellSpace];
[matrix setAllowsEmptySelection: _allowsEmptySelection]; [matrix setAllowsEmptySelection: _allowsEmptySelection];
[matrix setAutoscroll: YES];
if (!_allowsMultipleSelection) if (!_allowsMultipleSelection)
{ {
[matrix setMode: NSRadioModeMatrix]; [matrix setMode: NSRadioModeMatrix];
@ -3082,20 +2946,27 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
} }
else else
{ {
if (_reusesColumns) if (_reusesColumns && matrix)
{ {
[matrix renewRows: 0 columns: 1];
[sc setDocumentView: matrix];
[_browserDelegate browser: self
createRowsForColumn: column
inMatrix: matrix];
} }
else else
{ {
// create a new col matrix // create a new col matrix
matrix = [_browserMatrixClass alloc]; matrix = [[_browserMatrixClass alloc]
[matrix initWithFrame: matrixRect initWithFrame: matrixRect
mode: NSRadioModeMatrix mode: NSRadioModeMatrix
prototype: _browserCellPrototype prototype: _browserCellPrototype
numberOfRows: 0 numberOfRows: 0
numberOfColumns: 0]; numberOfColumns: 0];
[matrix setIntercellSpacing:matrixIntercellSpace]; [matrix setIntercellSpacing:matrixIntercellSpace];
[matrix setAllowsEmptySelection: _allowsEmptySelection]; [matrix setAllowsEmptySelection: _allowsEmptySelection];
[matrix setAutoscroll: YES];
if (_allowsMultipleSelection) if (_allowsMultipleSelection)
{ {
[matrix setMode: NSListModeMatrix]; [matrix setMode: NSListModeMatrix];

View file

@ -602,7 +602,12 @@
[controlView lockFocus]; [controlView lockFocus];
if (_cell.is_highlighted) if (_cell.is_highlighted)
mask = _highlightsByMask; {
mask = _highlightsByMask;
if (_cell.state)
mask &= ~_showAltStateMask;
}
else if (_cell.state) else if (_cell.state)
mask = _showAltStateMask; mask = _showAltStateMask;
else else

View file

@ -1282,9 +1282,6 @@ static NSColor *shadowCol;
NSDebugLog(@"NSCell mouse went up\n"); NSDebugLog(@"NSCell mouse went up\n");
mouseWentUp = YES; mouseWentUp = YES;
done = YES; done = YES;
[self setState: !_cell.state];
if ((_action_mask & NSLeftMouseUpMask))
[(NSControl*)controlView sendAction: action to: target];
} }
else else
{ {
@ -1305,6 +1302,13 @@ static NSColor *shadowCol;
if (_cell.is_continuous) if (_cell.is_continuous)
[NSEvent stopPeriodicEvents]; [NSEvent stopPeriodicEvents];
if (mouseWentUp)
{
[self setNextState];
if ((_action_mask & NSLeftMouseUpMask))
[(NSControl*)controlView sendAction: action to: target];
}
// Return YES only if the mouse went up within the cell // Return YES only if the mouse went up within the cell
if (mouseWentUp && (flag || [controlView mouse: point inRect: cellFrame])) if (mouseWentUp && (flag || [controlView mouse: point inRect: cellFrame]))
{ {

File diff suppressed because it is too large Load diff