VTK  9.0.1
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 =========================================================================*/
37 #ifndef vtkInteractorEventRecorder_h
38 #define vtkInteractorEventRecorder_h
39 
40 #include "vtkInteractorObserver.h"
41 #include "vtkRenderingCoreModule.h" // For export macro
42 
43 // The superclass that all commands should be subclasses of
44 class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
51  // Satisfy the superclass API. Enable/disable listening for events.
52  void SetEnabled(int) override;
53  void SetInteractor(vtkRenderWindowInteractor* iren) override;
54 
56 
59  vtkSetStringMacro(FileName);
60  vtkGetStringMacro(FileName);
62 
67  void Record();
68 
73  void Play();
74 
78  void Stop();
79 
83  void Rewind();
84 
86 
90  vtkSetMacro(ReadFromInputString, vtkTypeBool);
91  vtkGetMacro(ReadFromInputString, vtkTypeBool);
92  vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
94 
96 
99  vtkSetStringMacro(InputString);
100  vtkGetStringMacro(InputString);
102 
103 protected:
105  ~vtkInteractorEventRecorder() override;
106 
107  // file to read/write from
108  char* FileName;
109 
110  // listens to delete events
112 
113  // control whether to read from string
115  char* InputString;
116 
117  // for reading and writing
118  istream* InputStream;
119  ostream* OutputStream;
120 
121  // methods for processing events
122  static void ProcessCharEvent(
123  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
124  static void ProcessDeleteEvent(
125  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
126  static void ProcessEvents(
127  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
128 
129  virtual void WriteEvent(
130  const char* event, int pos[2], int modifiers, int keyCode, int repeatCount, char* keySym);
131 
132  virtual void ReadEvent();
133 
134  // Manage the state of the recorder
135  int State;
137  {
138  Start = 0,
140  Recording
141  };
142 
143  // Associate a modifier with a bit
145  {
146  ShiftKey = 1,
147  ControlKey = 2,
148  AltKey = 4
149  };
150 
151  static float StreamVersion;
152 
153 private:
155  void operator=(const vtkInteractorEventRecorder&) = delete;
156 };
157 
158 #endif /* vtkInteractorEventRecorder_h */
virtual void SetInteractor(vtkRenderWindowInteractor *iren)
This method is used to associate the widget with the render window interactor.
abstract base class for most VTK objects
Definition: vtkObject.h:56
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
Handles the char widget activation event.
virtual void SetEnabled(int)
Methods for turning the interactor observer on and off, and determining its state.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor ...
int vtkTypeBool
Definition: vtkABI.h:69
platform-independent render window interaction including picking and frame rate control.
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkCallbackCommand * DeleteEventCallbackCommand
record and play VTK events passing through a vtkRenderWindowInteractor
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...