VTK
dox/Common/vtkCommand.h
Go to the documentation of this file.
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 "vtkObjectBase.h"
00208 
00209 class vtkObject;
00210 
00211 // The superclass that all commands should be subclasses of
00212 class VTK_COMMON_EXPORT vtkCommand : public vtkObjectBase
00213 {
00214 public:
00216 
00219   void UnRegister();
00220   virtual void UnRegister(vtkObjectBase *) 
00221     { this->UnRegister(); }
00223   
00225 
00234   virtual void Execute(vtkObject *caller, unsigned long eventId, 
00235                        void *callData) = 0;
00237 
00239 
00241   static const char *GetStringFromEventId(unsigned long event);
00242   static unsigned long GetEventIdFromString(const char *event);
00244 
00246 
00248   void SetAbortFlag(int f)  
00249     { this->AbortFlag = f; }
00250   int GetAbortFlag() 
00251     { return this->AbortFlag; }
00252   void AbortFlagOn() 
00253     { this->SetAbortFlag(1); }
00254   void AbortFlagOff() 
00255     { this->SetAbortFlag(0); }
00257   
00259 
00263   void SetPassiveObserver(int f)  
00264     { this->PassiveObserver = f; }
00265   int GetPassiveObserver() 
00266     { return this->PassiveObserver; }
00267   void PassiveObserverOn() 
00268     { this->SetPassiveObserver(1); }
00269   void PassiveObserverOff() 
00270     { this->SetPassiveObserver(0); }
00272   
00273 //BTX
00275 
00279   enum EventIds {
00280     NoEvent = 0,
00281     AnyEvent,
00282     DeleteEvent,
00283     StartEvent,
00284     EndEvent,
00285     RenderEvent,
00286     ProgressEvent,
00287     PickEvent,
00288     StartPickEvent,
00289     EndPickEvent,
00290     AbortCheckEvent,
00291     ExitEvent,
00292     LeftButtonPressEvent,
00293     LeftButtonReleaseEvent,
00294     MiddleButtonPressEvent,
00295     MiddleButtonReleaseEvent,
00296     RightButtonPressEvent,
00297     RightButtonReleaseEvent,
00298     EnterEvent,
00299     LeaveEvent,
00300     KeyPressEvent,
00301     KeyReleaseEvent,
00302     CharEvent,
00303     ExposeEvent,
00304     ConfigureEvent,
00305     TimerEvent,
00306     MouseMoveEvent,
00307     MouseWheelForwardEvent,
00308     MouseWheelBackwardEvent,
00309     ActiveCameraEvent,
00310     CreateCameraEvent,
00311     ResetCameraEvent,
00312     ResetCameraClippingRangeEvent,
00313     ModifiedEvent,
00314     WindowLevelEvent,
00315     StartWindowLevelEvent,
00316     EndWindowLevelEvent,
00317     ResetWindowLevelEvent,
00318     SetOutputEvent,
00319     ErrorEvent,
00320     WarningEvent,
00321     StartInteractionEvent, //mainly used by vtkInteractorObservers
00322     InteractionEvent,
00323     EndInteractionEvent,
00324     EnableEvent,
00325     DisableEvent,
00326     CreateTimerEvent,
00327     DestroyTimerEvent,
00328     PlacePointEvent,
00329     PlaceWidgetEvent,
00330     CursorChangedEvent,
00331     ExecuteInformationEvent,
00332     RenderWindowMessageEvent,
00333     WrongTagEvent,
00334     StartAnimationCueEvent, // used by vtkAnimationCue
00335     AnimationCueTickEvent,
00336     EndAnimationCueEvent,
00337     VolumeMapperRenderEndEvent,
00338     VolumeMapperRenderProgressEvent,
00339     VolumeMapperRenderStartEvent,
00340     VolumeMapperComputeGradientsEndEvent,
00341     VolumeMapperComputeGradientsProgressEvent,
00342     VolumeMapperComputeGradientsStartEvent,
00343     WidgetModifiedEvent,
00344     WidgetValueChangedEvent,
00345     WidgetActivateEvent,
00346     ConnectionCreatedEvent, 
00347     ConnectionClosedEvent,
00348     DomainModifiedEvent,
00349     PropertyModifiedEvent,
00350     UpdateEvent,
00351     RegisterEvent,
00352     UnRegisterEvent,
00353     UpdateInformationEvent,
00354     AnnotationChangedEvent,
00355     SelectionChangedEvent,
00356     UpdatePropertyEvent,
00357     ViewProgressEvent,
00358     UpdateDataEvent,
00359     CurrentChangedEvent,
00360     ComputeVisiblePropBoundsEvent,
00361     TDxMotionEvent, // 3D Connexion device event
00362     TDxButtonPressEvent, // 3D Connexion device event
00363     TDxButtonReleaseEvent, // 3D Connexion device event
00364     HoverEvent,
00365     LoadStateEvent,
00366     SaveStateEvent,
00367     StateChangedEvent,
00368     UserEvent = 1000
00369   };
00371 //ETX
00372 
00373 protected:
00374   int AbortFlag;
00375   int PassiveObserver;
00376 
00377   vtkCommand();
00378   virtual ~vtkCommand() {}
00379 
00380   friend class vtkSubjectHelper;
00381 //BTX
00382   vtkCommand(const vtkCommand& c) : vtkObjectBase(c) {}
00383   void operator=(const vtkCommand&) {}
00384 //ETX
00385 };
00386 
00387 #endif /* __vtkCommand_h */
00388