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