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 =========================================================================*/
35 #ifndef __vtkWidgetEventTranslator_h
36 #define __vtkWidgetEventTranslator_h
37 
38 #include "vtkObject.h"
39 
40 // Support PIMPL encapsulation of internal STL map
41 class vtkEventMap;
43 class vtkCallbackCommand;
44 class vtkEvent;
45 class vtkAbstractWidget;
46 
47 
48 // This is a lightweight class that should be used internally by the widgets
50 {
51 public:
53  static vtkWidgetEventTranslator *New();
54 
56 
58  void PrintSelf(ostream& os, vtkIndent indent);
60 
62 
65  void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent);
66  void SetTranslation(const char *VTKEvent, const char *widgetEvent);
67  void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
68  int repeatCount, const char* keySym, unsigned long widgetEvent);
69  void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent);
71 
73 
76  unsigned long GetTranslation(unsigned long VTKEvent);
77  const char *GetTranslation(const char *VTKEvent);
78  unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode,
79  int repeatCount, char* keySym);
80  unsigned long GetTranslation(vtkEvent *VTKEvent);
82 
84 
86  int RemoveTranslation( unsigned long VTKEvent,
87  int modifier, char keyCode,
88  int repeatCount, char* keySym);
89  int RemoveTranslation( vtkEvent *e );
90  int RemoveTranslation(unsigned long VTKEvent);
92 
95  void ClearEvents();
96 
97 //BTX
99 
100  void AddEventsToParent(vtkAbstractWidget*, vtkCallbackCommand*, float priority);
101  void AddEventsToInteractor(vtkRenderWindowInteractor*, vtkCallbackCommand*,
102  float priority);
103 //ETX
105 
106 protected:
107  // Constructors/destructors made public for widgets to use
110 
111  // Map VTK events to widget events
112  vtkEventMap *EventMap;
113 
114  // Used for performance reasons to avoid object construction/deletion
116 
117 private:
118  vtkWidgetEventTranslator(const vtkWidgetEventTranslator&); //Not implemented
119  void operator=(const vtkWidgetEventTranslator&); //Not implemented
120 
121 };
122 
123 #endif /* __vtkWidgetEventTranslator_h */
124 
abstract base class for most VTK objects
Definition: vtkObject.h:60
map VTK events into widget events
platform-independent render window interaction including picking and frame rate control.
supports function callbacks
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:37
#define VTK_WIDGETS_EXPORT
define the API for widget / widget representation
a complete specification of a VTK event including all modifiers
Definition: vtkEvent.h:32
static vtkObject * New()