VTK  9.1.0
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=========================================================================*/
122#ifndef vtkWidgetEventTranslator_h
123#define vtkWidgetEventTranslator_h
124
125#include "vtkInteractionWidgetsModule.h" // For export macro
126#include "vtkObject.h"
127
128// Support PIMPL encapsulation of internal STL map
129class vtkEventMap;
132class vtkEvent;
134class vtkEventData;
135
136// This is a lightweight class that should be used internally by the widgets
137class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject
138{
139public:
144
146
150 void PrintSelf(ostream& os, vtkIndent indent) override;
152
154
159 void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent);
160 void SetTranslation(const char* VTKEvent, const char* widgetEvent);
161 void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount,
162 const char* keySym, unsigned long widgetEvent);
163 void SetTranslation(vtkEvent* VTKevent, unsigned long widgetEvent);
164 void SetTranslation(unsigned long VTKEvent, vtkEventData* edata, unsigned long widgetEvent);
166
168
172 unsigned long GetTranslation(unsigned long VTKEvent);
173 const char* GetTranslation(const char* VTKEvent);
174 unsigned long GetTranslation(
175 unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
176 unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData* edata);
177 unsigned long GetTranslation(vtkEvent* VTKEvent);
179
181
186 unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
189 int RemoveTranslation(unsigned long VTKEvent);
190 int RemoveTranslation(const char* VTKEvent);
192
198
200
206
207protected:
208 // Constructors/destructors made public for widgets to use
211
212 // Map VTK events to widget events
213 vtkEventMap* EventMap;
214
215 // Used for performance reasons to avoid object construction/deletion
217
218private:
220 void operator=(const vtkWidgetEventTranslator&) = delete;
221};
222
223#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:113
abstract base class for most VTK objects
Definition: vtkObject.h:82
platform-independent render window interaction including picking and frame rate control.
map VTK events into widget events
void AddEventsToInteractor(vtkRenderWindowInteractor *, vtkCallbackCommand *, float priority)
Add the events in the current translation table to the interactor.
int RemoveTranslation(unsigned long VTKEvent)
Remove translations for a binding.
unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym)
Translate a VTK event into a widget event.
void SetTranslation(const char *VTKEvent, const char *widgetEvent)
Use these methods to create the translation from a VTK event to a widget event.
void SetTranslation(unsigned long VTKEvent, vtkEventData *edata, unsigned long widgetEvent)
Use these methods to create the translation from a VTK event to a widget event.
const char * GetTranslation(const char *VTKEvent)
Translate a VTK event into a widget event.
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.
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
Standard macros.
int RemoveTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym)
Remove translations for a binding.
int RemoveTranslation(const char *VTKEvent)
Remove translations for a binding.
static vtkWidgetEventTranslator * New()
Instantiate the object.
unsigned long GetTranslation(vtkEvent *VTKEvent)
Translate a VTK event into a widget event.
void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent)
Use these methods to create the translation from a VTK event to a widget event.
void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char *keySym, unsigned long widgetEvent)
Use these methods to create the translation from a VTK event to a widget event.
unsigned long GetTranslation(unsigned long VTKEvent)
Translate a VTK event into a widget event.
int RemoveTranslation(vtkEvent *e)
Remove translations for a binding.
unsigned long GetTranslation(unsigned long VTKEvent, vtkEventData *edata)
Translate a VTK event into a widget event.
~vtkWidgetEventTranslator() override
int RemoveTranslation(vtkEventData *e)
Remove translations for a binding.