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=========================================================================*/
47#ifndef vtkCallbackCommand_h
48#define vtkCallbackCommand_h
49
50#include "vtkCommand.h"
51#include "vtkCommonCoreModule.h" // For export macro
52
53class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
54{
55public:
57
58 static vtkCallbackCommand* New() { return new vtkCallbackCommand; }
59
66 void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
67
72 virtual void SetClientData(void* cd) { this->ClientData = cd; }
73 virtual void* GetClientData() { return this->ClientData; }
74 virtual void SetCallback(
75 void (*f)(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata))
76 {
77 this->Callback = f;
78 }
79 virtual void SetClientDataDeleteCallback(void (*f)(void*)) { this->ClientDataDeleteCallback = f; }
80
86 void SetAbortFlagOnExecute(int f) { this->AbortFlagOnExecute = f; }
87 int GetAbortFlagOnExecute() { return this->AbortFlagOnExecute; }
88 void AbortFlagOnExecuteOn() { this->SetAbortFlagOnExecute(1); }
89 void AbortFlagOnExecuteOff() { this->SetAbortFlagOnExecute(0); }
90
91 void (*Callback)(vtkObject*, unsigned long, void*, void*);
92 void (*ClientDataDeleteCallback)(void*);
93
94protected:
97
100};
101
102#endif
103
104// 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:63