1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| void vtkInteractorStyle::SetInteractor(vtkRenderWindowInteractor *i)
{
if(i == this->Interactor)
{
return;
}
// if we already have an Interactor then stop observing it
if(this->Interactor)
{
this->Interactor->RemoveObserver(this->EventCallbackCommand);
}
this->Interactor = i;
// add observers for each of the events handled in ProcessEvents
if(i)
{
i->AddObserver(vtkCommand::EnterEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::LeaveEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::MouseMoveEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::LeftButtonPressEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::LeftButtonReleaseEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::MiddleButtonPressEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::MiddleButtonReleaseEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::RightButtonPressEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::RightButtonReleaseEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::MouseWheelForwardEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::MouseWheelBackwardEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::TouchEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::ExposeEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::ConfigureEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::TimerEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::KeyPressEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::KeyReleaseEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::CharEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::DeleteEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::TDxMotionEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::TDxButtonPressEvent,
this->EventCallbackCommand,
this->Priority);
i->AddObserver(vtkCommand::TDxButtonReleaseEvent,
this->EventCallbackCommand,
this->Priority);
}
this->EventForwarder->SetTarget(this->Interactor);
if (this->Interactor)
{
this->AddObserver(vtkCommand::StartInteractionEvent, this->EventForwarder);
this->AddObserver(vtkCommand::EndInteractionEvent, this->EventForwarder);
}
else
{
this->RemoveObserver(this->EventForwarder);
}
} |
Partager