VTK  9.2.20221001
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 =========================================================================*/
153 #ifndef vtkCallbackCommand_h
154 #define vtkCallbackCommand_h
155 
156 #include "vtkCommand.h"
157 #include "vtkCommonCoreModule.h" // For export macro
158 
159 VTK_ABI_NAMESPACE_BEGIN
160 class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
161 {
162 public:
164 
165  static vtkCallbackCommand* New() { return new vtkCallbackCommand; }
166 
173  void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
174 
179  virtual void SetClientData(void* cd) { this->ClientData = cd; }
180  virtual void* GetClientData() { return this->ClientData; }
181  virtual void SetCallback(
182  void (*f)(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata))
183  {
184  this->Callback = f;
185  }
186  virtual void SetClientDataDeleteCallback(void (*f)(void*)) { this->ClientDataDeleteCallback = f; }
187 
193  void SetAbortFlagOnExecute(int f) { this->AbortFlagOnExecute = f; }
194  int GetAbortFlagOnExecute() { return this->AbortFlagOnExecute; }
195  void AbortFlagOnExecuteOn() { this->SetAbortFlagOnExecute(1); }
196  void AbortFlagOnExecuteOff() { this->SetAbortFlagOnExecute(0); }
197 
198  void (*Callback)(vtkObject*, unsigned long, void*, void*);
199  void (*ClientDataDeleteCallback)(void*);
200 
201 protected:
203  void* ClientData;
204 
207 };
208 
209 VTK_ABI_NAMESPACE_END
210 #endif
211 
212 // VTK-HeaderTest-Exclude: vtkCallbackCommand.h
supports function callbacks
~vtkCallbackCommand() override
virtual void SetClientDataDeleteCallback(void(*f)(void *))
static vtkCallbackCommand * New()
void SetAbortFlagOnExecute(int f)
Set/Get the abort flag on execute.
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))
virtual void * GetClientData()
virtual void SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
void Execute(vtkObject *caller, unsigned long eid, void *callData) override
Satisfy the superclass API for callbacks.
superclass for callback/observer methods
Definition: vtkCommand.h:396
abstract base class for most VTK objects
Definition: vtkObject.h:83