2 #include <vtkSmartPointer.h>
4 #include <vtkRenderer.h>
5 #include <vtkRenderWindow.h>
6 #include <vtkRenderWindowInteractor.h>
7 #include <cpExtensions/Visualization/BaseInteractorStyle.h>
9 // -------------------------------------------------------------------------
10 #define example_BaseInteractorStyle_Macro( x ) \
11 virtual void On##x( ) \
12 { std::cout << "On" << #x << "( )" << std::endl; }
14 // -------------------------------------------------------------------------
15 class example_BaseInteractorStyle
16 : public cpExtensions::Visualization::BaseInteractorStyle
19 typedef example_BaseInteractorStyle Self;
21 example_BaseInteractorStyle,
22 cpExtensions::Visualization::BaseInteractorStyle
27 { return( new Self ); }
30 example_BaseInteractorStyle_Macro( MouseMove );
31 example_BaseInteractorStyle_Macro( MouseWheelForward );
32 example_BaseInteractorStyle_Macro( MouseWheelBackward );
33 example_BaseInteractorStyle_Macro( LeftButtonDown );
34 example_BaseInteractorStyle_Macro( LeftButtonUp );
35 example_BaseInteractorStyle_Macro( LeftClick );
36 example_BaseInteractorStyle_Macro( LeftDoubleClick );
37 example_BaseInteractorStyle_Macro( MiddleButtonDown );
38 example_BaseInteractorStyle_Macro( MiddleButtonUp );
39 example_BaseInteractorStyle_Macro( MiddleClick );
40 example_BaseInteractorStyle_Macro( MiddleDoubleClick );
41 example_BaseInteractorStyle_Macro( RightButtonDown );
42 example_BaseInteractorStyle_Macro( RightButtonUp );
43 example_BaseInteractorStyle_Macro( RightClick );
44 example_BaseInteractorStyle_Macro( RightDoubleClick );
45 example_BaseInteractorStyle_Macro( Char );
46 example_BaseInteractorStyle_Macro( KeyDown );
47 example_BaseInteractorStyle_Macro( KeyUp );
48 example_BaseInteractorStyle_Macro( KeyPress );
49 example_BaseInteractorStyle_Macro( KeyRelease );
50 example_BaseInteractorStyle_Macro( Expose );
51 example_BaseInteractorStyle_Macro( Configure );
52 example_BaseInteractorStyle_Macro( Enter );
53 example_BaseInteractorStyle_Macro( Leave );
56 example_BaseInteractorStyle( )
59 virtual ~example_BaseInteractorStyle( )
63 // Purposely not implemented
64 example_BaseInteractorStyle( const Self& );
65 Self& operator=( const Self& );
68 // -------------------------------------------------------------------------
69 int main( int argc, char* argv[] )
71 // Configure visualization objects
72 vtkSmartPointer< vtkRenderer > renderer =
73 vtkSmartPointer< vtkRenderer >::New( );
74 renderer->SetBackground( 0.1, 0.3, 0.5 );
76 vtkSmartPointer< vtkRenderWindow > window =
77 vtkSmartPointer< vtkRenderWindow >::New( );
78 window->AddRenderer( renderer );
79 window->SetSize( 600, 600 );
81 // Set up interaction style
82 vtkSmartPointer< example_BaseInteractorStyle > style =
83 vtkSmartPointer< example_BaseInteractorStyle >::New( );
85 // Set up the interaction
86 vtkSmartPointer< vtkRenderWindowInteractor > interactor =
87 vtkSmartPointer< vtkRenderWindowInteractor >::New( );
88 interactor->SetInteractorStyle( style );
89 window->SetInteractor( interactor );