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