#include #include #include #include #include // ------------------------------------------------------------------------- #define example_BaseInteractorStyle_Macro( x ) \ virtual void On##x( ) \ { std::cout << "On" << #x << "( )" << std::endl; } // ------------------------------------------------------------------------- class example_BaseInteractorStyle : public cpExtensions::Interaction::BaseInteractorStyle { public: typedef example_BaseInteractorStyle Self; vtkTypeMacro( example_BaseInteractorStyle, cpExtensions::Interaction::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( ) { } virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] ) { return( true ); // Just testing... } private: // Purposely not implemented example_BaseInteractorStyle( const Self& ); Self& operator=( const Self& ); }; // ------------------------------------------------------------------------- int main( int argc, char* argv[] ) { // Configure visualization objects vtkSmartPointer< vtkRenderer > renderer = vtkSmartPointer< vtkRenderer >::New( ); renderer->SetBackground( 0.1, 0.3, 0.5 ); vtkSmartPointer< vtkRenderWindow > window = vtkSmartPointer< vtkRenderWindow >::New( ); window->AddRenderer( renderer ); window->SetSize( 600, 600 ); // Set up interaction style vtkSmartPointer< example_BaseInteractorStyle > style = vtkSmartPointer< example_BaseInteractorStyle >::New( ); // Set up the interaction vtkSmartPointer< vtkRenderWindowInteractor > interactor = vtkSmartPointer< vtkRenderWindowInteractor >::New( ); interactor->SetInteractorStyle( style ); window->SetInteractor( interactor ); // Begin interaction window->Render( ); interactor->Start( ); return( 0 ); } // eof - $RCSfile$