#include "vtkConeSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkActor.h"
#include "vtkRenderer.h"
#include "vtkCommand.h"

class vtkForwardCallback : public vtkCommand
{
public:
  static vtkForwardCallback *New() 
    { return new vtkForwardCallback; }
  void Delete()
    { delete this; }
  virtual void Execute(vtkObject *caller, unsigned long, void*)
    {
      printf("Forward\n");
    }
};

class vtkBackwardCallback : public vtkCommand
{
public:
  static vtkBackwardCallback *New() 
    { return new vtkBackwardCallback; }
  void Delete()
    { delete this; }
  virtual void Execute(vtkObject *caller, unsigned long, void*)
    {
      printf("Backward\n");
    }
};

int main( int argc, char *argv[] )
{
  vtkConeSource *cone = vtkConeSource::New();
  
  vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
  coneMapper->SetInput( cone->GetOutput() );

  vtkActor *coneActor = vtkActor::New();
  coneActor->SetMapper( coneMapper );

  vtkRenderer *ren1= vtkRenderer::New();
  ren1->AddActor( coneActor );
  

  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer( ren1 );
  

  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);

  vtkForwardCallback *forward = vtkForwardCallback::New();
  vtkBackwardCallback *backward = vtkBackwardCallback::New();
  iren->AddObserver(vtkCommand::MouseWheelForwardEvent, forward);
  iren->AddObserver(vtkCommand::MouseWheelBackwardEvent, backward);

  iren->Initialize();
  iren->Start();
  
  cone->Delete();
  coneMapper->Delete();
  coneActor->Delete();
  //forward->Delete();  //don't know which VTK version is used
  //backward->Delete(); //don't know which VTK version is used
  ren1->Delete();
  renWin->Delete();
  iren->Delete();

  return 0;
}



