VTK  9.3.1
vtkWidgetEventTranslator.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
24 #ifndef vtkWidgetEventTranslator_h
25 #define vtkWidgetEventTranslator_h
26 
27 #include "vtkInteractionWidgetsModule.h" // For export macro
28 #include "vtkObject.h"
29 
30 // Support PIMPL encapsulation of internal STL map
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkEventMap;
34 class vtkCallbackCommand;
35 class vtkEvent;
36 class vtkAbstractWidget;
37 class vtkEventData;
38 
39 // This is a lightweight class that should be used internally by the widgets
40 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject
41 {
42 public:
46  static vtkWidgetEventTranslator* New();
47 
49 
53  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
62  void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent);
63  void SetTranslation(const char* VTKEvent, const char* widgetEvent);
64  void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount,
65  const char* keySym, unsigned long widgetEvent);
66  void SetTranslation(vtkEvent* VTKevent, unsigned long widgetEvent);
67  void SetTranslation(unsigned long VTKEvent, vtkEventData* edata, unsigned long widgetEvent);
69 
71 
75  unsigned long GetTranslation(unsigned long VTKEvent);
76  const char* GetTranslation(const char* VTKEvent);
77  unsigned long GetTranslation(
78  unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
79  unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData* edata);
80  unsigned long GetTranslation(vtkEvent* VTKEvent);
82 
84 
88  int RemoveTranslation(
89  unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
90  int RemoveTranslation(vtkEvent* e);
91  int RemoveTranslation(vtkEventData* e);
92  int RemoveTranslation(unsigned long VTKEvent);
93  int RemoveTranslation(const char* VTKEvent);
95 
100  void ClearEvents();
101 
103 
106  void AddEventsToParent(vtkAbstractWidget*, vtkCallbackCommand*, float priority);
107  void AddEventsToInteractor(vtkRenderWindowInteractor*, vtkCallbackCommand*, float priority);
109 
110 protected:
111  // Constructors/destructors made public for widgets to use
113  ~vtkWidgetEventTranslator() override;
114 
115  // Map VTK events to widget events
116  vtkEventMap* EventMap;
117 
118  // Used for performance reasons to avoid object construction/deletion
120 
121 private:
123  void operator=(const vtkWidgetEventTranslator&) = delete;
124 };
125 
126 VTK_ABI_NAMESPACE_END
127 #endif /* vtkWidgetEventTranslator_h */
abstract base class for most VTK objects
Definition: vtkObject.h:51
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:28
define the API for widget / widget representation
a complete specification of a VTK event including all modifiers
Definition: vtkEvent.h:23
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...