]> Creatis software - cpPlugins.git/blobdiff - appli/examples/example_BaseInteractorStyle.cxx
Widget integration (step 5/6): generic widget controller finished and tested on linux...
[cpPlugins.git] / appli / examples / example_BaseInteractorStyle.cxx
index 8ec545a7027aa1f3819d0b53d5554a2a90be7d29..922511abed03b96da51e24dc9006ebd61179b326 100644 (file)
@@ -6,6 +6,66 @@
 #include <vtkRenderWindowInteractor.h>
 #include <cpExtensions/Visualization/BaseInteractorStyle.h>
 
+// -------------------------------------------------------------------------
+#define example_BaseInteractorStyle_Macro( x )  \
+  virtual void On##x( )                         \
+  { std::cout << "On" << #x << "( )" << std::endl; }
+
+// -------------------------------------------------------------------------
+class example_BaseInteractorStyle
+  : public cpExtensions::Visualization::BaseInteractorStyle
+{
+public:
+  typedef example_BaseInteractorStyle Self;
+  vtkTypeMacro(
+    example_BaseInteractorStyle,
+    cpExtensions::Visualization::BaseInteractorStyle
+    );
+
+public:
+  static Self* New( )
+    { return( new Self ); }
+
+  // Possible events
+  example_BaseInteractorStyle_Macro( MouseMove );
+  example_BaseInteractorStyle_Macro( MouseWheelForward );
+  example_BaseInteractorStyle_Macro( MouseWheelBackward );
+  example_BaseInteractorStyle_Macro( LeftButtonDown );
+  example_BaseInteractorStyle_Macro( LeftButtonUp );
+  example_BaseInteractorStyle_Macro( LeftClick );
+  example_BaseInteractorStyle_Macro( LeftDoubleClick );
+  example_BaseInteractorStyle_Macro( MiddleButtonDown );
+  example_BaseInteractorStyle_Macro( MiddleButtonUp );
+  example_BaseInteractorStyle_Macro( MiddleClick );
+  example_BaseInteractorStyle_Macro( MiddleDoubleClick );
+  example_BaseInteractorStyle_Macro( RightButtonDown );
+  example_BaseInteractorStyle_Macro( RightButtonUp );
+  example_BaseInteractorStyle_Macro( RightClick );
+  example_BaseInteractorStyle_Macro( RightDoubleClick );
+  example_BaseInteractorStyle_Macro( Char );
+  example_BaseInteractorStyle_Macro( KeyDown );
+  example_BaseInteractorStyle_Macro( KeyUp );
+  example_BaseInteractorStyle_Macro( KeyPress );
+  example_BaseInteractorStyle_Macro( KeyRelease );
+  example_BaseInteractorStyle_Macro( Expose );
+  example_BaseInteractorStyle_Macro( Configure );
+  example_BaseInteractorStyle_Macro( Enter );
+  example_BaseInteractorStyle_Macro( Leave );
+
+protected:
+  example_BaseInteractorStyle( )
+    : Superclass( )
+    { }
+  virtual ~example_BaseInteractorStyle( )
+    { }
+
+private:
+  // Purposely not implemented
+  example_BaseInteractorStyle( const Self& );
+  Self& operator=( const Self& );
+};
+
+// -------------------------------------------------------------------------
 int main( int argc, char* argv[] )
 {
   // Configure visualization objects
@@ -19,9 +79,8 @@ int main( int argc, char* argv[] )
   window->SetSize( 600, 600 );
 
   // Set up interaction style
-  typedef cpExtensions::Visualization::BaseInteractorStyle TInteractorStyle;
-  vtkSmartPointer< TInteractorStyle > style =
-    vtkSmartPointer< TInteractorStyle >::New( );
+  vtkSmartPointer< example_BaseInteractorStyle > style =
+    vtkSmartPointer< example_BaseInteractorStyle >::New( );
 
   // Set up the interaction
   vtkSmartPointer< vtkRenderWindowInteractor > interactor =