VTK  9.1.0
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=========================================================================*/
147#ifndef vtkCallbackCommand_h
148#define vtkCallbackCommand_h
149
150#include "vtkCommand.h"
151#include "vtkCommonCoreModule.h" // For export macro
152
153class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
154{
155public:
157
158 static vtkCallbackCommand* New() { return new vtkCallbackCommand; }
159
166 void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
167
172 virtual void SetClientData(void* cd) { this->ClientData = cd; }
173 virtual void* GetClientData() { return this->ClientData; }
174 virtual void SetCallback(
175 void (*f)(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata))
176 {
177 this->Callback = f;
178 }
179 virtual void SetClientDataDeleteCallback(void (*f)(void*)) { this->ClientDataDeleteCallback = f; }
180
186 void SetAbortFlagOnExecute(int f) { this->AbortFlagOnExecute = f; }
187 int GetAbortFlagOnExecute() { return this->AbortFlagOnExecute; }
188 void AbortFlagOnExecuteOn() { this->SetAbortFlagOnExecute(1); }
189 void AbortFlagOnExecuteOff() { this->SetAbortFlagOnExecute(0); }
190
191 void (*Callback)(vtkObject*, unsigned long, void*, void*);
192 void (*ClientDataDeleteCallback)(void*);
193
194protected:
197
200};
201
202#endif
203
204// VTK-HeaderTest-Exclude: vtkCallbackCommand.h
supports function callbacks
~vtkCallbackCommand() override
virtual void SetClientDataDeleteCallback(void(*f)(void *))
virtual void * GetClientData()
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 SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
static vtkCallbackCommand * New()
void Execute(vtkObject *caller, unsigned long eid, void *callData) override
Satisfy the superclass API for callbacks.
superclass for callback/observer methods
Definition: vtkCommand.h:394
abstract base class for most VTK objects
Definition: vtkObject.h:73