VTK
vtkCallbackCommand.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCallbackCommand.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 =========================================================================*/
38 #ifndef vtkCallbackCommand_h
39 #define vtkCallbackCommand_h
40 
41 #include "vtkCommonCoreModule.h" // For export macro
42 #include "vtkCommand.h"
43 
44 class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
45 {
46 public:
48 
50  {return new vtkCallbackCommand;};
51 
58  void Execute(vtkObject *caller,
59  unsigned long eid,
60  void *callData) VTK_OVERRIDE;
61 
66  virtual void SetClientData(void *cd)
67  { this->ClientData = cd; }
68  virtual void* GetClientData()
69  { return this->ClientData; }
70  virtual void SetCallback(void (*f)(vtkObject *caller, unsigned long eid,
71  void *clientdata, void *calldata))
72  { this->Callback = f; }
73  virtual void SetClientDataDeleteCallback(void (*f)(void *))
74  { this->ClientDataDeleteCallback = f; }
75 
82  { this->AbortFlagOnExecute = f; }
84  { return this->AbortFlagOnExecute; }
86  { this->SetAbortFlagOnExecute(1); }
88  { this->SetAbortFlagOnExecute(0); }
89 
90  void (*Callback)(vtkObject *, unsigned long, void *, void *);
91  void (*ClientDataDeleteCallback)(void *);
92 
93 protected:
94 
96  void *ClientData;
97 
99  ~vtkCallbackCommand() VTK_OVERRIDE;
100 };
101 
102 #endif
103 
104 // VTK-HeaderTest-Exclude: vtkCallbackCommand.h
virtual void Execute(vtkObject *caller, unsigned long eventId, void *callData)=0
All derived classes of vtkCommand must implement this method.
virtual void SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
abstract base class for most VTK objects
Definition: vtkObject.h:53
static vtkCallbackCommand * New()
virtual void SetClientDataDeleteCallback(void(*f)(void *))
void SetAbortFlagOnExecute(int f)
Set/Get the abort flag on execute.
virtual void * GetClientData()
superclass for callback/observer methods
Definition: vtkCommand.h:354
supports function callbacks
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))