VTK  9.3.0
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
26 #ifndef vtkWidgetCallbackMapper_h
27 #define vtkWidgetCallbackMapper_h
28 
29 #include "vtkInteractionWidgetsModule.h" // For export macro
30 #include "vtkObject.h"
31 
32 VTK_ABI_NAMESPACE_BEGIN
33 class vtkWidgetEvent;
34 class vtkAbstractWidget;
36 class vtkCallbackMap; // PIMPL encapsulation of STL map
37 class vtkEventData;
38 
39 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetCallbackMapper : public vtkObject
40 {
41 public:
46 
48 
52  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
60  vtkGetObjectMacro(EventTranslator, vtkWidgetEventTranslator);
62 
66  typedef void (*CallbackType)(vtkAbstractWidget*);
67 
69 
80  unsigned long VTKEvent, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
81  void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode, int repeatCount,
82  const char* keySym, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
83  void SetCallbackMethod(unsigned long VTKEvent, vtkEventData* ed, unsigned long widgetEvent,
84  vtkAbstractWidget* w, CallbackType f);
85  // void SetCallbackMethod(vtkWidgetEvent *vtkEvent, unsigned long widgetEvent,
86  // vtkAbstractWidget *w, CallbackType f);
88 
93  void InvokeCallback(unsigned long widgetEvent);
94 
95 protected:
98 
99  // Translates VTK events into widget events
101 
102  // Invoke the method associated with a particular widget event
103  vtkCallbackMap* CallbackMap;
104 
110  void SetCallbackMethod(unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
111 
112 private:
114  void operator=(const vtkWidgetCallbackMapper&) = delete;
115 };
116 
117 VTK_ABI_NAMESPACE_END
118 #endif /* vtkWidgetCallbackMapper_h */
define the API for widget / widget representation
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
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