VTK  9.3.20240415
vtkWidgetCallbackMapper.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
46 #ifndef vtkWidgetCallbackMapper_h
47 #define vtkWidgetCallbackMapper_h
48 
49 #include "vtkInteractionWidgetsModule.h" // For export macro
50 #include "vtkObject.h"
51 
52 VTK_ABI_NAMESPACE_BEGIN
53 class vtkWidgetEvent;
54 class vtkAbstractWidget;
56 class vtkCallbackMap; // PIMPL encapsulation of STL map
57 class vtkEventData;
58 
59 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetCallbackMapper : public vtkObject
60 {
61 public:
66 
68 
72  void PrintSelf(ostream& os, vtkIndent indent) override;
74 
76 
80  vtkGetObjectMacro(EventTranslator, vtkWidgetEventTranslator);
82 
86  typedef void (*CallbackType)(vtkAbstractWidget*);
87 
89 
100  unsigned long VTKEvent, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
101  void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode, int repeatCount,
102  const char* keySym, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
103  void SetCallbackMethod(unsigned long VTKEvent, vtkEventData* ed, unsigned long widgetEvent,
104  vtkAbstractWidget* w, CallbackType f);
105  // void SetCallbackMethod(vtkWidgetEvent *vtkEvent, unsigned long widgetEvent,
106  // vtkAbstractWidget *w, CallbackType f);
108 
113  void InvokeCallback(unsigned long widgetEvent);
114 
115 protected:
118 
119  // Translates VTK events into widget events
121 
122  // Invoke the method associated with a particular widget event
123  vtkCallbackMap* CallbackMap;
124 
130  void SetCallbackMethod(unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
131 
132 private:
134  void operator=(const vtkWidgetCallbackMapper&) = delete;
135 };
136 
137 VTK_ABI_NAMESPACE_END
138 #endif /* vtkWidgetCallbackMapper_h */
define the API for widget / widget representation
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
map widget events into callbacks
void SetCallbackMethod(unsigned long widgetEvent, vtkAbstractWidget *w, CallbackType f)
This method is used to assign a callback (implemented as a static class method) to a particular widge...
void PrintSelf(ostream &os, vtkIndent indent) override
Standard macros.
void SetEventTranslator(vtkWidgetEventTranslator *t)
Specify the vtkWidgetEventTranslator to coordinate with.
void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent, vtkAbstractWidget *w, CallbackType f)
This class works with the class vtkWidgetEventTranslator to set up the initial coorespondence between...
void SetCallbackMethod(unsigned long VTKEvent, vtkEventData *ed, unsigned long widgetEvent, vtkAbstractWidget *w, CallbackType f)
This class works with the class vtkWidgetEventTranslator to set up the initial coorespondence between...
static vtkWidgetCallbackMapper * New()
Instantiate the class.
vtkWidgetEventTranslator * EventTranslator
~vtkWidgetCallbackMapper() override
void SetCallbackMethod(unsigned long VTKEvent, unsigned long widgetEvent, vtkAbstractWidget *w, CallbackType f)
This class works with the class vtkWidgetEventTranslator to set up the initial coorespondence between...
void InvokeCallback(unsigned long widgetEvent)
This method invokes the callback given a widget event.
map VTK events into widget events
define widget events