VTK
vtkInteractorEventRecorder.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractorEventRecorder.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
39 #ifndef __vtkInteractorEventRecorder_h
40 #define __vtkInteractorEventRecorder_h
41 
42 #include "vtkInteractorObserver.h"
43 
44 // The superclass that all commands should be subclasses of
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent);
51 
52  // Satisfy the superclass API. Enable/disable listening for events.
53  virtual void SetEnabled(int);
54  virtual void SetInteractor(vtkRenderWindowInteractor* iren);
55 
57 
58  vtkSetStringMacro(FileName);
59  vtkGetStringMacro(FileName);
61 
64  void Record();
65 
68  void Play();
69 
71  void Stop();
72 
74  void Rewind();
75 
77 
79  vtkSetMacro(ReadFromInputString,int);
80  vtkGetMacro(ReadFromInputString,int);
81  vtkBooleanMacro(ReadFromInputString,int);
83 
85 
86  vtkSetStringMacro(InputString);
87  vtkGetStringMacro(InputString);
89 
90 protected:
93 
94  // file to read/write from
95  char *FileName;
96 
97  // control whether to read from string
99  char *InputString;
100 
101  // for reading and writing
102  istream *InputStream;
103  ostream *OutputStream;
104 
105  //methods for processing events
106  static void ProcessCharEvent(vtkObject* object, unsigned long event,
107  void* clientdata, void* calldata);
108  static void ProcessEvents(vtkObject* object, unsigned long event,
109  void* clientdata, void* calldata);
110 
111  virtual void WriteEvent(const char* event, int pos[2], int ctrlKey,
112  int shiftKey, int keyCode, int repeatCount,
113  char* keySym);
114 
115  virtual void ReadEvent();
116 
117 //BTX - manage the state of the recorder
118  int State;
120  {
121  Start=0,
123  Recording
124  };
125 //ETX
126 
127  static float StreamVersion;
128 
129 private:
130  vtkInteractorEventRecorder(const vtkInteractorEventRecorder&); // Not implemented.
131  void operator=(const vtkInteractorEventRecorder&); // Not implemented.
132 
133 };
134 
135 #endif /* __vtkInteractorEventRecorder_h */
136