X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpExtensions%2FInteraction%2FBaseStyle.h;fp=lib%2FcpExtensions%2FInteraction%2FBaseStyle.h;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=cee70784d10734a05b54616b5c25c4de5d8dc4c8;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/lib/cpExtensions/Interaction/BaseStyle.h b/lib/cpExtensions/Interaction/BaseStyle.h deleted file mode 100644 index cee7078..0000000 --- a/lib/cpExtensions/Interaction/BaseStyle.h +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef __cpExtensions__Interaction__BaseStyle__h__ -#define __cpExtensions__Interaction__BaseStyle__h__ - -#include -#include -#include - -// ------------------------------------------------------------------------- -#define cpExtensions_BaseStyle_Commands( C ) \ - protected: \ - std::map< T##C##Command, void* > m_##C##Commands; \ - public: \ - inline void Add##C##Command( T##C##Command c, void* d ) \ - { \ - if( c != NULL ) \ - { \ - this->m_##C##Commands[ c ] = d; \ - this->Modified( ); \ - } \ - } \ - inline void Remove##C##Command( T##C##Command c ) \ - { \ - std::map< T##C##Command, void* >::iterator i = \ - this->m_##C##Commands.find( c ); \ - if( i != this->m_##C##Commands.end( ) ) \ - { \ - this->m_##C##Commands.erase( i ); \ - this->Modified( ); \ - } \ - } - -// ------------------------------------------------------------------------- -namespace cpExtensions -{ - namespace Interaction - { - /** - */ - class cpExtensions_EXPORT BaseStyle - : public vtkInteractorStyle - { - public: - typedef BaseStyle Self; - vtkTypeMacro( BaseStyle, vtkInteractorStyle ); - - enum ButtonID - { - ButtonID_None = 0, - ButtonID_Left, - ButtonID_Middle, - ButtonID_Right - }; - - // Callbacks types - typedef void ( *TMouseCommand )( - void*, const ButtonID&, int*, double*, bool, bool, bool - ); - typedef TMouseCommand TMouseClickCommand; - typedef TMouseCommand TMouseDoubleClickCommand; - - // Associate callbacks for each event - cpExtensions_BaseStyle_Commands( MouseClick ); - cpExtensions_BaseStyle_Commands( MouseDoubleClick ); - - public: - static void SetSetDoubleClickDelay( long delay ); - void DelegateTDxEvent( unsigned long event, void* calldata ); - - // Possible mouse motion events - virtual void OnMouseMove( ) cpExtensions_OVERRIDE; - virtual void OnMouseWheelForward( ) cpExtensions_OVERRIDE { } - virtual void OnMouseWheelBackward( ) cpExtensions_OVERRIDE { } - - // Possible mouse click-related events - inline ButtonID GetButtonID( ) const { return( this->m_ActiveButton ); } - - virtual void OnLeftButtonDown( ) cpExtensions_OVERRIDE; - virtual void OnLeftButtonUp( ) cpExtensions_OVERRIDE; - virtual void OnMiddleButtonDown( ) cpExtensions_OVERRIDE; - virtual void OnMiddleButtonUp( ) cpExtensions_OVERRIDE; - virtual void OnRightButtonDown( ) cpExtensions_OVERRIDE; - virtual void OnRightButtonUp( ) cpExtensions_OVERRIDE; - - virtual void OnLeftClick( ); - virtual void OnLeftDoubleClick( ); - virtual void OnMiddleClick( ); - virtual void OnMiddleDoubleClick( ); - virtual void OnRightClick( ); - virtual void OnRightDoubleClick( ); - - // Keyboard-related events - virtual void OnChar( ) cpExtensions_OVERRIDE { } - virtual void OnKeyDown( ) cpExtensions_OVERRIDE { } - virtual void OnKeyUp( ) cpExtensions_OVERRIDE { } - virtual void OnKeyPress( ) cpExtensions_OVERRIDE { } - virtual void OnKeyRelease( ) cpExtensions_OVERRIDE { } - - // Other events - virtual void OnExpose( ) cpExtensions_OVERRIDE { } - virtual void OnConfigure( ) cpExtensions_OVERRIDE { } - virtual void OnEnter( ) cpExtensions_OVERRIDE { } - virtual void OnLeave( ) cpExtensions_OVERRIDE { } - - virtual void Dolly( ) cpExtensions_OVERRIDE; - virtual void Pan( ) cpExtensions_OVERRIDE; - - protected: - BaseStyle( ); - virtual ~BaseStyle( ); - - virtual void _Dolly( double factor ); - - // Extension interface - virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] ) = 0; - - // Main event callback - static void _ProcessEvents( - vtkObject* object, - unsigned long event, - void* clientdata, - void* calldata - ); - - private: - // Purposely not implemented - BaseStyle( const Self& ); - Self& operator=( const Self& ); - - protected: - double m_MotionFactor; - - /** - * Button events - */ - struct _TMouseButtonEvent - { - static long MaxDoubleClick; - long m_LastButtonUp; - long m_LastButtonHeld; - long m_LastButtonDown; - - inline _TMouseButtonEvent( ) - { this->Reset( ); } - inline void Reset( ) - { - this->m_LastButtonUp = 0; - this->m_LastButtonHeld = 0; - this->m_LastButtonDown = -1; - } - inline void Release( ) - { - /* TODO - long c = cpExtensions_CHRONO; - this->m_LastButtonUp = c; - this->m_LastButtonHeld = c - this->m_LastButtonDown; - this->m_LastButtonDown = -1; - */ - } - inline unsigned char Clicks( ) - { - /* TODO - unsigned char n = 0; - long c = cpExtensions_CHRONO; - if( - this->m_LastButtonHeld < MaxDoubleClick && - ( c - this->m_LastButtonUp ) < MaxDoubleClick - ) - { - this->Reset( ); - n = 2; - } - else - n = 1; - if( this->m_LastButtonDown < 0 ) - this->m_LastButtonDown = c; - return( n ); - */ - return( 1 ); - } - }; - _TMouseButtonEvent m_LeftButtonEvent; - _TMouseButtonEvent m_MiddleButtonEvent; - _TMouseButtonEvent m_RightButtonEvent; - ButtonID m_ActiveButton; - }; - - } // ecapseman - -} // ecapseman - -#endif // __cpExtensions__Interaction__BaseStyle__h__ - -// eof - $RCSfile$