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 =========================================================================*/
44 #ifndef vtkCallbackCommand_h
45 #define vtkCallbackCommand_h
46 
47 #include "vtkCommonCoreModule.h" // For export macro
48 #include "vtkCommand.h"
49 
50 class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
51 {
52 public:
54 
56  {return new vtkCallbackCommand;};
57 
64  void Execute(vtkObject *caller,
65  unsigned long eid,
66  void *callData) VTK_OVERRIDE;
67 
72  virtual void SetClientData(void *cd)
73  { this->ClientData = cd; }
74  virtual void* GetClientData()
75  { return this->ClientData; }
76  virtual void SetCallback(void (*f)(vtkObject *caller, unsigned long eid,
77  void *clientdata, void *calldata))
78  { this->Callback = f; }
79  virtual void SetClientDataDeleteCallback(void (*f)(void *))
80  { this->ClientDataDeleteCallback = f; }
81 
88  { this->AbortFlagOnExecute = f; }
90  { return this->AbortFlagOnExecute; }
92  { this->SetAbortFlagOnExecute(1); }
94  { this->SetAbortFlagOnExecute(0); }
95 
96  void (*Callback)(vtkObject *, unsigned long, void *, void *);
97  void (*ClientDataDeleteCallback)(void *);
98 
99 protected:
100 
102  void *ClientData;
103 
105  ~vtkCallbackCommand() VTK_OVERRIDE;
106 };
107 
108 #endif
109 
110 // 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:59
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:341
supports function callbacks
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))