VTK  9.4.20241230
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
vtkCallbackCommand Class Reference

supports function callbacks More...

#include <vtkCallbackCommand.h>

Inheritance diagram for vtkCallbackCommand:
[legend]
Collaboration diagram for vtkCallbackCommand:
[legend]

Public Types

typedef vtkCommand Superclass
 
- Public Types inherited from vtkCommand
enum  EventIds {
  NoEvent = 0 , AnyEvent , DeleteEvent , StartEvent ,
  EndEvent , RenderEvent , ProgressEvent , PickEvent ,
  StartPickEvent , EndPickEvent , AbortCheckEvent , ExitEvent ,
  LeftButtonPressEvent , LeftButtonReleaseEvent , MiddleButtonPressEvent , MiddleButtonReleaseEvent ,
  RightButtonPressEvent , RightButtonReleaseEvent , EnterEvent , LeaveEvent ,
  KeyPressEvent , KeyReleaseEvent , CharEvent , ExposeEvent ,
  ConfigureEvent , TimerEvent , MouseMoveEvent , MouseWheelForwardEvent ,
  MouseWheelBackwardEvent , ActiveCameraEvent , CreateCameraEvent , ResetCameraEvent ,
  ResetCameraClippingRangeEvent , ModifiedEvent , WindowLevelEvent , StartWindowLevelEvent ,
  EndWindowLevelEvent , ResetWindowLevelEvent , SetOutputEvent , ErrorEvent ,
  WarningEvent , StartInteractionEvent , DropFilesEvent , UpdateDropLocationEvent ,
  InteractionEvent , EndInteractionEvent , EnableEvent , DisableEvent ,
  CreateTimerEvent , DestroyTimerEvent , PlacePointEvent , DeletePointEvent ,
  PlaceWidgetEvent , CursorChangedEvent , ExecuteInformationEvent , RenderWindowMessageEvent ,
  WrongTagEvent , StartAnimationCueEvent , ResliceAxesChangedEvent , AnimationCueTickEvent ,
  EndAnimationCueEvent , VolumeMapperRenderEndEvent , VolumeMapperRenderProgressEvent , VolumeMapperRenderStartEvent ,
  VolumeMapperComputeGradientsEndEvent , VolumeMapperComputeGradientsProgressEvent , VolumeMapperComputeGradientsStartEvent , WidgetModifiedEvent ,
  WidgetValueChangedEvent , WidgetActivateEvent , ConnectionCreatedEvent , ConnectionClosedEvent ,
  DomainModifiedEvent , PropertyModifiedEvent , UpdateEvent , RegisterEvent ,
  UnRegisterEvent , UpdateInformationEvent , AnnotationChangedEvent , SelectionChangedEvent ,
  UpdatePropertyEvent , ViewProgressEvent , UpdateDataEvent , CurrentChangedEvent ,
  ComputeVisiblePropBoundsEvent , TDxMotionEvent , TDxButtonPressEvent , TDxButtonReleaseEvent ,
  HoverEvent , LoadStateEvent , SaveStateEvent , StateChangedEvent ,
  WindowMakeCurrentEvent , WindowIsCurrentEvent , WindowFrameEvent , HighlightEvent ,
  WindowSupportsOpenGLEvent , WindowIsDirectEvent , WindowStereoTypeChangedEvent , WindowResizeEvent ,
  UncheckedPropertyModifiedEvent , UpdateShaderEvent , MessageEvent , StartSwipeEvent ,
  SwipeEvent , EndSwipeEvent , StartPinchEvent , PinchEvent ,
  EndPinchEvent , StartRotateEvent , RotateEvent , EndRotateEvent ,
  StartPanEvent , PanEvent , EndPanEvent , TapEvent ,
  LongTapEvent , FourthButtonPressEvent , FourthButtonReleaseEvent , FifthButtonPressEvent ,
  FifthButtonReleaseEvent , Move3DEvent , Button3DEvent , TextEvent ,
  LeftButtonDoubleClickEvent , MiddleButtonDoubleClickEvent , RightButtonDoubleClickEvent , MouseWheelLeftEvent ,
  MouseWheelRightEvent , ViewerMovement3DEvent , Menu3DEvent , NextPose3DEvent ,
  Clip3DEvent , PositionProp3DEvent , Pick3DEvent , Select3DEvent ,
  Elevation3DEvent , UserEvent = 1000
}
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
vtkCallbackCommandNewInstance () const
 
void Execute (vtkObject *caller, unsigned long eid, void *callData) override
 Satisfy the superclass API for callbacks.
 
virtual void SetClientData (void *cd)
 Methods to set and get client and callback information, and the callback function.
 
virtual void * GetClientData ()
 
virtual void SetCallback (void(*f)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata))
 
virtual void SetClientDataDeleteCallback (void(*f)(void *))
 
void SetAbortFlagOnExecute (int f)
 Set/Get the abort flag on execute.
 
int GetAbortFlagOnExecute ()
 
void AbortFlagOnExecuteOn ()
 
void AbortFlagOnExecuteOff ()
 
- Public Member Functions inherited from vtkCommand
 vtkBaseTypeMacro (vtkCommand, vtkObjectBase)
 
void UnRegister ()
 Decrease the reference count (release by another object).
 
virtual void Execute (vtkObject *caller, unsigned long eventId, void *callData)=0
 All derived classes of vtkCommand must implement this method.
 
void SetAbortFlag (vtkTypeBool f)
 Set/Get the abort flag.
 
vtkTypeBool GetAbortFlag ()
 
void AbortFlagOn ()
 
void AbortFlagOff ()
 
void SetPassiveObserver (vtkTypeBool f)
 Set/Get the passive observer flag.
 
vtkTypeBool GetPassiveObserver ()
 
void PassiveObserverOn ()
 
void PassiveObserverOff ()
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string.
 
virtual std::string GetObjectDescription () const
 The object description printed in messages and PrintSelf output.
 
virtual vtkTypeBool IsA (const char *name)
 Return 1 if this class is the same type of (or a subclass of) the named class.
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
virtual void Delete ()
 Delete a VTK object.
 
virtual void FastDelete ()
 Delete a reference to this object.
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream.
 
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object).
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object).
 
int GetReferenceCount ()
 Return the current reference count of this object.
 
void SetReferenceCount (int)
 Sets the reference count.
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space.
 
virtual void PrintSelf (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses.
 
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not.
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkCallbackCommandSafeDownCast (vtkObjectBase *o)
 
static vtkCallbackCommandNew ()
 
- Static Public Member Functions inherited from vtkCommand
static bool EventHasData (unsigned long event)
 Does this event type contain vtkEventData.
 
static const char * GetStringFromEventId (unsigned long event)
 Convenience methods for translating between event names and event ids.
 
static unsigned long GetEventIdFromString (const char *event)
 Convenience methods for translating between event names and event ids.
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class.
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class).
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within.
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space.
 

Public Attributes

void(* Callback )(vtkObject *, unsigned long, void *, void *)
 
void(* ClientDataDeleteCallback )(void *)
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkCallbackCommand ()
 
 ~vtkCallbackCommand () override
 
- Protected Member Functions inherited from vtkCommand
 vtkCommand ()
 
 ~vtkCommand () override=default
 
 vtkCommand (const vtkCommand &c)
 
void operator= (const vtkCommand &)
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void RegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check)
 
virtual void ReportReferences (vtkGarbageCollector *)
 
virtual void ObjectFinalize ()
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

int AbortFlagOnExecute
 
void * ClientData
 
- Protected Attributes inherited from vtkCommand
vtkTypeBool AbortFlag
 
vtkTypeBool PassiveObserver
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

supports function callbacks

Use vtkCallbackCommand for generic function callbacks. That is, this class can be used when you wish to execute a function (of the signature described below) using the Command/Observer design pattern in VTK. The callback function should have the form

void func(vtkObject*, unsigned long eid, void* clientdata, void *calldata)

where the parameter vtkObject* is the object invoking the event; eid is the event id (see vtkCommand.h); clientdata is special data that should is associated with this instance of vtkCallbackCommand; and calldata is data that the vtkObject::InvokeEvent() may send with the callback. For example, the invocation of the ProgressEvent sends along the progress value as calldata.

See also
vtkCommand vtkOldStyleCallbackCommand
Examples:
vtkCallbackCommand (Examples)
Online Examples:

Tests:
vtkCallbackCommand (Tests)

Definition at line 148 of file vtkCallbackCommand.h.

Member Typedef Documentation

◆ Superclass

Definition at line 151 of file vtkCallbackCommand.h.

Constructor & Destructor Documentation

◆ vtkCallbackCommand()

vtkCallbackCommand::vtkCallbackCommand ( )
protected

◆ ~vtkCallbackCommand()

vtkCallbackCommand::~vtkCallbackCommand ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkCallbackCommand::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkCallbackCommand::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkObjectBase.

◆ SafeDownCast()

static vtkCallbackCommand * vtkCallbackCommand::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkCallbackCommand::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkCallbackCommand * vtkCallbackCommand::NewInstance ( ) const

◆ New()

static vtkCallbackCommand * vtkCallbackCommand::New ( )
inlinestatic

Definition at line 153 of file vtkCallbackCommand.h.

◆ Execute()

void vtkCallbackCommand::Execute ( vtkObject caller,
unsigned long  eid,
void *  callData 
)
overridevirtual

Satisfy the superclass API for callbacks.

Recall that the caller is the instance invoking the event; eid is the event id (see vtkCommand.h); and calldata is information sent when the callback was invoked (e.g., progress value in the vtkCommand::ProgressEvent).

Implements vtkCommand.

◆ SetClientData()

virtual void vtkCallbackCommand::SetClientData ( void *  cd)
inlinevirtual

Methods to set and get client and callback information, and the callback function.

Definition at line 167 of file vtkCallbackCommand.h.

◆ GetClientData()

virtual void * vtkCallbackCommand::GetClientData ( )
inlinevirtual

Definition at line 168 of file vtkCallbackCommand.h.

◆ SetCallback()

virtual void vtkCallbackCommand::SetCallback ( void(*)(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)  f)
inlinevirtual

Definition at line 169 of file vtkCallbackCommand.h.

◆ SetClientDataDeleteCallback()

virtual void vtkCallbackCommand::SetClientDataDeleteCallback ( void(*)(void *)  f)
inlinevirtual

Definition at line 174 of file vtkCallbackCommand.h.

◆ SetAbortFlagOnExecute()

void vtkCallbackCommand::SetAbortFlagOnExecute ( int  f)
inline

Set/Get the abort flag on execute.

If this is set to true the AbortFlag will be set to On automatically when the Execute method is triggered and a callback is set.

Definition at line 181 of file vtkCallbackCommand.h.

◆ GetAbortFlagOnExecute()

int vtkCallbackCommand::GetAbortFlagOnExecute ( )
inline

Definition at line 182 of file vtkCallbackCommand.h.

◆ AbortFlagOnExecuteOn()

void vtkCallbackCommand::AbortFlagOnExecuteOn ( )
inline

Definition at line 183 of file vtkCallbackCommand.h.

◆ AbortFlagOnExecuteOff()

void vtkCallbackCommand::AbortFlagOnExecuteOff ( )
inline

Definition at line 184 of file vtkCallbackCommand.h.

Member Data Documentation

◆ Callback

void(* vtkCallbackCommand::Callback) (vtkObject *, unsigned long, void *, void *)

Definition at line 186 of file vtkCallbackCommand.h.

◆ ClientDataDeleteCallback

void(* vtkCallbackCommand::ClientDataDeleteCallback) (void *)

Definition at line 187 of file vtkCallbackCommand.h.

◆ AbortFlagOnExecute

int vtkCallbackCommand::AbortFlagOnExecute
protected

Definition at line 190 of file vtkCallbackCommand.h.

◆ ClientData

void* vtkCallbackCommand::ClientData
protected

Definition at line 191 of file vtkCallbackCommand.h.


The documentation for this class was generated from the following file: