// $Revision: 1.3 $ //Copyright (c) 1994-1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_KEYINPUTINTERACTOR #define TaligentSamples_KEYINPUTINTERACTOR #ifndef TaligentSamples_KEYINPUTVIEW #include "KeyInputView.h" #endif #ifndef Taligent_KEYBOARDINPUT #include #endif #ifndef Taligent_STANDARDTEXT #include #endif #ifndef Taligent_TYPINGCONFIGURATION #include #endif #ifndef Taligent_VIEWHANDLE #include #endif // Once the interactor is started, it will intercept key events until a it encounters // a sequence that matches the string, at which point it will execute MatchedString and call // SetDone(true). MatchedString calls protocol on the TKeyInputView that started the // interactor. // A view handle is used so that we can be robust in cases where the view is deleted // while the interactor is still active. class TKeyInputInteractor : public TInteractor, public MKeyEventHandler { public: VersionDeclarationsMacro(TKeyInputInteractor); TKeyInputInteractor(TKeyInputView*, const TText&); TKeyInputInteractor(const TKeyInputInteractor&); virtual ~TKeyInputInteractor(); TKeyInputInteractor& operator=(const TKeyInputInteractor&); virtual TStream& operator>>=(TStream&) const; virtual TStream& operator<<=(TStream&); virtual bool KeyDown(TKeyDownEvent& event); virtual short GetState() const; virtual void SetState(short); protected: TKeyInputInteractor(); virtual void HandleDeactivate(); virtual void MatchedString(); private: TViewHandle fViewHandle; short fState; TStandardText fString; TTypingConfigurationHandle fTypingConfiguration; enum EVersion { kOriginalVersion }; }; #endif // TaligentSamples_KEYINPUTINTERACTOR