MCPcopy Create free account
hub / github.com/MITK/MITK / SetEnabled

Method SetEnabled

Modules/Core/src/Rendering/mitkVtkEventProvider.cpp:80–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void mitk::vtkEventProvider::SetEnabled(int enabling)
81{
82 if (!this->Interactor)
83 {
84 VTKEVENTPROVIDER_ERROR << "The interactor must be set prior to enabling/disabling widget";
85 return;
86 }
87
88 if (enabling) //----------------------------------------------------------
89 {
90 VTKEVENTPROVIDER_DEBUG << "Enabling widget";
91
92 if (this->Enabled) // already enabled, just return
93 {
94 return;
95 }
96
97 this->Enabled = 1;
98
99 // listen to all event types specified in m_InteractionEventsVector
100 vtkRenderWindowInteractor *i = this->Interactor;
101
102 InteractionEventsVectorType::iterator it;
103 for (it = m_InteractionEventsVector.begin(); it != m_InteractionEventsVector.end(); ++it)
104 {
105 // add observer to interactorStyle
106 i->GetInteractorStyle()->AddObserver((vtkCommand::EventIds)(*it), this->EventCallbackCommand, this->Priority);
107 }
108
109 this->InvokeEvent(vtkCommand::EnableEvent, nullptr);
110 }
111
112 else // disabling-----------------------------------------------------------
113 {
114 VTKEVENTPROVIDER_DEBUG << "Disabling widget";
115
116 if (!this->Enabled) // already disabled, just return
117 {
118 return;
119 }
120
121 this->Enabled = 0;
122
123 // don't listen for events any more
124 this->Interactor->RemoveObserver(this->EventCallbackCommand);
125 // this->Interactor->HandleEventLoop = 0;
126
127 this->InvokeEvent(vtkCommand::DisableEvent, nullptr);
128 }
129}
130
131//----------------------------------------------------------------------------
132// This adds the keypress event observer and the delete event observer

Callers 3

SetInteractorMethod · 0.95
RenderWindowMethod · 0.45
ReinitEventProviderMethod · 0.45

Calls 3

AddObserverMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected