
// NCCompletionWindow.m
//
// Written by Norbert Heger <bertl@hal.kph.tuwien.ac.at>
// Copyright (c)1997
//
// This file is distributed under the terms of the
// GNU General Public License.

#import "NCCompletionWindow.h"

@implementation NCCompletionWindow

static unsigned short completionKeyCode = 0;
static unsigned int completionModifierFlags = 0;

+ (void)setCompletionKeyCode:(unsigned short)code modifierFlags:(unsigned int)flags
{
    completionKeyCode = code;
    completionModifierFlags = flags;
}

- (void)sendEvent:(NSEvent *)event
{
    if ([event type] == NSKeyDown
        && [event keyCode] == completionKeyCode
        && [event modifierFlags] == completionModifierFlags) {

        NSResponder *firstResponder = [self firstResponder];
        SEL selector = @selector(completeUsingDictionary:);

        if ([firstResponder respondsToSelector:selector]) {
            [firstResponder performSelector:selector withObject:self];            
			return;
        }
    }
    [super sendEvent:event];
}

@end
