* Source/NSOutlineView.m: Allow collapsing or expanding multiple

rows at a time using the arrow keys


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33552 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-07-15 05:39:10 +00:00
parent 86ff6abf69
commit bfb415ee79
2 changed files with 34 additions and 23 deletions

View file

@ -1,3 +1,8 @@
2011-07-14 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSOutlineView.m: Allow collapsing or expanding multiple
rows at a time using the arrow keys
2011-07-14 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSSound.m

View file

@ -866,33 +866,39 @@ static NSImage *unexpandable = nil;
if ([characters length] == 1)
{
unichar c = [characters characterAtIndex: 0];
id item = [self itemAtRow: [self selectedRow]];
switch (c)
{
case NSLeftArrowFunctionKey:
{
if ([self isItemExpanded: item])
NSIndexSet *selected = [self selectedRowIndexes];
NSInteger i;
for (i = [selected firstIndex]; i != NSNotFound; i = [selected indexGreaterThanIndex: i])
{
id item = [self itemAtRow: i];
switch (c)
{
case NSLeftArrowFunctionKey:
{
[self collapseItem: item];
}
else
{
id parent = [self parentForItem: item];
if (parent != nil)
if ([self isItemExpanded: item])
{
NSInteger parentRow = [self rowForItem: parent];
[self selectRow: parentRow
byExtendingSelection: NO];
[self scrollRowToVisible: parentRow];
[self collapseItem: item];
}
else
{
id parent = [self parentForItem: item];
if (parent != nil)
{
NSInteger parentRow = [self rowForItem: parent];
[self selectRow: parentRow
byExtendingSelection: NO];
[self scrollRowToVisible: parentRow];
}
}
return;
}
return;
}
case NSRightArrowFunctionKey:
[self expandItem: item];
return;
default:
break;
case NSRightArrowFunctionKey:
[self expandItem: item];
return;
default:
break;
}
}
}