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
43class vtkEventMap;
46class vtkEvent;
48
49
50// This is a lightweight class that should be used internally by the widgets
51class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject
52{
53public:
58
60
64 void PrintSelf(ostream& os, vtkIndent indent);
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);
79
81
85 unsigned long GetTranslation(unsigned long VTKEvent);
86 const char *GetTranslation(const char *VTKEvent);
87 unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
88 int repeatCount, char* keySym);
89 unsigned long GetTranslation(vtkEvent *VTKEvent);
91
93
97 int RemoveTranslation( unsigned long VTKEvent,
98 int modifier, char keyCode,
99 int repeatCount, char* keySym);
101 int RemoveTranslation(unsigned long VTKEvent);
102 int RemoveTranslation(const char *VTKEvent);
104
110
112
117 float priority);
119
120protected:
121 // Constructors/destructors made public for widgets to use
124
125 // Map VTK events to widget events
126 vtkEventMap *EventMap;
127
128 // Used for performance reasons to avoid object construction/deletion
130
131private:
132 vtkWidgetEventTranslator(const vtkWidgetEventTranslator&) VTK_DELETE_FUNCTION;
133 void operator=(const vtkWidgetEventTranslator&) VTK_DELETE_FUNCTION;
134
135};
136
137#endif /* vtkWidgetEventTranslator_h */
138
define the API for widget / widget representation
supports function callbacks
a complete specification of a VTK event including all modifiers
Definition: vtkEvent.h:35
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
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, int modifier, char keyCode, int repeatCount, char *keySym)
Remove translations for a binding.
int RemoveTranslation(unsigned long VTKEvent)
void SetTranslation(const char *VTKEvent, const char *widgetEvent)
const char * GetTranslation(const char *VTKEvent)
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.
unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, char *keySym)
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)
Methods invoked by print to print information about the object including superclasses.
int RemoveTranslation(const char *VTKEvent)
static vtkWidgetEventTranslator * New()
Instantiate the object.
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)
@ priority
Definition: vtkX3D.h:450