home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / Apps / DevTools / ClassEditor.0.3 / Source / MiscCompletionText.m < prev    next >
Encoding:
Text File  |  1995-02-10  |  1.3 KB  |  62 lines

  1. /* MiscCompletionText.m                 
  2.  *
  3.  * For details please read the Docu.
  4.  *
  5.  * For interface-info see the header file. The comments in this file mostly
  6.  * cover only the real implementation details.
  7.  *
  8.  * Written by:         Thomas Engel
  9.  * Created:            23.10.1993 (Copyleft)
  10.  * Last modified:     12.11.1994
  11.  */
  12.  
  13.  
  14. #import "MiscCompletionText.h"
  15.  
  16. @implementation MiscCompletionText
  17.  
  18. - keyDown:(NXEvent *)event
  19. {
  20.     id    ourDelegate;
  21.  
  22.     // BUG: We should test the ALT, CMD, etc keys too !
  23.     // BUG: Accept first press only !!!
  24.  
  25.     if( event->data.key.charSet == NX_ASCIISET &&
  26.         event->data.key.charCode == 0x1b )         
  27.     {
  28.         ourDelegate = [self delegate];
  29.     
  30.         // Now if the delegate responds to the textDelegate method we will
  31.         // use that object. This is how we can handle TextFields and
  32.         // Forms too !!.
  33.             
  34.         if( ourDelegate != nil &&
  35.             [ourDelegate respondsTo:@selector(textDelegate)] )
  36.             ourDelegate = [ourDelegate textDelegate];
  37.             
  38.         // Now go ahead...
  39.             
  40.         if( ourDelegate != nil &&
  41.              [ourDelegate respondsTo:@selector(textShouldPerformCompletion:)] )
  42.         {
  43.             // Now only on success we will quite right here.
  44.  
  45.             if( [ourDelegate textShouldPerformCompletion:self] != nil )
  46.                 return self;
  47.         }
  48.     }
  49.     // In all the other cases we will try to let our old class do the work.
  50.  
  51.     return [super keyDown:event];
  52. }
  53.  
  54. @end
  55.  
  56.  
  57. /*
  58.  * History: 13.01.95 Buh
  59.  *            
  60.  *
  61.  * Bugs: - ...
  62.  */