Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkInteractorEventRecorder.h

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