VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkWidgetEventTranslator.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00035 #ifndef __vtkWidgetEventTranslator_h 00036 #define __vtkWidgetEventTranslator_h 00037 00038 #include "vtkInteractionWidgetsModule.h" // For export macro 00039 #include "vtkObject.h" 00040 00041 // Support PIMPL encapsulation of internal STL map 00042 class vtkEventMap; 00043 class vtkRenderWindowInteractor; 00044 class vtkCallbackCommand; 00045 class vtkEvent; 00046 class vtkAbstractWidget; 00047 00048 00049 // This is a lightweight class that should be used internally by the widgets 00050 class VTKINTERACTIONWIDGETS_EXPORT vtkWidgetEventTranslator : public vtkObject 00051 { 00052 public: 00054 static vtkWidgetEventTranslator *New(); 00055 00057 00058 vtkTypeMacro(vtkWidgetEventTranslator,vtkObject); 00059 void PrintSelf(ostream& os, vtkIndent indent); 00061 00063 00066 void SetTranslation(unsigned long VTKEvent, unsigned long widgetEvent); 00067 void SetTranslation(const char *VTKEvent, const char *widgetEvent); 00068 void SetTranslation(unsigned long VTKEvent, int modifier, char keyCode, 00069 int repeatCount, const char* keySym, unsigned long widgetEvent); 00070 void SetTranslation(vtkEvent *VTKevent, unsigned long widgetEvent); 00072 00074 00077 unsigned long GetTranslation(unsigned long VTKEvent); 00078 const char *GetTranslation(const char *VTKEvent); 00079 unsigned long GetTranslation(unsigned long VTKEvent, int modifier, char keyCode, 00080 int repeatCount, char* keySym); 00081 unsigned long GetTranslation(vtkEvent *VTKEvent); 00083 00085 00087 int RemoveTranslation( unsigned long VTKEvent, 00088 int modifier, char keyCode, 00089 int repeatCount, char* keySym); 00090 int RemoveTranslation( vtkEvent *e ); 00091 int RemoveTranslation(unsigned long VTKEvent); 00092 int RemoveTranslation(const char *VTKEvent); 00094 00097 void ClearEvents(); 00098 00099 //BTX 00101 00102 void AddEventsToParent(vtkAbstractWidget*, vtkCallbackCommand*, float priority); 00103 void AddEventsToInteractor(vtkRenderWindowInteractor*, vtkCallbackCommand*, 00104 float priority); 00105 //ETX 00107 00108 protected: 00109 // Constructors/destructors made public for widgets to use 00110 vtkWidgetEventTranslator(); 00111 ~vtkWidgetEventTranslator(); 00112 00113 // Map VTK events to widget events 00114 vtkEventMap *EventMap; 00115 00116 // Used for performance reasons to avoid object construction/deletion 00117 vtkEvent *Event; 00118 00119 private: 00120 vtkWidgetEventTranslator(const vtkWidgetEventTranslator&); //Not implemented 00121 void operator=(const vtkWidgetEventTranslator&); //Not implemented 00122 00123 }; 00124 00125 #endif /* __vtkWidgetEventTranslator_h */ 00126