mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Added key cell support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7291 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b3ad3a5160
commit
339ddc0dac
1 changed files with 39 additions and 7 deletions
|
@ -1207,7 +1207,18 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO: Select keyCell
|
||||
if (_keyCell != nil)
|
||||
{
|
||||
BOOL isValid;
|
||||
int row, column;
|
||||
|
||||
isValid = [self getRow: &row column: &column
|
||||
ofCell: _keyCell];
|
||||
if (isValid == YES)
|
||||
{
|
||||
[self selectTextAtRow: row column: column];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1265,8 +1276,20 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
- (id) keyCell
|
||||
{
|
||||
// TODO
|
||||
return nil;
|
||||
return _keyCell;
|
||||
}
|
||||
|
||||
- (void) setKeyCell: (NSCell *)aCell
|
||||
{
|
||||
BOOL isValid;
|
||||
int row, column;
|
||||
|
||||
isValid = [self getRow: &row column: &column ofCell: aCell];
|
||||
|
||||
if (isValid == YES)
|
||||
{
|
||||
ASSIGN (_keyCell, aCell);
|
||||
}
|
||||
}
|
||||
|
||||
- (id) nextText
|
||||
|
@ -2543,12 +2566,21 @@ static SEL getSel = @selector(objectAtIndex:);
|
|||
|
||||
- (void) keyDown: (NSEvent *)theEvent;
|
||||
{
|
||||
/* unsigned int flags = [theEvent modifierFlags];
|
||||
unsigned int key_code = [theEvent keyCode];*/
|
||||
|
||||
// unsigned int flags = [theEvent modifierFlags];
|
||||
unsigned int key_code = [theEvent keyCode];
|
||||
|
||||
// TODO
|
||||
// Selecting (not-editable, not-selectable cells) with the keyboard
|
||||
NSLog (@"NSMatrix -keyDown:");
|
||||
// NSLog (@"NSMatrix -keyDown:");
|
||||
|
||||
switch (key_code)
|
||||
{
|
||||
case 0x000d: // Enter
|
||||
[self selectText: self];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
[super keyDown: theEvent];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue