VTK  9.2.20230205
vtkWidgetCallbackMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWidgetCallbackMapper.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 =========================================================================*/
58 #ifndef vtkWidgetCallbackMapper_h
59 #define vtkWidgetCallbackMapper_h
60 
61 #include "vtkInteractionWidgetsModule.h" // For export macro
62 #include "vtkObject.h"
63 
64 VTK_ABI_NAMESPACE_BEGIN
65 class vtkWidgetEvent;
66 class vtkAbstractWidget;
68 class vtkCallbackMap; // PIMPL encapsulation of STL map
69 class vtkEventData;
70 
71 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetCallbackMapper : public vtkObject
72 {
73 public:
78 
80 
84  void PrintSelf(ostream& os, vtkIndent indent) override;
86 
88 
92  vtkGetObjectMacro(EventTranslator, vtkWidgetEventTranslator);
94 
98  typedef void (*CallbackType)(vtkAbstractWidget*);
99 
101 
112  unsigned long VTKEvent, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
113  void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode, int repeatCount,
114  const char* keySym, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
115  void SetCallbackMethod(unsigned long VTKEvent, vtkEventData* ed, unsigned long widgetEvent,
116  vtkAbstractWidget* w, CallbackType f);
117  // void SetCallbackMethod(vtkWidgetEvent *vtkEvent, unsigned long widgetEvent,
118  // vtkAbstractWidget *w, CallbackType f);
120 
125  void InvokeCallback(unsigned long widgetEvent);
126 
127 protected:
130 
131  // Translates VTK events into widget events
133 
134  // Invoke the method associated with a particular widget event
135  vtkCallbackMap* CallbackMap;
136 
142  void SetCallbackMethod(unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
143 
144 private:
146  void operator=(const vtkWidgetCallbackMapper&) = delete;
147 };
148 
149 VTK_ABI_NAMESPACE_END
150 #endif /* vtkWidgetCallbackMapper_h */
define the API for widget / widget representation
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
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