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 =========================================================================*/
38 #ifndef vtkCallbackCommand_h
39 #define vtkCallbackCommand_h
40 
41 #include "vtkCommand.h"
42 #include "vtkCommonCoreModule.h" // For export macro
43 
44 class VTKCOMMONCORE_EXPORT vtkCallbackCommand : public vtkCommand
45 {
46 public:
48 
49  static vtkCallbackCommand* New() { return new vtkCallbackCommand; }
50 
57  void Execute(vtkObject* caller, unsigned long eid, void* callData) override;
58 
63  virtual void SetClientData(void* cd) { this->ClientData = cd; }
64  virtual void* GetClientData() { return this->ClientData; }
65  virtual void SetCallback(
66  void (*f)(vtkObject* caller, unsigned long eid, void* clientdata, void* calldata))
67  {
68  this->Callback = f;
69  }
70  virtual void SetClientDataDeleteCallback(void (*f)(void*)) { this->ClientDataDeleteCallback = f; }
71 
77  void SetAbortFlagOnExecute(int f) { this->AbortFlagOnExecute = f; }
78  int GetAbortFlagOnExecute() { return this->AbortFlagOnExecute; }
79  void AbortFlagOnExecuteOn() { this->SetAbortFlagOnExecute(1); }
80  void AbortFlagOnExecuteOff() { this->SetAbortFlagOnExecute(0); }
81 
82  void (*Callback)(vtkObject*, unsigned long, void*, void*);
83  void (*ClientDataDeleteCallback)(void*);
84 
85 protected:
87  void* ClientData;
88 
90  ~vtkCallbackCommand() override;
91 };
92 
93 #endif
94 
95 // VTK-HeaderTest-Exclude: vtkCallbackCommand.h
vtkCommand
superclass for callback/observer methods
Definition: vtkCommand.h:375
vtkCallbackCommand::SetCallback
virtual void SetCallback(void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))
Definition: vtkCallbackCommand.h:65
vtkCallbackCommand::AbortFlagOnExecuteOff
void AbortFlagOnExecuteOff()
Definition: vtkCallbackCommand.h:80
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkCallbackCommand::AbortFlagOnExecute
int AbortFlagOnExecute
Definition: vtkCallbackCommand.h:86
vtkCommand.h
vtkCallbackCommand::ClientData
void * ClientData
Definition: vtkCallbackCommand.h:87
vtkCallbackCommand::SetAbortFlagOnExecute
void SetAbortFlagOnExecute(int f)
Set/Get the abort flag on execute.
Definition: vtkCallbackCommand.h:77
vtkCallbackCommand::AbortFlagOnExecuteOn
void AbortFlagOnExecuteOn()
Definition: vtkCallbackCommand.h:79
vtkCallbackCommand::SetClientDataDeleteCallback
virtual void SetClientDataDeleteCallback(void(*f)(void *))
Definition: vtkCallbackCommand.h:70
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:44
vtkCommand::Execute
virtual void Execute(vtkObject *caller, unsigned long eventId, void *callData)=0
All derived classes of vtkCommand must implement this method.
vtkCallbackCommand::New
static vtkCallbackCommand * New()
Definition: vtkCallbackCommand.h:49
vtkCallbackCommand::SetClientData
virtual void SetClientData(void *cd)
Methods to set and get client and callback information, and the callback function.
Definition: vtkCallbackCommand.h:63
vtkCallbackCommand::GetClientData
virtual void * GetClientData()
Definition: vtkCallbackCommand.h:64
vtkCallbackCommand::GetAbortFlagOnExecute
int GetAbortFlagOnExecute()
Definition: vtkCallbackCommand.h:78