VTK
vtkWidgetEventTranslator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkWidgetEventTranslator.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 =========================================================================*/
33 #ifndef vtkWidgetEventTranslator_h
34 #define vtkWidgetEventTranslator_h
35 
36 #include "vtkInteractionWidgetsModule.h" // For export macro
37 #include "vtkObject.h"
38 
39 // Support PIMPL encapsulation of internal STL map
40 class vtkEventMap;
42 class vtkCallbackCommand;
43 class vtkEvent;
44 class vtkAbstractWidget;
45 
46 
47 // This is a lightweight class that should be used internally by the widgets
48 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject
49 {
50 public:
54  static vtkWidgetEventTranslator *New();
55 
57 
61  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
63 
65 
70  void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent);
71  void SetTranslation(const char *VTKEvent, const char *widgetEvent);
72  void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
73  int repeatCount, const char* keySym, unsigned long widgetEvent);
74  void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent);
76 
78 
82  unsigned long GetTranslation(unsigned long VTKEvent);
83  const char *GetTranslation(const char *VTKEvent);
84  unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
85  int repeatCount, char* keySym);
86  unsigned long GetTranslation(vtkEvent *VTKEvent);
88 
90 
94  int RemoveTranslation( unsigned long VTKEvent,
95  int modifier, char keyCode,
96  int repeatCount, char* keySym);
97  int RemoveTranslation( vtkEvent *e );
98  int RemoveTranslation(unsigned long VTKEvent);
99  int RemoveTranslation(const char *VTKEvent);
101 
106  void ClearEvents();
107 
109 
112  void AddEventsToParent(vtkAbstractWidget*, vtkCallbackCommand*, float priority);
113  void AddEventsToInteractor(vtkRenderWindowInteractor*, vtkCallbackCommand*,
114  float priority);
116 
117 protected:
118  // Constructors/destructors made public for widgets to use
120  ~vtkWidgetEventTranslator() VTK_OVERRIDE;
121 
122  // Map VTK events to widget events
123  vtkEventMap *EventMap;
124 
125  // Used for performance reasons to avoid object construction/deletion
126  vtkEvent *Event;
127 
128 private:
129  vtkWidgetEventTranslator(const vtkWidgetEventTranslator&) VTK_DELETE_FUNCTION;
130  void operator=(const vtkWidgetEventTranslator&) VTK_DELETE_FUNCTION;
131 
132 };
133 
134 #endif /* vtkWidgetEventTranslator_h */
135 
abstract base class for most VTK objects
Definition: vtkObject.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
map VTK events into widget events
platform-independent render window interaction including picking and frame rate control.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:33
define the API for widget / widget representation
a complete specification of a VTK event including all modifiers
Definition: vtkEvent.h:31
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...