Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Common/vtkCommand.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCommand.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00065 #ifndef __vtkCommand_h
00066 #define __vtkCommand_h
00067 
00068 #include "vtkObjectBase.h"
00069 
00070 class vtkObject;
00071 
00072 // The superclass that all commands should be subclasses of
00073 class VTK_COMMON_EXPORT vtkCommand : public vtkObjectBase
00074 {
00075 public:
00077 
00080   void UnRegister();
00081   virtual void UnRegister(vtkObjectBase *) 
00082     { this->UnRegister(); }
00084   
00086 
00095   virtual void Execute(vtkObject *caller, unsigned long eventId, 
00096                        void *callData) = 0;
00098 
00100 
00102   static const char *GetStringFromEventId(unsigned long event);
00103   static unsigned long GetEventIdFromString(const char *event);
00105 
00107 
00109   void SetAbortFlag(int f)  
00110     { if(this->AbortFlag) *this->AbortFlag = f; }
00111   int GetAbortFlag() 
00112     { return (this->AbortFlag) ? *this->AbortFlag: 0; }
00113   void AbortFlagOn() 
00114     { this->SetAbortFlag(1); }
00115   void AbortFlagOff() 
00116     { this->SetAbortFlag(0); }
00118   
00119 //BTX
00121   /*! All the currently defined events are listed here.  Developers can use
00122       -- vtkCommand::UserEvent + int to specify their own event ids. If
00123       this list is adjusted, be sure to adjust vtkCommandEventStrings in
00124       vtkCommand.cxx to match. */
00125   enum EventIds {
00126     NoEvent = 0,
00127     AnyEvent,
00128     DeleteEvent,
00129     StartEvent,
00130     EndEvent,
00131     ProgressEvent,
00132     PickEvent,
00133     StartPickEvent,
00134     EndPickEvent,
00135     AbortCheckEvent,
00136     ExitEvent,
00137     LeftButtonPressEvent,
00138     LeftButtonReleaseEvent,
00139     MiddleButtonPressEvent,
00140     MiddleButtonReleaseEvent,
00141     RightButtonPressEvent,
00142     RightButtonReleaseEvent,
00143     EnterEvent,
00144     LeaveEvent,
00145     KeyPressEvent,
00146     KeyReleaseEvent,
00147     CharEvent,
00148     ExposeEvent,
00149     ConfigureEvent,
00150     TimerEvent,
00151     MouseMoveEvent,
00152     ResetCameraEvent,
00153     ResetCameraClippingRangeEvent,
00154     ModifiedEvent,
00155     WindowLevelEvent,
00156     StartWindowLevelEvent,
00157     EndWindowLevelEvent,
00158     ResetWindowLevelEvent,
00159     NextDataEvent,
00160     PushDataStartEvent,
00161     SetOutputEvent,
00162     EndOfDataEvent,
00163     ErrorEvent,
00164     WarningEvent,
00165     StartInteractionEvent, //mainly used by vtkInteractorObservers
00166     InteractionEvent,
00167     EndInteractionEvent,
00168     EnableEvent,
00169     DisableEvent,
00170     CreateTimerEvent,
00171     DestroyTimerEvent,
00172     PlaceWidgetEvent,
00173     CursorChangedEvent,
00174     ExecuteInformationEvent,
00175     RenderWindowMessageEvent,
00176     UserEvent = 1000
00177   };
00179 //ETX
00180 
00181 protected:
00182   int* AbortFlag;
00183   vtkCommand();
00184   virtual ~vtkCommand() {}
00185 
00186   //helper function for manipulating abort flag
00187   void SetAbortFlagPointer(int* f)  
00188     { this->AbortFlag = f; }
00189 
00190   friend class vtkSubjectHelper;
00191 //BTX
00192   vtkCommand(const vtkCommand& c) : vtkObjectBase(c) {}
00193   void operator=(const vtkCommand&) {}
00194 //ETX
00195 };
00196 
00197 #endif /* __vtkCommand_h */
00198