VTK  9.1.0
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=========================================================================*/
40#ifndef vtkInteractorEventRecorder_h
41#define vtkInteractorEventRecorder_h
42
44#include "vtkRenderingCoreModule.h" // For export macro
45
46// The superclass that all commands should be subclasses of
47class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
48{
49public:
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
54 // Satisfy the superclass API. Enable/disable listening for events.
55 void SetEnabled(int) override;
57
59
65
70 void Record();
71
76 void Play();
77
81 void Stop();
82
86 void Rewind();
87
89
93 vtkSetMacro(ReadFromInputString, vtkTypeBool);
94 vtkGetMacro(ReadFromInputString, vtkTypeBool);
95 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
97
99
102 vtkSetStringMacro(InputString);
103 vtkGetStringMacro(InputString);
105
106protected:
109
110 // file to read/write from
111 char* FileName;
112
113 // listens to delete events
115
116 // control whether to read from string
119
120 // for reading and writing
121 istream* InputStream;
122 ostream* OutputStream;
123
124 // methods for processing events
125 static void ProcessCharEvent(
126 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
128 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
129 static void ProcessEvents(
130 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
131
132 virtual void WriteEvent(
133 const char* event, int pos[2], int modifiers, int keyCode, int repeatCount, char* keySym);
134
135 virtual void ReadEvent();
136
137 // Manage the state of the recorder
138 int State;
140 {
141 Start = 0,
143 Recording
144 };
145
146 // Associate a modifier with a bit
148 {
149 ShiftKey = 1,
150 ControlKey = 2,
151 AltKey = 4
152 };
153
154 static float StreamVersion;
155
156private:
158 void operator=(const vtkInteractorEventRecorder&) = delete;
159};
160
161#endif /* vtkInteractorEventRecorder_h */
supports function callbacks
a simple class to control print indentation
Definition: vtkIndent.h:113
record and play VTK events passing through a vtkRenderWindowInteractor
void Record()
Invoke this method to begin recording events.
vtkGetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
virtual void WriteEvent(const char *event, int pos[2], int modifiers, int keyCode, int repeatCount, char *keySym)
static void ProcessCharEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
void SetEnabled(int) override
Methods for turning the interactor observer on and off, and determining its state.
void Rewind()
Rewind to the beginning of the file.
void Play()
Invoke this method to begin playing events from the current position.
void SetInteractor(vtkRenderWindowInteractor *iren) override
This method is used to associate the widget with the render window interactor.
~vtkInteractorEventRecorder() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Stop()
Invoke this method to stop recording/playing events.
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkSetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
static void ProcessDeleteEvent(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
vtkCallbackCommand * DeleteEventCallbackCommand
static vtkInteractorEventRecorder * New()
an abstract superclass for classes observing events invoked by vtkRenderWindowInteractor
abstract base class for most VTK objects
Definition: vtkObject.h:82
platform-independent render window interaction including picking and frame rate control.
int vtkTypeBool
Definition: vtkABI.h:69