VTK  9.4.20241222
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
31VTK_ABI_NAMESPACE_BEGIN
32class vtkEventMap;
35class vtkEvent;
37class vtkEventData;
38
39// This is a lightweight class that should be used internally by the widgets
40class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject
41{
42public:
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
89 unsigned long VTKEvent, int modifier, char keyCode, int repeatCount, const char* keySym);
92 int RemoveTranslation(unsigned long VTKEvent);
93 int RemoveTranslation(const char* VTKEvent);
95
101
103
109
110protected:
111 // Constructors/destructors made public for widgets to use
114
115 // Map VTK events to widget events
116 vtkEventMap* EventMap;
117
118 // Used for performance reasons to avoid object construction/deletion
120
121private:
123 void operator=(const vtkWidgetEventTranslator&) = delete;
124};
125
126VTK_ABI_NAMESPACE_END
127#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:24
a simple class to control print indentation
Definition vtkIndent.h:108
abstract base class for most VTK objects
Definition vtkObject.h:162
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.