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

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

View file

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

View file

@ -2585,7 +2585,7 @@ static SEL getSel;
unsigned int modifiers = [theEvent modifierFlags];
int i;
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 */
if ((modifiers & NSFunctionKeyMask)
|| ([keyEquivalent length] > 0 && [[NSCharacterSet controlCharacterSet] characterIsMember:[keyEquivalent characterAtIndex:0]]))
@ -3727,6 +3727,15 @@ static SEL getSel;
}
return;
case NSBackTabCharacter:
if (_tabKeyTraversesCells)
{
if ([self _selectNextSelectableCellAfterRow: _selectedRow
column: _selectedColumn])
return;
}
break;
case NSTabCharacter:
if (_tabKeyTraversesCells)
{

View file

@ -3218,6 +3218,13 @@ resetCursorRectsForView(NSView *theView)
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 (character == NSTabCharacter)
{