VTK  9.2.6
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 =========================================================================*/
38 #ifndef vtkWidgetCallbackMapper_h
39 #define vtkWidgetCallbackMapper_h
40 
41 #include "vtkInteractionWidgetsModule.h" // For export macro
42 #include "vtkObject.h"
43 
44 class vtkWidgetEvent;
45 class vtkAbstractWidget;
47 class vtkCallbackMap; // PIMPL encapsulation of STL map
48 class vtkEventData;
49 
50 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetCallbackMapper : public vtkObject
51 {
52 public:
57 
59 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
65 
67 
71  vtkGetObjectMacro(EventTranslator, vtkWidgetEventTranslator);
73 
77  typedef void (*CallbackType)(vtkAbstractWidget*);
78 
80 
91  unsigned long VTKEvent, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
92  void SetCallbackMethod(unsigned long VTKEvent, int modifiers, char keyCode, int repeatCount,
93  const char* keySym, unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
94  void SetCallbackMethod(unsigned long VTKEvent, vtkEventData* ed, unsigned long widgetEvent,
95  vtkAbstractWidget* w, CallbackType f);
96  // void SetCallbackMethod(vtkWidgetEvent *vtkEvent, unsigned long widgetEvent,
97  // vtkAbstractWidget *w, CallbackType f);
99 
104  void InvokeCallback(unsigned long widgetEvent);
105 
106 protected:
109 
110  // Translates VTK events into widget events
112 
113  // Invoke the method associated with a particular widget event
114  vtkCallbackMap* CallbackMap;
115 
121  void SetCallbackMethod(unsigned long widgetEvent, vtkAbstractWidget* w, CallbackType f);
122 
123 private:
125  void operator=(const vtkWidgetCallbackMapper&) = delete;
126 };
127 
128 #endif /* vtkWidgetCallbackMapper_h */
define the API for widget / widget representation
a simple class to control print indentation
Definition: vtkIndent.h:49
abstract base class for most VTK objects
Definition: vtkObject.h:72
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