VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCommand.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00204 #ifndef __vtkCommand_h 00205 #define __vtkCommand_h 00206 00207 #include "vtkCommonCoreModule.h" // For export macro 00208 #include "vtkObjectBase.h" 00209 #include "vtkObject.h" // Need vtkTypeMacro 00210 00211 // Define all types of events here. 00212 // Using this macro makes it possible to avoid mismatches between the event 00213 // enums and their string counterparts. 00214 #define vtkAllEventsMacro() \ 00215 _vtk_add_event(AnyEvent)\ 00216 _vtk_add_event(DeleteEvent)\ 00217 _vtk_add_event(StartEvent)\ 00218 _vtk_add_event(EndEvent)\ 00219 _vtk_add_event(RenderEvent)\ 00220 _vtk_add_event(ProgressEvent)\ 00221 _vtk_add_event(PickEvent)\ 00222 _vtk_add_event(StartPickEvent)\ 00223 _vtk_add_event(EndPickEvent)\ 00224 _vtk_add_event(AbortCheckEvent)\ 00225 _vtk_add_event(ExitEvent)\ 00226 _vtk_add_event(LeftButtonPressEvent)\ 00227 _vtk_add_event(LeftButtonReleaseEvent)\ 00228 _vtk_add_event(MiddleButtonPressEvent)\ 00229 _vtk_add_event(MiddleButtonReleaseEvent)\ 00230 _vtk_add_event(RightButtonPressEvent)\ 00231 _vtk_add_event(RightButtonReleaseEvent)\ 00232 _vtk_add_event(EnterEvent)\ 00233 _vtk_add_event(LeaveEvent)\ 00234 _vtk_add_event(KeyPressEvent)\ 00235 _vtk_add_event(KeyReleaseEvent)\ 00236 _vtk_add_event(CharEvent)\ 00237 _vtk_add_event(ExposeEvent)\ 00238 _vtk_add_event(ConfigureEvent)\ 00239 _vtk_add_event(TimerEvent)\ 00240 _vtk_add_event(MouseMoveEvent)\ 00241 _vtk_add_event(MouseWheelForwardEvent)\ 00242 _vtk_add_event(MouseWheelBackwardEvent)\ 00243 _vtk_add_event(ActiveCameraEvent)\ 00244 _vtk_add_event(CreateCameraEvent)\ 00245 _vtk_add_event(ResetCameraEvent)\ 00246 _vtk_add_event(ResetCameraClippingRangeEvent)\ 00247 _vtk_add_event(ModifiedEvent)\ 00248 _vtk_add_event(WindowLevelEvent)\ 00249 _vtk_add_event(StartWindowLevelEvent)\ 00250 _vtk_add_event(EndWindowLevelEvent)\ 00251 _vtk_add_event(ResetWindowLevelEvent)\ 00252 _vtk_add_event(SetOutputEvent)\ 00253 _vtk_add_event(ErrorEvent)\ 00254 _vtk_add_event(WarningEvent)\ 00255 _vtk_add_event(StartInteractionEvent)\ 00256 /*^ mainly used by vtkInteractorObservers*/\ 00257 _vtk_add_event(InteractionEvent)\ 00258 _vtk_add_event(EndInteractionEvent)\ 00259 _vtk_add_event(EnableEvent)\ 00260 _vtk_add_event(DisableEvent)\ 00261 _vtk_add_event(CreateTimerEvent)\ 00262 _vtk_add_event(DestroyTimerEvent)\ 00263 _vtk_add_event(PlacePointEvent)\ 00264 _vtk_add_event(PlaceWidgetEvent)\ 00265 _vtk_add_event(CursorChangedEvent)\ 00266 _vtk_add_event(ExecuteInformationEvent)\ 00267 _vtk_add_event(RenderWindowMessageEvent)\ 00268 _vtk_add_event(WrongTagEvent)\ 00269 _vtk_add_event(StartAnimationCueEvent)\ 00270 /*^ used by vtkAnimationCue*/ \ 00271 _vtk_add_event(AnimationCueTickEvent)\ 00272 _vtk_add_event(EndAnimationCueEvent)\ 00273 _vtk_add_event(VolumeMapperRenderEndEvent)\ 00274 _vtk_add_event(VolumeMapperRenderProgressEvent)\ 00275 _vtk_add_event(VolumeMapperRenderStartEvent)\ 00276 _vtk_add_event(VolumeMapperComputeGradientsEndEvent)\ 00277 _vtk_add_event(VolumeMapperComputeGradientsProgressEvent)\ 00278 _vtk_add_event(VolumeMapperComputeGradientsStartEvent)\ 00279 _vtk_add_event(WidgetModifiedEvent)\ 00280 _vtk_add_event(WidgetValueChangedEvent)\ 00281 _vtk_add_event(WidgetActivateEvent)\ 00282 _vtk_add_event(ConnectionCreatedEvent)\ 00283 _vtk_add_event(ConnectionClosedEvent)\ 00284 _vtk_add_event(DomainModifiedEvent)\ 00285 _vtk_add_event(PropertyModifiedEvent)\ 00286 _vtk_add_event(UpdateEvent)\ 00287 _vtk_add_event(RegisterEvent)\ 00288 _vtk_add_event(UnRegisterEvent)\ 00289 _vtk_add_event(UpdateInformationEvent)\ 00290 _vtk_add_event(AnnotationChangedEvent)\ 00291 _vtk_add_event(SelectionChangedEvent)\ 00292 _vtk_add_event(UpdatePropertyEvent)\ 00293 _vtk_add_event(ViewProgressEvent)\ 00294 _vtk_add_event(UpdateDataEvent)\ 00295 _vtk_add_event(CurrentChangedEvent)\ 00296 _vtk_add_event(ComputeVisiblePropBoundsEvent)\ 00297 _vtk_add_event(TDxMotionEvent)\ 00298 /*^ 3D Connexion device event */\ 00299 _vtk_add_event(TDxButtonPressEvent)\ 00300 /*^ 3D Connexion device event */\ 00301 _vtk_add_event(TDxButtonReleaseEvent)\ 00302 /* 3D Connexion device event */\ 00303 _vtk_add_event(HoverEvent)\ 00304 _vtk_add_event(LoadStateEvent)\ 00305 _vtk_add_event(SaveStateEvent)\ 00306 _vtk_add_event(StateChangedEvent)\ 00307 _vtk_add_event(WindowMakeCurrentEvent)\ 00308 _vtk_add_event(WindowIsCurrentEvent)\ 00309 _vtk_add_event(WindowFrameEvent)\ 00310 _vtk_add_event(HighlightEvent)\ 00311 _vtk_add_event(WindowSupportsOpenGLEvent)\ 00312 _vtk_add_event(WindowIsDirectEvent)\ 00313 _vtk_add_event(UncheckedPropertyModifiedEvent)\ 00314 _vtk_add_event(MessageEvent) 00315 00316 #define vtkEventDeclarationMacro(_enum_name)\ 00317 enum _enum_name{\ 00318 NoEvent = 0,\ 00319 vtkAllEventsMacro() \ 00320 UserEvent = 1000\ 00321 }; 00322 00323 00324 // The superclass that all commands should be subclasses of 00325 class VTKCOMMONCORE_EXPORT vtkCommand : public vtkObjectBase 00326 { 00327 public: 00328 vtkTypeMacro(vtkCommand,vtkObjectBase); 00329 00331 00334 void UnRegister(); 00335 virtual void UnRegister(vtkObjectBase *) 00336 { this->UnRegister(); } 00338 00340 00349 virtual void Execute(vtkObject *caller, unsigned long eventId, 00350 void *callData) = 0; 00352 00354 00356 static const char *GetStringFromEventId(unsigned long event); 00357 static unsigned long GetEventIdFromString(const char *event); 00359 00361 00363 void SetAbortFlag(int f) 00364 { this->AbortFlag = f; } 00365 int GetAbortFlag() 00366 { return this->AbortFlag; } 00367 void AbortFlagOn() 00368 { this->SetAbortFlag(1); } 00369 void AbortFlagOff() 00370 { this->SetAbortFlag(0); } 00372 00374 00378 void SetPassiveObserver(int f) 00379 { this->PassiveObserver = f; } 00380 int GetPassiveObserver() 00381 { return this->PassiveObserver; } 00382 void PassiveObserverOn() 00383 { this->SetPassiveObserver(1); } 00384 void PassiveObserverOff() 00385 { this->SetPassiveObserver(0); } 00387 00388 //BTX 00390 00393 #define _vtk_add_event(Enum) Enum, 00394 vtkEventDeclarationMacro(EventIds) 00395 #undef _vtk_add_event 00396 //ETX 00398 00399 protected: 00400 int AbortFlag; 00401 int PassiveObserver; 00402 00403 vtkCommand(); 00404 virtual ~vtkCommand() {} 00405 00406 friend class vtkSubjectHelper; 00407 //BTX 00408 vtkCommand(const vtkCommand& c) : vtkObjectBase(c) {} 00409 void operator=(const vtkCommand&) {} 00410 //ETX 00411 }; 00412 00413 #endif /* __vtkCommand_h */ 00414 00415 // VTK-HeaderTest-Exclude: vtkCommand.h