[vtk-developers] Catching member events in OO style

David Doria daviddoria at gmail.com
Wed Sep 22 08:36:39 EDT 2010


As an example, say I have a vtkImageTracerWidget as a member variable
of a subclass of vtkInteractorStyle. To catch the widgets events in a
way that I still have access to the class instance data, I have
declared a static callback function

class MyClass : public vtkInteractoStyle
{
 public:
   static void KeypressCallbackFunction ( vtkObject* caller,  long
     unsigned int eventId, void* clientData, void* callData );

When I set up the vtkCallbackCommand, I used SetClientData(this) to
give the callback access to my interactor style. Unfortunately this is
only public access. This seems like a horribly convoluted way to
catching these events - is there a more OO-friendly way?

Thanks,

David



More information about the vtk-developers mailing list