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 =========================================================================*/
36 #ifndef vtkWidgetEventTranslator_h
37 #define vtkWidgetEventTranslator_h
38 
39 #include "vtkInteractionWidgetsModule.h" // For export macro
40 #include "vtkObject.h"
41 
42 // Support PIMPL encapsulation of internal STL map
43 class vtkEventMap;
45 class vtkCallbackCommand;
46 class vtkEvent;
47 class vtkAbstractWidget;
48 class vtkEventData;
49 
50 // This is a lightweight class that should be used internally by the widgets
51 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject
52 {
53 public:
58 
60 
64  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
68 
73  void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent);
74  void SetTranslation(const char *VTKEvent, const char *widgetEvent);
75  void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
76  int repeatCount, const char* keySym, unsigned long widgetEvent);
77  void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent);
78  void SetTranslation(unsigned long VTKEvent, vtkEventData *edata, unsigned long widgetEvent);
80 
82 
86  unsigned long GetTranslation(unsigned long VTKEvent);
87  const char *GetTranslation(const char *VTKEvent);
88  unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
89  int repeatCount, const char* keySym);
90  unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData *edata);
91  unsigned long GetTranslation(vtkEvent *VTKEvent);
93 
95 
99  int RemoveTranslation( unsigned long VTKEvent,
100  int modifier, char keyCode,
101  int repeatCount, const char* keySym);
104  int RemoveTranslation(unsigned long VTKEvent);
105  int RemoveTranslation(const char *VTKEvent);
107 
112  void ClearEvents();
113 
115 
120  float priority);
122 
123 protected:
124  // Constructors/destructors made public for widgets to use
127 
128  // Map VTK events to widget events
129  vtkEventMap *EventMap;
130 
131  // Used for performance reasons to avoid object construction/deletion
133 
134 private:
136  void operator=(const vtkWidgetEventTranslator&) = delete;
137 
138 };
139 
140 #endif /* vtkWidgetEventTranslator_h */
141 
vtkWidgetEventTranslator::SetTranslation
void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
vtkEventData
Definition: vtkEventData.h:64
vtkWidgetEventTranslator::GetTranslation
unsigned long GetTranslation(vtkEvent *VTKEvent)
vtkWidgetEventTranslator::RemoveTranslation
int RemoveTranslation(vtkEventData *e)
vtkWidgetEventTranslator::GetTranslation
unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym)
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:60
vtkWidgetEventTranslator::RemoveTranslation
int RemoveTranslation(const char *VTKEvent)
vtkEvent
a complete specification of a VTK event including all modifiers
Definition: vtkEvent.h:35
vtkWidgetEventTranslator::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkAbstractWidget
define the API for widget / widget representation
Definition: vtkAbstractWidget.h:64
vtkWidgetEventTranslator::Event
vtkEvent * Event
Definition: vtkWidgetEventTranslator.h:132
vtkWidgetEventTranslator::SetTranslation
void SetTranslation(unsigned long VTKEvent, vtkEventData *edata, unsigned long widgetEvent)
vtkWidgetEventTranslator::vtkWidgetEventTranslator
vtkWidgetEventTranslator()
vtkWidgetEventTranslator::ClearEvents
void ClearEvents()
Clear all events from the translator (i.e., no events will be translated).
vtkWidgetEventTranslator::GetTranslation
const char * GetTranslation(const char *VTKEvent)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkWidgetEventTranslator::SetTranslation
void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent)
Use these methods to create the translation from a VTK event to a widget event.
vtkWidgetEventTranslator::EventMap
vtkEventMap * EventMap
Definition: vtkWidgetEventTranslator.h:129
vtkWidgetEventTranslator::GetTranslation
unsigned long GetTranslation(unsigned long VTKEvent)
Translate a VTK event into a widget event.
vtkWidgetEventTranslator::RemoveTranslation
int RemoveTranslation(unsigned long VTKEvent)
vtkWidgetEventTranslator::AddEventsToInteractor
void AddEventsToInteractor(vtkRenderWindowInteractor *, vtkCallbackCommand *, float priority)
vtkRenderWindowInteractor
platform-independent render window interaction including picking and frame rate control.
Definition: vtkRenderWindowInteractor.h:79
vtkObject.h
vtkWidgetEventTranslator::~vtkWidgetEventTranslator
~vtkWidgetEventTranslator() override
vtkWidgetEventTranslator::SetTranslation
void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent)
vtkCallbackCommand
supports function callbacks
Definition: vtkCallbackCommand.h:51
vtkWidgetEventTranslator::RemoveTranslation
int RemoveTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym)
Remove translations for a binding.
vtkWidgetEventTranslator::RemoveTranslation
int RemoveTranslation(vtkEvent *e)
vtkWidgetEventTranslator
map VTK events into widget events
Definition: vtkWidgetEventTranslator.h:52
vtkWidgetEventTranslator::New
static vtkWidgetEventTranslator * New()
Instantiate the object.
vtkWidgetEventTranslator::AddEventsToParent
void AddEventsToParent(vtkAbstractWidget *, vtkCallbackCommand *, float priority)
Add the events in the current translation table to the interactor.
vtkX3D::priority
@ priority
Definition: vtkX3D.h:450
vtkWidgetEventTranslator::SetTranslation
void SetTranslation(const char *VTKEvent, const char *widgetEvent)
vtkWidgetEventTranslator::GetTranslation
unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData *edata)