// $Revision: 1.3 $ //Copyright (c) 1994-1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_KEYFILTERBEHAVIOR #include "KeyFilterBehavior.h" #endif #ifndef Taligent_UNICODEGENERAL #include #endif MCollectibleDefinitionsMacro(TKeyFilterBehavior, kOriginalVersion); TKeyFilterBehavior::TKeyFilterBehavior() : MEventTarget(), MKeyEventHandler() { } TKeyFilterBehavior::TKeyFilterBehavior(const TKeyFilterBehavior& source) : MEventTarget(source), MKeyEventHandler(source) { } TKeyFilterBehavior::~TKeyFilterBehavior() { } TKeyFilterBehavior& TKeyFilterBehavior::operator=(const TKeyFilterBehavior& source) { if (&source != this) { MEventTarget::operator=(source); MKeyEventHandler::operator=(source); } return *this; } TStream& TKeyFilterBehavior::operator>>=(TStream& toStream) const { ::WriteVersion(toStream, kOriginalVersion); MEventTarget::operator>>=(toStream); return toStream; } TStream& TKeyFilterBehavior::operator<<=(TStream& fromStream) { ::ReadVersion(fromStream, kOriginalVersion, kOriginalVersion); MEventTarget::operator<<=(fromStream); return fromStream; } // Only accept "Taligent". bool TKeyFilterBehavior::KeyDown(TKeyDownEvent& keyDownEvent) { bool rejectKey = true; TStandardText text; fTypingConfiguration.MapKeyEventToText(keyDownEvent, text); if (text.GetLength()) { switch (text[0]) { case TLatin::kCapitalLetterT: case TLatin::kSmallLetterA: case TLatin::kSmallLetterL: case TLatin::kSmallLetterI: case TLatin::kSmallLetterG: case TLatin::kSmallLetterE: case TLatin::kSmallLetterN: case TLatin::kSmallLetterT: rejectKey = false; break; default: break; } } return rejectKey; }