VTK
vtkCommand.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCommand.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
204 #ifndef vtkCommand_h
205 #define vtkCommand_h
206 
207 #include "vtkCommonCoreModule.h" // For export macro
208 #include "vtkObjectBase.h"
209 #include "vtkObject.h" // Need vtkTypeMacro
210 
211 // Define all types of events here.
212 // Using this macro makes it possible to avoid mismatches between the event
213 // enums and their string counterparts.
214 #define vtkAllEventsMacro() \
215  _vtk_add_event(AnyEvent)\
216  _vtk_add_event(DeleteEvent)\
217  _vtk_add_event(StartEvent)\
218  _vtk_add_event(EndEvent)\
219  _vtk_add_event(RenderEvent)\
220  _vtk_add_event(ProgressEvent)\
221  _vtk_add_event(PickEvent)\
222  _vtk_add_event(StartPickEvent)\
223  _vtk_add_event(EndPickEvent)\
224  _vtk_add_event(AbortCheckEvent)\
225  _vtk_add_event(ExitEvent)\
226  _vtk_add_event(LeftButtonPressEvent)\
227  _vtk_add_event(LeftButtonReleaseEvent)\
228  _vtk_add_event(MiddleButtonPressEvent)\
229  _vtk_add_event(MiddleButtonReleaseEvent)\
230  _vtk_add_event(RightButtonPressEvent)\
231  _vtk_add_event(RightButtonReleaseEvent)\
232  _vtk_add_event(EnterEvent)\
233  _vtk_add_event(LeaveEvent)\
234  _vtk_add_event(KeyPressEvent)\
235  _vtk_add_event(KeyReleaseEvent)\
236  _vtk_add_event(CharEvent)\
237  _vtk_add_event(ExposeEvent)\
238  _vtk_add_event(ConfigureEvent)\
239  _vtk_add_event(TimerEvent)\
240  _vtk_add_event(MouseMoveEvent)\
241  _vtk_add_event(MouseWheelForwardEvent)\
242  _vtk_add_event(MouseWheelBackwardEvent)\
243  _vtk_add_event(ActiveCameraEvent)\
244  _vtk_add_event(CreateCameraEvent)\
245  _vtk_add_event(ResetCameraEvent)\
246  _vtk_add_event(ResetCameraClippingRangeEvent)\
247  _vtk_add_event(ModifiedEvent)\
248  _vtk_add_event(WindowLevelEvent)\
249  _vtk_add_event(StartWindowLevelEvent)\
250  _vtk_add_event(EndWindowLevelEvent)\
251  _vtk_add_event(ResetWindowLevelEvent)\
252  _vtk_add_event(SetOutputEvent)\
253  _vtk_add_event(ErrorEvent)\
254  _vtk_add_event(WarningEvent)\
255  _vtk_add_event(StartInteractionEvent)\
256  /*^ mainly used by vtkInteractorObservers*/\
257  _vtk_add_event(InteractionEvent)\
258  _vtk_add_event(EndInteractionEvent)\
259  _vtk_add_event(EnableEvent)\
260  _vtk_add_event(DisableEvent)\
261  _vtk_add_event(CreateTimerEvent)\
262  _vtk_add_event(DestroyTimerEvent)\
263  _vtk_add_event(PlacePointEvent)\
264  _vtk_add_event(PlaceWidgetEvent)\
265  _vtk_add_event(CursorChangedEvent)\
266  _vtk_add_event(ExecuteInformationEvent)\
267  _vtk_add_event(RenderWindowMessageEvent)\
268  _vtk_add_event(WrongTagEvent)\
269  _vtk_add_event(StartAnimationCueEvent)\
270  /*^ used by vtkAnimationCue*/ \
271  _vtk_add_event(AnimationCueTickEvent)\
272  _vtk_add_event(EndAnimationCueEvent)\
273  _vtk_add_event(VolumeMapperRenderEndEvent)\
274  _vtk_add_event(VolumeMapperRenderProgressEvent)\
275  _vtk_add_event(VolumeMapperRenderStartEvent)\
276  _vtk_add_event(VolumeMapperComputeGradientsEndEvent)\
277  _vtk_add_event(VolumeMapperComputeGradientsProgressEvent)\
278  _vtk_add_event(VolumeMapperComputeGradientsStartEvent)\
279  _vtk_add_event(WidgetModifiedEvent)\
280  _vtk_add_event(WidgetValueChangedEvent)\
281  _vtk_add_event(WidgetActivateEvent)\
282  _vtk_add_event(ConnectionCreatedEvent)\
283  _vtk_add_event(ConnectionClosedEvent)\
284  _vtk_add_event(DomainModifiedEvent)\
285  _vtk_add_event(PropertyModifiedEvent)\
286  _vtk_add_event(UpdateEvent)\
287  _vtk_add_event(RegisterEvent)\
288  _vtk_add_event(UnRegisterEvent)\
289  _vtk_add_event(UpdateInformationEvent)\
290  _vtk_add_event(AnnotationChangedEvent)\
291  _vtk_add_event(SelectionChangedEvent)\
292  _vtk_add_event(UpdatePropertyEvent)\
293  _vtk_add_event(ViewProgressEvent)\
294  _vtk_add_event(UpdateDataEvent)\
295  _vtk_add_event(CurrentChangedEvent)\
296  _vtk_add_event(ComputeVisiblePropBoundsEvent)\
297  _vtk_add_event(TDxMotionEvent)\
298  /*^ 3D Connexion device event */\
299  _vtk_add_event(TDxButtonPressEvent)\
300  /*^ 3D Connexion device event */\
301  _vtk_add_event(TDxButtonReleaseEvent)\
302  /* 3D Connexion device event */\
303  _vtk_add_event(HoverEvent)\
304  _vtk_add_event(LoadStateEvent)\
305  _vtk_add_event(SaveStateEvent)\
306  _vtk_add_event(StateChangedEvent)\
307  _vtk_add_event(WindowMakeCurrentEvent)\
308  _vtk_add_event(WindowIsCurrentEvent)\
309  _vtk_add_event(WindowFrameEvent)\
310  _vtk_add_event(HighlightEvent)\
311  _vtk_add_event(WindowSupportsOpenGLEvent)\
312  _vtk_add_event(WindowIsDirectEvent)\
313  _vtk_add_event(UncheckedPropertyModifiedEvent)\
314  _vtk_add_event(MessageEvent)
315 
316 #define vtkEventDeclarationMacro(_enum_name)\
317  enum _enum_name{\
318  NoEvent = 0,\
319  vtkAllEventsMacro() \
320  UserEvent = 1000\
321  };
322 
323 
324 // The superclass that all commands should be subclasses of
326 {
327 public:
328  vtkTypeMacro(vtkCommand,vtkObjectBase);
329 
331 
334  void UnRegister();
335  virtual void UnRegister(vtkObjectBase *)
336  { this->UnRegister(); }
338 
340 
349  virtual void Execute(vtkObject *caller, unsigned long eventId,
350  void *callData) = 0;
352 
354 
356  static const char *GetStringFromEventId(unsigned long event);
357  static unsigned long GetEventIdFromString(const char *event);
359 
361 
363  void SetAbortFlag(int f)
364  { this->AbortFlag = f; }
366  { return this->AbortFlag; }
367  void AbortFlagOn()
368  { this->SetAbortFlag(1); }
370  { this->SetAbortFlag(0); }
372 
374 
378  void SetPassiveObserver(int f)
379  { this->PassiveObserver = f; }
381  { return this->PassiveObserver; }
383  { this->SetPassiveObserver(1); }
385  { this->SetPassiveObserver(0); }
387 
388 //BTX
390 
393 #define _vtk_add_event(Enum) Enum,
395 #undef _vtk_add_event
396 //ETX
398 
399 protected:
400  int AbortFlag;
401  int PassiveObserver;
402 
403  vtkCommand();
404  virtual ~vtkCommand() {}
405 
406  friend class vtkSubjectHelper;
407 //BTX
409  void operator=(const vtkCommand&) {}
410 //ETX
411 };
412 
413 #endif /* vtkCommand_h */
414 
415 // VTK-HeaderTest-Exclude: vtkCommand.h
void SetPassiveObserver(int f)
Definition: vtkCommand.h:378
void AbortFlagOff()
Definition: vtkCommand.h:369
void operator=(const vtkCommand &)
Definition: vtkCommand.h:409
abstract base class for most VTK objects
Definition: vtkObject.h:61
#define VTKCOMMONCORE_EXPORT
void AbortFlagOn()
Definition: vtkCommand.h:367
vtkCommand(const vtkCommand &c)
Definition: vtkCommand.h:408
void SetAbortFlag(int f)
Definition: vtkCommand.h:363
void PassiveObserverOn()
Definition: vtkCommand.h:382
superclass for callback/observer methods
Definition: vtkCommand.h:325
virtual void UnRegister(vtkObjectBase *o)
void PassiveObserverOff()
Definition: vtkCommand.h:384
virtual ~vtkCommand()
Definition: vtkCommand.h:404
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
vtkEventDeclarationMacro(EventIds) protected int PassiveObserver
Definition: vtkCommand.h:394
int GetAbortFlag()
Definition: vtkCommand.h:365
int GetPassiveObserver()
Definition: vtkCommand.h:380
virtual void UnRegister(vtkObjectBase *)
Definition: vtkCommand.h:335
#define vtkEventDeclarationMacro(_enum_name)
Definition: vtkCommand.h:316