]> Creatis software - cpPlugins.git/blobdiff - lib/cpExtensions/Interaction/BaseInteractorStyle.h
More widgets added
[cpPlugins.git] / lib / cpExtensions / Interaction / BaseInteractorStyle.h
similarity index 75%
rename from lib/cpExtensions/Visualization/BaseInteractorStyle.h
rename to lib/cpExtensions/Interaction/BaseInteractorStyle.h
index c02dbc7ee701e9e3e1fe957483a59ddc284c2337..1501f00297b4b48c06b78236d448d556def73cd9 100644 (file)
@@ -1,11 +1,12 @@
-#ifndef __CPEXTENSIONS__VISUALIZATION__BASEINTERACTORSTYLE__H__
-#define __CPEXTENSIONS__VISUALIZATION__BASEINTERACTORSTYLE__H__
+#ifndef __CPEXTENSIONS__INTERACTION__BASEINTERACTORSTYLE__H__
+#define __CPEXTENSIONS__INTERACTION__BASEINTERACTORSTYLE__H__
 
 #include <cpExtensions/cpExtensions_Export.h>
 
 #include <chrono>
+#include <map>
 #include <utility>
-#include <vector>
+
 #include <vtkInteractorStyle.h>
 
 /* =========================================================================
@@ -22,7 +23,7 @@
 
 namespace cpExtensions
 {
-  namespace Visualization
+  namespace Interaction
   {
     /**
      */
@@ -42,12 +43,16 @@ namespace cpExtensions
       };
 
       // Callbacks types
-      typedef void ( *TMouseCommand )( void*, const ButtonID&, double*, bool, bool, bool );
+      typedef void ( *TMouseCommand )(
+        void*, const ButtonID&, int*, double*, bool, bool, bool
+        );
       typedef void ( *TMouseWheelCommand )( void*, const int&, bool, bool, bool );
       typedef void ( *TKeyCommand )( void*, const char& );
       typedef void ( *TVoidCommand )( void* );
 
     public:
+      static void SetSetDoubleClickDelay( long delay );
+
       // Associate callbacks for each event
       void AddMouseMoveCommand( TMouseCommand command, void* data );
       void AddMouseClickCommand( TMouseCommand command, void* data );
@@ -59,6 +64,16 @@ namespace cpExtensions
       void AddEnterCommand( TVoidCommand command, void* data );
       void AddLeaveCommand( TVoidCommand command, void* data );
 
+      void RemoveMouseMoveCommand( TMouseCommand command );
+      void RemoveMouseClickCommand( TMouseCommand command );
+      void RemoveMouseDoubleClickCommand( TMouseCommand command );
+      void RemoveMouseWheelCommand( TMouseWheelCommand command );
+      void RemoveKeyCommand( TKeyCommand command );
+      void RemoveExposeCommand( TVoidCommand command );
+      void RemoveConfigureCommand( TVoidCommand command );
+      void RemoveEnterCommand( TVoidCommand command );
+      void RemoveLeaveCommand( TVoidCommand command );
+
       void DelegateTDxEvent( unsigned long event, void* calldata );
 
       // Possible mouse motion events
@@ -68,7 +83,9 @@ namespace cpExtensions
 
       // Possible mouse click-related events
       inline ButtonID GetButtonID( ) const
-        { return( this->m_ActiveButton ); }
+      {
+        return( this->m_ActiveButton );
+      }
 
       virtual void OnLeftButtonDown( );
       virtual void OnLeftButtonUp( );
@@ -107,7 +124,7 @@ namespace cpExtensions
       virtual void _Dolly( double factor );
 
       // Extension interface
-      virtual bool _PickPosition( double pos[ 3 ] ) = 0;
+      virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] ) = 0;
 
       // Main event callback
       static void _ProcessEvents(
@@ -126,15 +143,15 @@ namespace cpExtensions
       double m_MotionFactor;
 
       // Callbacks
-      std::vector< std::pair< TMouseCommand, void* > >      m_MouseMoveCommands;
-      std::vector< std::pair< TMouseCommand, void* > >      m_MouseClickCommands;
-      std::vector< std::pair< TMouseCommand, void* > >      m_MouseDoubleClickCommands;
-      std::vector< std::pair< TMouseWheelCommand, void* > > m_MouseWheelCommands;
-      std::vector< std::pair< TKeyCommand, void* > >        m_KeyCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_ExposeCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_ConfigureCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_EnterCommands;
-      std::vector< std::pair< TVoidCommand, void* > >       m_LeaveCommands;
+      std::map< TMouseCommand, void* >      m_MouseMoveCommands;
+      std::map< TMouseCommand, void* >      m_MouseClickCommands;
+      std::map< TMouseCommand, void* >      m_MouseDoubleClickCommands;
+      std::map< TMouseWheelCommand, void* > m_MouseWheelCommands;
+      std::map< TKeyCommand, void* >        m_KeyCommands;
+      std::map< TVoidCommand, void* >       m_ExposeCommands;
+      std::map< TVoidCommand, void* >       m_ConfigureCommands;
+      std::map< TVoidCommand, void* >       m_EnterCommands;
+      std::map< TVoidCommand, void* >       m_LeaveCommands;
 
       /**
        * Button events
@@ -183,13 +200,13 @@ namespace cpExtensions
       _TMouseButtonEvent m_LeftButtonEvent;
       _TMouseButtonEvent m_MiddleButtonEvent;
       _TMouseButtonEvent m_RightButtonEvent;
-      ButtonID         m_ActiveButton;
+      ButtonID           m_ActiveButton;
     };
 
   } // ecapseman
 
 } // ecapseman
 
-#endif // __CPEXTENSIONS__VISUALIZATION__BASEINTERACTORSTYLE__H__
+#endif // __CPEXTENSIONS__INTERACTION__BASEINTERACTORSTYLE__H__
 
 // eof - $RCSfile$