VTK  9.3.0
vtkCallbackCommand.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
32#ifndef vtkCallbackCommand_h
33#define vtkCallbackCommand_h
34
35#include "vtkCommand.h"
36#include "vtkCommonCoreModule.h" // For export macro
37
38VTK_ABI_NAMESPACE_BEGIN
39class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
40{
41public:
43
44 static vtkCallbackCommand* New() { return new vtkCallbackCommand; }
45
52 void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
53
58 virtual void SetClientData(void* cd) { this->ClientData = cd; }
59 virtual void* GetClientData() { return this->ClientData; }
60 virtual void SetCallback(
61 void (*f)(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata))
62 {
63 this->Callback = f;
64 }
65 virtual void SetClientDataDeleteCallback(void (*f)(void*)) { this->ClientDataDeleteCallback = f; }
66
72 void SetAbortFlagOnExecute(int f) { this->AbortFlagOnExecute = f; }
73 int GetAbortFlagOnExecute() { return this->AbortFlagOnExecute; }
74 void AbortFlagOnExecuteOn() { this->SetAbortFlagOnExecute(1); }
75 void AbortFlagOnExecuteOff() { this->SetAbortFlagOnExecute(0); }
76
77 void (*Callback)(vtkObject*, unsigned long, void*, void*);
78 void (*ClientDataDeleteCallback)(void*);
79
80protected:
83
86};
87
88VTK_ABI_NAMESPACE_END
89#endif
90
91// 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:384
abstract base class for most VTK objects
Definition vtkObject.h:49