Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkInteractorEventRecorder.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkInteractorEventRecorder.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00054 #ifndef __vtkInteractorEventRecorder_h
00055 #define __vtkInteractorEventRecorder_h
00056 
00057 #include "vtkInteractorObserver.h"
00058 
00059 // The superclass that all commands should be subclasses of
00060 class VTK_RENDERING_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
00061 {
00062 public:
00063   static vtkInteractorEventRecorder *New();
00064   vtkTypeRevisionMacro(vtkInteractorEventRecorder,vtkInteractorObserver);
00065   void PrintSelf(ostream& os, vtkIndent indent);
00066 
00067   // Satisfy the superclass API. Enable/disable listening for events.
00068   virtual void SetEnabled(int);
00069   virtual void SetInteractor(vtkRenderWindowInteractor* iren);
00070 
00072 
00073   vtkSetStringMacro(FileName);
00074   vtkGetStringMacro(FileName);
00076 
00079   void Record();
00080 
00083   void Play();
00084 
00086   void Stop();
00087 
00089   void Rewind();
00090 
00092 
00094   vtkSetMacro(ReadFromInputString,int);
00095   vtkGetMacro(ReadFromInputString,int);
00096   vtkBooleanMacro(ReadFromInputString,int);
00098 
00100 
00101   vtkSetStringMacro(InputString);
00102   vtkGetStringMacro(InputString);
00104 
00105 protected:
00106   vtkInteractorEventRecorder();
00107   ~vtkInteractorEventRecorder();
00108 
00109   // file to read/write from
00110   char *FileName;
00111   
00112   // control whether to read from string
00113   int ReadFromInputString;
00114   char *InputString;
00115 
00116   // for reading and writing
00117   istream *InputStream;
00118   ostream *OutputStream;
00119 
00120   //methods for processing events
00121   static void ProcessCharEvent(vtkObject* object, unsigned long event,
00122                                void* clientdata, void* calldata);
00123   static void ProcessEvents(vtkObject* object, unsigned long event,
00124                             void* clientdata, void* calldata);
00125 
00126   virtual void WriteEvent(const char* event, int pos[2], int ctrlKey,
00127                           int shiftKey, int keyCode, int repeatCount,
00128                           char* keySym);
00129   
00130   virtual void ReadEvent();
00131 
00132 //BTX - manage the state of the recorder
00133   int State;
00134   enum WidgetState
00135   {
00136     Start=0,
00137     Playing,
00138     Recording
00139   };
00140 //ETX
00141 
00142   static float StreamVersion;
00143 
00144 private:
00145   vtkInteractorEventRecorder(const vtkInteractorEventRecorder&);  // Not implemented.
00146   void operator=(const vtkInteractorEventRecorder&);  // Not implemented.
00147   
00148 };
00149 
00150 #endif /* __vtkInteractorEventRecorder_h */
00151