// $Revision: 1.3 $ // Copyright (C) 1994-1995 Taligent, Inc. All rights reserved. #ifndef TaligentSamples_SAMPLESELECTTEXTINTERACTOR #define TaligentSamples_SAMPLESELECTTEXTINTERACTOR #ifndef Taligent_TEXTVIEW #include #endif #ifndef Taligent_TEXTMODEL #include #endif #ifndef Taligent_BREAKWORD #include #endif #ifndef Taligent_INPUT #include // TInteractor #endif #ifndef Taligent_MOUSEINPUT #include #endif #ifndef Taligent_INSERTIONOFFSET #include #endif class TSelectState; class TSampleSelectTextInteractor; #if 0 class TSampleSelectTextInteractor : public TInteractor, public MMouseEventHandler { #else class TSampleSelectTextInteractor : public TSelectTextInteractor { #endif public : MCollectibleDeclarationsMacro(TSampleSelectTextInteractor); TSampleSelectTextInteractor(TTextView*); TSampleSelectTextInteractor(const TSampleSelectTextInteractor&); virtual ~TSampleSelectTextInteractor(); virtual bool MouseDown(TMouseDownEvent&); virtual bool MouseMoved(TMouseMovedEvent&); virtual bool MouseUp(TMouseUpEvent&); protected: TSampleSelectTextInteractor(); virtual void Setup(TMouseDownEvent& mouseDown); private: TTextView* fView; TTextOffset fLastOffset; TSelectState* fSelectState; }; // Base class to manage the selection state while tracking. If constructed with a NIL // computeselection returns the insertion offset, otherwise it uses the iterator to // return the current range at the insertion offset. class TSelectState { public: TaligentTypeExtensionDeclarationsMacro_Abstract(TSelectState) TSelectState(MTextRepresentation*, TTextChunkIteratorReference&); virtual ~TSelectState(); virtual void Setup(const TInsertionOffset& initialOffset, const TTextArea& currentArea) = 0; virtual void Track(const TInsertionOffset& trackingOffset, TTextArea& resultArea) = 0; protected: virtual void ComputeSelection(const TInsertionOffset&, TTextArea&); private: TSelectState(const TSelectState&); TSelectState& operator=(const TSelectState&); TTextRepresentationReadEntry fReadEntry; TTextChunkIterator* fChunkIterator; }; #endif // TaligentSamples_SAMPLESELECTTEXTINTERACTOR