VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkInteractorEventRecorder.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 =========================================================================*/ 00039 #ifndef __vtkInteractorEventRecorder_h 00040 #define __vtkInteractorEventRecorder_h 00041 00042 #include "vtkRenderingCoreModule.h" // For export macro 00043 #include "vtkInteractorObserver.h" 00044 00045 // The superclass that all commands should be subclasses of 00046 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver 00047 { 00048 public: 00049 static vtkInteractorEventRecorder *New(); 00050 vtkTypeMacro(vtkInteractorEventRecorder,vtkInteractorObserver); 00051 void PrintSelf(ostream& os, vtkIndent indent); 00052 00053 // Satisfy the superclass API. Enable/disable listening for events. 00054 virtual void SetEnabled(int); 00055 virtual void SetInteractor(vtkRenderWindowInteractor* iren); 00056 00058 00059 vtkSetStringMacro(FileName); 00060 vtkGetStringMacro(FileName); 00062 00065 void Record(); 00066 00069 void Play(); 00070 00072 void Stop(); 00073 00075 void Rewind(); 00076 00078 00080 vtkSetMacro(ReadFromInputString,int); 00081 vtkGetMacro(ReadFromInputString,int); 00082 vtkBooleanMacro(ReadFromInputString,int); 00084 00086 00087 vtkSetStringMacro(InputString); 00088 vtkGetStringMacro(InputString); 00090 00091 protected: 00092 vtkInteractorEventRecorder(); 00093 ~vtkInteractorEventRecorder(); 00094 00095 // file to read/write from 00096 char *FileName; 00097 00098 // control whether to read from string 00099 int ReadFromInputString; 00100 char *InputString; 00101 00102 // for reading and writing 00103 istream *InputStream; 00104 ostream *OutputStream; 00105 00106 //methods for processing events 00107 static void ProcessCharEvent(vtkObject* object, unsigned long event, 00108 void* clientdata, void* calldata); 00109 static void ProcessEvents(vtkObject* object, unsigned long event, 00110 void* clientdata, void* calldata); 00111 00112 virtual void WriteEvent(const char* event, int pos[2], int ctrlKey, 00113 int shiftKey, int keyCode, int repeatCount, 00114 char* keySym); 00115 00116 virtual void ReadEvent(); 00117 00118 //BTX - manage the state of the recorder 00119 int State; 00120 enum WidgetState 00121 { 00122 Start=0, 00123 Playing, 00124 Recording 00125 }; 00126 //ETX 00127 00128 static float StreamVersion; 00129 00130 private: 00131 vtkInteractorEventRecorder(const vtkInteractorEventRecorder&); // Not implemented. 00132 void operator=(const vtkInteractorEventRecorder&); // Not implemented. 00133 00134 }; 00135 00136 #endif /* __vtkInteractorEventRecorder_h */ 00137