VTK  9.0.3
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 class vtkEventData;
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:
55 
57 
61  void PrintSelf(ostream& os, vtkIndent indent) 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, int repeatCount,
73  const char* keySym, unsigned long widgetEvent);
74  void SetTranslation(vtkEvent* VTKevent, unsigned long widgetEvent);
75  void SetTranslation(unsigned long VTKEvent, vtkEventData* edata, unsigned long widgetEvent);
77 
79 
83  unsigned long GetTranslation(unsigned long VTKEvent);
84  const char* GetTranslation(const char* VTKEvent);
85  unsigned long GetTranslation(
86  unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
87  unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData* edata);
88  unsigned long GetTranslation(vtkEvent* VTKEvent);
90 
92 
97  unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
100  int RemoveTranslation(unsigned long VTKEvent);
101  int RemoveTranslation(const char* VTKEvent);
103 
108  void ClearEvents();
109 
111 
117 
118 protected:
119  // Constructors/destructors made public for widgets to use
122 
123  // Map VTK events to widget events
124  vtkEventMap* EventMap;
125 
126  // Used for performance reasons to avoid object construction/deletion
128 
129 private:
131  void operator=(const vtkWidgetEventTranslator&) = delete;
132 };
133 
134 #endif /* vtkWidgetEventTranslator_h */
define the API for widget / widget representation
supports function callbacks
a complete specification of a VTK event including all modifiers
Definition: vtkEvent.h:32
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract base class for most VTK objects
Definition: vtkObject.h:54
platform-independent render window interaction including picking and frame rate control.
map VTK events into widget events
void AddEventsToInteractor(vtkRenderWindowInteractor *, vtkCallbackCommand *, float priority)
int RemoveTranslation(unsigned long VTKEvent)
unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym)
void SetTranslation(const char *VTKEvent, const char *widgetEvent)
void SetTranslation(unsigned long VTKEvent, vtkEventData *edata, unsigned long widgetEvent)
void ClearEvents()
Clear all events from the translator (i.e., no events will be translated).
void AddEventsToParent(vtkAbstractWidget *, vtkCallbackCommand *, float priority)
Add the events in the current translation table to the interactor.
static vtkWidgetEventTranslator * New()
Instantiate the object.
const char * GetTranslation(const char *VTKEvent)
void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent)
Use these methods to create the translation from a VTK event to a widget event.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RemoveTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym)
Remove translations for a binding.
int RemoveTranslation(const char *VTKEvent)
unsigned long GetTranslation(vtkEvent *VTKEvent)
void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent)
void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
unsigned long GetTranslation(unsigned long VTKEvent)
Translate a VTK event into a widget event.
int RemoveTranslation(vtkEvent *e)
unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData *edata)
~vtkWidgetEventTranslator() override
int RemoveTranslation(vtkEventData *e)
@ priority
Definition: vtkX3D.h:456