1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807
|
/* NSInputManager -*-objc-*-
Copyright (C) 2001, 2002 Free Software Foundation, Inc.
Author: Nicola Pero <n.pero@mi.flashnet.it>
Date: December 2001, January 2002, February 2002
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import <Foundation/NSException.h>
#import "AppKit/NSEvent.h"
#import "AppKit/NSInputManager.h"
#import "AppKit/NSInputServer.h"
#import "AppKit/NSText.h"
#import "AppKit/NSHelpManager.h"
/* For NSBeep () */
#import "AppKit/NSGraphics.h"
#import "GSKeyBindingAction.h"
#import "GSKeyBindingTable.h"
/* A table mapping character names to characters, used to interpret
the character names found in KeyBindings dictionaries. */
static struct
{
NSString *name;
unichar character;
}
character_table[] =
{
/* Function keys. */
{ @"UpArrow", NSUpArrowFunctionKey },
{ @"DownArrow", NSDownArrowFunctionKey },
{ @"LeftArrow", NSLeftArrowFunctionKey },
{ @"RightArrow", NSRightArrowFunctionKey },
{ @"F1", NSF1FunctionKey },
{ @"F2", NSF2FunctionKey },
{ @"F3", NSF3FunctionKey },
{ @"F4", NSF4FunctionKey },
{ @"F5", NSF5FunctionKey },
{ @"F6", NSF6FunctionKey },
{ @"F7", NSF7FunctionKey },
{ @"F8", NSF8FunctionKey },
{ @"F9", NSF9FunctionKey },
{ @"F10", NSF10FunctionKey },
{ @"F11", NSF11FunctionKey },
{ @"F12", NSF12FunctionKey },
{ @"F13", NSF13FunctionKey },
{ @"F14", NSF14FunctionKey },
{ @"F15", NSF15FunctionKey },
{ @"F16", NSF16FunctionKey },
{ @"F17", NSF17FunctionKey },
{ @"F18", NSF18FunctionKey },
{ @"F19", NSF19FunctionKey },
{ @"F20", NSF20FunctionKey },
{ @"F21", NSF21FunctionKey },
{ @"F22", NSF22FunctionKey },
{ @"F23", NSF23FunctionKey },
{ @"F24", NSF24FunctionKey },
{ @"F25", NSF25FunctionKey },
{ @"F26", NSF26FunctionKey },
{ @"F27", NSF27FunctionKey },
{ @"F28", NSF28FunctionKey },
{ @"F29", NSF29FunctionKey },
{ @"F30", NSF30FunctionKey },
{ @"F31", NSF31FunctionKey },
{ @"F32", NSF32FunctionKey },
{ @"F33", NSF33FunctionKey },
{ @"F34", NSF34FunctionKey },
{ @"F35", NSF35FunctionKey },
{ @"Insert", NSInsertFunctionKey },
{ @"Delete", NSDeleteFunctionKey },
{ @"Home", NSHomeFunctionKey },
{ @"Begin", NSBeginFunctionKey },
{ @"End", NSEndFunctionKey },
{ @"PageUp", NSPageUpFunctionKey },
{ @"PageDown", NSPageDownFunctionKey },
{ @"PrintScreen", NSPrintScreenFunctionKey },
{ @"ScrollLock", NSScrollLockFunctionKey },
{ @"Pause", NSPauseFunctionKey },
{ @"SysReq", NSSysReqFunctionKey },
{ @"Break", NSBreakFunctionKey },
{ @"Reset", NSResetFunctionKey },
{ @"Stop", NSStopFunctionKey },
{ @"Menu", NSMenuFunctionKey },
{ @"User", NSUserFunctionKey },
{ @"System", NSSystemFunctionKey },
{ @"Print", NSPrintFunctionKey },
{ @"ClearLine", NSClearLineFunctionKey },
{ @"ClearDisplay", NSClearDisplayFunctionKey },
{ @"InsertLine", NSInsertLineFunctionKey },
{ @"DeleteLine", NSDeleteLineFunctionKey },
{ @"InsertChar", NSInsertCharFunctionKey },
{ @"DeleteChar", NSDeleteCharFunctionKey },
{ @"Prev", NSPrevFunctionKey },
{ @"Next", NSNextFunctionKey },
{ @"Select", NSSelectFunctionKey },
{ @"Execute", NSExecuteFunctionKey },
{ @"Undo", NSUndoFunctionKey },
{ @"Redo", NSRedoFunctionKey },
{ @"Find", NSFindFunctionKey },
{ @"Help", NSHelpFunctionKey },
{ @"ModeSwitch", NSModeSwitchFunctionKey },
/* Special characters by name. Useful if you want, for example,
to associate some special action to C-Tab or similar evils. */
{ @"Backspace", NSDeleteCharacter },
{ @"BackTab", NSBackTabCharacter },
{ @"Tab", NSTabCharacter },
{ @"Enter", NSEnterCharacter },
{ @"FormFeed", NSFormFeedCharacter },
{ @"CarriageReturn", NSCarriageReturnCharacter },
{ @"Escape", 0x1b }
};
static int CHARACTER_TABLE_SIZE = (sizeof(character_table) / sizeof(character_table[0]));
static NSInputManager *currentInputManager = nil;
@implementation NSInputManager
+ (NSInputManager *) currentInputManager
{
if (currentInputManager == nil)
{
currentInputManager = [[self alloc] initWithName: nil host: nil];
}
return currentInputManager;
}
+ (BOOL) parseKey: (NSString *)key
intoCharacter: (unichar *)character
andModifiers: (unsigned int *)modifiers
{
int flags = 0;
unichar c = 0;
/* Parse the key: first break it into segments separated by - */
NSArray *components = [key componentsSeparatedByString: @"-"];
NSString *name;
/* Then, parse the modifiers. The modifiers are the components
- all of them except the last one! */
int i, count = [components count];
for (i = 0; i < count - 1; i++)
{
NSString *modifier = [components objectAtIndex: i];
if ([modifier isEqualToString: @"Control"]
|| [modifier isEqualToString: @"Ctrl"]
|| [modifier isEqualToString: @"C"])
{
flags |= NSControlKeyMask;
}
else if ([modifier isEqualToString: @"Alternate"]
|| [modifier isEqualToString: @"Alt"]
|| [modifier isEqualToString: @"A"]
|| [modifier isEqualToString: @"Meta"]
|| [modifier isEqualToString: @"M"])
{
flags |= NSAlternateKeyMask;
}
/* The Shift modifier is only meaningful when used in
* conjunction with function keys. 'Shift-LeftArrow' is
* meaningful; 'Control-Shift-g' is not - you should use
* 'Control-G' instead. */
else if ([modifier isEqualToString: @"Shift"]
|| [modifier isEqualToString: @"S"])
{
flags |= NSShiftKeyMask;
}
else if ([modifier isEqualToString: @"NumericPad"]
|| [modifier isEqualToString: @"Numeric"]
|| [modifier isEqualToString: @"N"])
{
flags |= NSNumericPadKeyMask;
}
else
{
NSLog (@"NSInputManager - unknown modifier '%@' ignored", modifier);
return NO;
}
}
/* Now, parse the actual key. */
name = [components objectAtIndex: (count - 1)];
if ([name isEqualToString: @""])
{
/* This happens if '-' was the character. */
c = '-';
}
else if ([name length] == 1)
{
/* A single character, such as 'a'. */
c = [name characterAtIndex: 0];
}
else
{
/* A descriptive string, such as Tab or Home. */
for (i = 0; i < CHARACTER_TABLE_SIZE; i++)
{
if ([name isEqualToString: (character_table[i]).name])
{
c = (character_table[i]).character;
flags |= NSFunctionKeyMask;
break;
}
}
if (i == CHARACTER_TABLE_SIZE)
{
NSLog (@"NSInputManager - unknown character '%@' ignored", name);
return NO;
}
}
if (character != NULL)
{
*character = c;
}
if (modifiers != NULL)
{
*modifiers = flags;
}
return YES;
}
+ (NSString *) describeKeyStroke: (unichar)character
withModifiers: (unsigned int)modifiers
{
NSMutableString *description = [NSMutableString new];
int i;
if (modifiers & NSCommandKeyMask)
{
[description appendString: @"Command-"];
}
if (modifiers & NSControlKeyMask)
{
[description appendString: @"Control-"];
}
if (modifiers & NSAlternateKeyMask)
{
[description appendString: @"Alternate-"];
}
if (modifiers & NSShiftKeyMask)
{
[description appendString: @"Shift-"];
}
if (modifiers & NSNumericPadKeyMask)
{
[description appendString: @"NumericPad-"];
}
for (i = 0; i < CHARACTER_TABLE_SIZE; i++)
{
if (character == ((character_table[i]).character))
{
[description appendString: character_table[i].name];
break;
}
}
if (i == CHARACTER_TABLE_SIZE)
{
NSString *c = [NSString stringWithCharacters: &character length: 1];
[description appendString: c];
}
return AUTORELEASE(description);
}
- (void) loadBindingsFromFile: (NSString *)fullPath
{
NSDictionary *bindings;
bindings = [NSDictionary dictionaryWithContentsOfFile: fullPath];
if (bindings == nil)
{
NSLog (@"Unable to load KeyBindings from file %@", fullPath);
}
else
{
[_rootBindingTable loadBindingsFromDictionary: bindings];
}
}
- (void) loadBindingsWithName: (NSString *)fileName
{
NSArray *paths;
NSEnumerator *enumerator;
NSString *libraryPath;
NSFileManager *fileManager = [NSFileManager defaultManager];
paths = NSSearchPathForDirectoriesInDomains (NSLibraryDirectory,
NSAllDomainsMask, YES);
/* paths are in the order - user, network, local, root. Instead we
want to load keybindings in the order root, local, network, user
- so that user can override root - for this reason we use a
reverseObjectEnumerator. */
enumerator = [paths reverseObjectEnumerator];
while ((libraryPath = [enumerator nextObject]) != nil)
{
NSString *fullPath;
fullPath =
[[[libraryPath stringByAppendingPathComponent: @"KeyBindings"]
stringByAppendingPathComponent: fileName]
stringByAppendingPathExtension: @"dict"];
if ([fileManager fileExistsAtPath: fullPath])
{
[self loadBindingsFromFile: fullPath];
}
}
}
- (NSInputManager *) initWithName: (NSString *)inputServerName
host: (NSString *)hostName
{
NSUserDefaults *defaults;
CREATE_AUTORELEASE_POOL (pool);
defaults = [NSUserDefaults standardUserDefaults];
self = [super init];
_rootBindingTable = [GSKeyBindingTable new];
/* Read the abort key from the user defaults. */
{
NSString *abortKey = [defaults stringForKey: @"GSAbortKey"];
if (abortKey == nil)
{
_abortCharacter = 'g';
_abortFlags = NSControlKeyMask;
}
else if (![NSInputManager parseKey: abortKey
intoCharacter: &_abortCharacter
andModifiers: &_abortFlags])
{
NSLog (@"Could not parse GSAbortKey - using Control-g");
_abortCharacter = 'g';
_abortFlags = NSControlKeyMask;
}
}
/* Read if we should insert Control- keystrokes into the text.
This defaults to NO. */
_insertControlKeystrokes = [defaults boolForKey:
@"GSInsertControlKeystrokes"];
/* Read the quote key from the user defaults. */
{
NSString *quoteKey = [defaults stringForKey: @"GSQuoteKey"];
GSKeyBindingActionQuoteNextKeyStroke *quoteAction;
quoteAction = [[GSKeyBindingActionQuoteNextKeyStroke alloc] init];
if (quoteKey == nil)
{
quoteKey = @"Control-q";
}
[_rootBindingTable bindKey: quoteKey toAction: quoteAction];
RELEASE (quoteAction);
}
/* Normally, when we start up, we load all the keybindings we find
in the following files, in this order:
$GNUSTEP_SYSTEM_ROOT/Library/KeyBindings/DefaultKeyBindings.dict
$GNUSTEP_LOCAL_ROOT/Library/KeyBindings/DefaultKeyBindings.dict
$GNUSTEP_NETWORK_ROOT/Library/KeyBindings/DefaultKeyBindings.dict
$GNUSTEP_USER_ROOT/Library/KeyBindings/DefaultKeyBindings.dict
This gives you a first way of adding your customized keybindings
- adding a DefaultKeyBindings.dict to your GNUSTEP_USER_ROOT, and
putting additional keybindings in there. This allows you to add
new keybindings to the standard ones, or override standard ones
with your own. These keybindings are normally used by all your
applications (this is why they are in 'DefaultKeyBindings').
You can change this behaviour, by setting the GSKeyBindingsFiles
default to something else. The GSKeyBindingsFiles default
contains an array of files which is loaded, in that order. Each
file is searched first in GNUSTEP_SYSTEM_ROOT, then
GNUSTEP_LOCAL_ROOT, the GNUSTEP_NETWORK_ROOT, then
GNUSTEP_USER_ROOT.
Examples -
GSKeyBindingsFiles = (DefaultKeyBindings, NicolaKeyBindings);
will first load DefaultKeyBindings.dict (as by default), then
NicolaKeyBindings.dict.
GSKeyBindingsFiles = (NicolaKeyBindings);
will not load DefaultKeyBindings.dict but only
NicolaKeyBindings.dict.
The default of course is
GSKeyBindingsFiles = (DefaultKeyBindings);
*/
/* First, load the DefaultKeyBindings. */
{
NSArray *keyBindingsFiles = [defaults arrayForKey: @"GSKeyBindingsFiles"];
if (keyBindingsFiles == nil)
{
keyBindingsFiles = [NSArray arrayWithObject: @"DefaultKeyBindings"];
}
{
Class string = [NSString class];
unsigned int i;
for (i = 0; i < [keyBindingsFiles count]; i++)
{
NSString *filename = [keyBindingsFiles objectAtIndex: i];
if ([filename isKindOfClass: string])
{
[self loadBindingsWithName: filename];
}
}
}
}
/* Then, load any manually specified keybinding. */
{
NSDictionary *keyBindings = [defaults dictionaryForKey: @"GSKeyBindings"];
if ([keyBindings isKindOfClass: [NSDictionary class]])
{
[_rootBindingTable loadBindingsFromDictionary: keyBindings];
}
}
[pool drain];
return self;
}
- (void) dealloc
{
TEST_RELEASE (_pendingKeyEvents);
RELEASE (_rootBindingTable);
[super dealloc];
}
- (void) handleKeyboardEvents: (NSArray *)eventArray
client: (id)client
{
NSEvent *theEvent;
NSEnumerator *eventEnum = [eventArray objectEnumerator];
/* If the client has changed, reset our internal state before going
on. */
if (client != _currentClient)
{
[self resetInternalState];
}
_currentClient = client;
while ((theEvent = [eventEnum nextObject]) != nil)
{
NSString *characters = [theEvent characters];
NSString *unmodifiedCharacters = [theEvent charactersIgnoringModifiers];
unichar character = 0;
NSUInteger flags = [theEvent modifierFlags] & (NSShiftKeyMask
| NSAlternateKeyMask
| NSControlKeyMask
| NSNumericPadKeyMask);
BOOL isFunctionKey = ([theEvent modifierFlags] & NSFunctionKeyMask)
== NSFunctionKeyMask;
if ([unmodifiedCharacters length] > 0)
{
character = [unmodifiedCharacters characterAtIndex: 0];
}
if (!_interpretNextKeyStrokeLiterally)
{
GSKeyBindingAction *action;
GSKeyBindingTable *table;
BOOL found;
unsigned adaptedFlags;
/* If the keystroke is a function key, then we need to use
* the full modifier flags to compare it against stored
* keybindings, so that we can make a difference for example
* between Shift-LeftArrow and LeftArrow. But if it's not a
* function key, then we should ignore the shift modifier -
* for example Control-g is a keystroke, and Control-G is
* another one. The shift modifier flag is not used to
* match these keystrokes - the fact that it's 'G' rather
* than 'g' already contains the fact that it's typed in
* with Shift. */
if (!isFunctionKey)
{
adaptedFlags = flags & (~NSShiftKeyMask);
}
else
{
adaptedFlags = flags;
}
/* Special keybinding recognized in all contexts - abort -
normally bound to Control-g. The user is confused and
wants to go home. Abort whatever train of thoughts we
were following, discarding whatever pending keystrokes we
have, and return into default state. */
if (character == _abortCharacter && adaptedFlags == _abortFlags)
{
[self resetInternalState];
break;
}
/* Look up the character in the current keybindings table. */
found = [_currentBindingTable lookupKeyStroke: character
modifiers: adaptedFlags
returningActionIn: &action
tableIn: &table];
if (found)
{
if (action != nil)
{
/* First reset our internal state - we are done
interpreting this keystroke sequence. */
[self resetInternalState];
/* Then perform the action. The action might actually
modify our internal state, which is why we reset it
before calling the action! (for example, performing
the action might cause us to interpret the next
keystroke literally). */
[action performActionWithInputManager: self];
break;
}
else if (table != nil)
{
/* It's part of a composite multi-stroke
keybinding. */
_currentBindingTable = table;
[_pendingKeyEvents addObject: theEvent];
break;
}
/* Else it is as if we didn't find it! */
}
/* Ok - the keybinding wasn't found. If we were tracking a
multi-stroke keybinding, it means we were on a false
track. */
if ([_pendingKeyEvents count] > 0)
{
NSEvent *e;
/* Save the pending events locally in this stack
frame. */
NSMutableArray *a = _pendingKeyEvents;
RETAIN (a);
/* Reset our internal state. */
[self resetInternalState];
/* Take the very first event we received and which we
tried to interpret as a key binding, which now we
know was the wrong thing to do. */
e = [a objectAtIndex: 0];
/* Interpret it literally, since interpreting it as a
keybinding failed. */
_interpretNextKeyStrokeLiterally = YES;
[self handleKeyboardEvents: [NSArray arrayWithObject: e]
client: client];
/* Now feed the remaining pending key events to
ourselves for interpretation - again from
scratch. */
[a removeObjectAtIndex: 0];
[a addObject: theEvent];
[self handleKeyboardEvents: a
client: client];
RELEASE (a);
break;
}
}
/* We couldn't (or shouldn't) find the keybinding ... perform
the default action - literally interpreting the
keystroke. */
/* If this was a forced literal interpretation, make sure the
next one is interpreted normally. */
_interpretNextKeyStrokeLiterally = NO;
/* During literal interpretation, function keys are ignored.
Trying to insert 'PageUp' literally makes simply no sense. */
if (isFunctionKey)
{
NSBeep ();
break;
}
/* During literal interpretation, control characters are ignored
if GSInsertControlKeystrokes was NO. */
if (_insertControlKeystrokes == NO)
{
if (flags & NSControlKeyMask)
{
NSBeep ();
break;
}
}
switch (character)
{
case NSDeleteCharacter:
case NSBackspaceCharacter:
[self doCommandBySelector: @selector (deleteBackward:)];
break;
case '\e': // escape
[self doCommandBySelector: @selector (cancelOperation:)];
break;
case NSBackTabCharacter:
[self doCommandBySelector: @selector (insertBacktab:)];
break;
case NSTabCharacter:
if (flags & NSShiftKeyMask)
{
[self doCommandBySelector: @selector (insertBacktab:)];
}
else
{
[self doCommandBySelector: @selector (insertTab:)];
}
break;
case NSEnterCharacter:
case NSFormFeedCharacter:
case NSCarriageReturnCharacter:
if (flags & NSAlternateKeyMask)
{
[self doCommandBySelector: @selector (insertNewlineIgnoringFieldEditor:)];
}
else
{
[self doCommandBySelector: @selector (insertNewline:)];
}
break;
case NSHelpFunctionKey:
[NSHelpManager setContextHelpModeActive: YES];
break;
default:
[self insertText: characters];
break;
}
}
}
- (void) resetInternalState
{
_currentBindingTable = _rootBindingTable;
ASSIGN (_pendingKeyEvents, [NSMutableArray array]);
_interpretNextKeyStrokeLiterally = NO;
}
- (void) quoteNextKeyStroke
{
_interpretNextKeyStrokeLiterally = YES;
}
- (BOOL) handleMouseEvent: (NSEvent *)theMouseEvent
{
return NO;
}
- (NSString *) language
{
return @"English";
}
- (NSString *) localizedInputManagerName
{
return nil;
}
- (void) markedTextAbandoned: (id)client
{}
- (void) markedTextSelectionChanged: (NSRange)newSel
client: (id)client
{}
- (BOOL) wantsToDelayTextChangeNotifications
{
return NO;
}
- (BOOL) wantsToHandleMouseEvents
{
return NO;
}
- (BOOL) wantsToInterpretAllKeystrokes
{
return NO;
}
- (void) setMarkedText: (id)aString
selectedRange: (NSRange)selRange
{}
- (BOOL) hasMarkedText
{
return NO;
}
- (NSRange) markedRange
{
return NSMakeRange (NSNotFound, 0);
}
- (NSRange) selectedRange
{
return NSMakeRange (NSNotFound, 0);
}
- (void) unmarkText
{}
- (NSArray*) validAttributesForMarkedText
{
return nil;
}
- (NSAttributedString *) attributedSubstringFromRange: (NSRange)theRange
{
return nil;
}
- (NSUInteger) characterIndexForPoint: (NSPoint)thePoint
{
return 0;
}
- (NSInteger) conversationIdentifier
{
return 0;
}
- (void) doCommandBySelector: (SEL)aSelector
{
[_currentClient doCommandBySelector: aSelector];
}
- (NSRect) firstRectForCharacterRange: (NSRange)theRange
{
return NSZeroRect;
}
- (void) insertText: (id)aString
{
[_currentClient insertText: aString];
}
@end
|