Add support for backtab character.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31026 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-07-25 20:51:40 +00:00
parent 6d682ee88e
commit ad9ddfe0ea
5 changed files with 33 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2010-07-25 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBrowser.m,
* Source/NSInputManager.m,
* Source/NSMatrix.m,
* Source/NSWindow.m: Add support for backtab character.
2010-07-22 19:35-EDT Gregory John Casamento <greg.casamento@gmail.com> 2010-07-22 19:35-EDT Gregory John Casamento <greg.casamento@gmail.com>
* Source/GSTheme.m: Call method _setArchiveByName: with YES so that * Source/GSTheme.m: Call method _setArchiveByName: with YES so that

View file

@ -2517,6 +2517,9 @@ static NSTextFieldCell *titleCell;
case NSRightArrowFunctionKey: case NSRightArrowFunctionKey:
[self moveRight:self]; [self moveRight:self];
return; return;
case NSBackTabCharacter:
[_window selectKeyViewPrecedingView: self];
return;
case NSTabCharacter: case NSTabCharacter:
{ {
if ([theEvent modifierFlags] & NSShiftKeyMask) if ([theEvent modifierFlags] & NSShiftKeyMask)
@ -2529,7 +2532,6 @@ static NSTextFieldCell *titleCell;
} }
} }
return; return;
break;
} }
} }

View file

@ -39,7 +39,7 @@
/* A table mapping character names to characters, used to interpret /* A table mapping character names to characters, used to interpret
the character names found in KeyBindings dictionaries. */ the character names found in KeyBindings dictionaries. */
#define CHARACTER_TABLE_SIZE 77 #define CHARACTER_TABLE_SIZE 78
static struct static struct
{ {
@ -125,6 +125,7 @@ character_table[CHARACTER_TABLE_SIZE] =
/* Special characters by name. Useful if you want, for example, /* Special characters by name. Useful if you want, for example,
to associate some special action to C-Tab or similar evils. */ to associate some special action to C-Tab or similar evils. */
{ @"Backspace", NSBackspaceCharacter }, { @"Backspace", NSBackspaceCharacter },
{ @"BackTab", NSBackTabCharacter },
{ @"Tab", NSTabCharacter }, { @"Tab", NSTabCharacter },
{ @"Enter", NSEnterCharacter }, { @"Enter", NSEnterCharacter },
{ @"FormFeed", NSFormFeedCharacter }, { @"FormFeed", NSFormFeedCharacter },
@ -654,6 +655,10 @@ static NSInputManager *currentInputManager = nil;
[self doCommandBySelector: @selector (cancelOperation:)]; [self doCommandBySelector: @selector (cancelOperation:)];
break; break;
case NSBackTabCharacter:
[self doCommandBySelector: @selector (insertBacktab:)];
break;
case NSTabCharacter: case NSTabCharacter:
if (flags & NSShiftKeyMask) if (flags & NSShiftKeyMask)
{ {

View file

@ -2585,7 +2585,7 @@ static SEL getSel;
unsigned int modifiers = [theEvent modifierFlags]; unsigned int modifiers = [theEvent modifierFlags];
int i; int i;
unsigned int relevantModifiersMask = NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask; unsigned int relevantModifiersMask = NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask;
unichar key = ([keyEquivalent length] > 0 ? [keyEquivalent characterAtIndex:0] : 0);
/* Take shift key into account only for control keys and arrow and function keys */ /* Take shift key into account only for control keys and arrow and function keys */
if ((modifiers & NSFunctionKeyMask) if ((modifiers & NSFunctionKeyMask)
|| ([keyEquivalent length] > 0 && [[NSCharacterSet controlCharacterSet] characterIsMember:[keyEquivalent characterAtIndex:0]])) || ([keyEquivalent length] > 0 && [[NSCharacterSet controlCharacterSet] characterIsMember:[keyEquivalent characterAtIndex:0]]))
@ -3727,6 +3727,15 @@ static SEL getSel;
} }
return; return;
case NSBackTabCharacter:
if (_tabKeyTraversesCells)
{
if ([self _selectNextSelectableCellAfterRow: _selectedRow
column: _selectedColumn])
return;
}
break;
case NSTabCharacter: case NSTabCharacter:
if (_tabKeyTraversesCells) if (_tabKeyTraversesCells)
{ {

View file

@ -3218,6 +3218,13 @@ resetCursorRectsForView(NSView *theView)
return; return;
} }
// If this is a BACKTAB event, move to the previous key view
if (character == NSTabCharacter)
{
[self selectPreviousKeyView: self];
return;
}
// If this is a TAB or TAB+SHIFT event, move to the next key view // If this is a TAB or TAB+SHIFT event, move to the next key view
if (character == NSTabCharacter) if (character == NSTabCharacter)
{ {