VTK  9.3.0
vtkInteractorEventRecorder.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
32#ifndef vtkInteractorEventRecorder_h
33#define vtkInteractorEventRecorder_h
34
35#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
37#include "vtkRenderingCoreModule.h" // For export macro
38
39VTK_ABI_NAMESPACE_BEGIN
40class vtkStringArray;
41
42// The superclass that all commands should be subclasses of
43class VTKRENDERINGCORE_EXPORT vtkInteractorEventRecorder : public vtkInteractorObserver
44{
45public:
48 void PrintSelf(ostream& os, vtkIndent indent) override;
49
50 // enumeration of data type
51 enum class vtkEventDataType : int
52 {
53 None = 0,
54 StringArray
55 };
56
57 // Satisfy the superclass API. Enable/disable listening for events.
58 void SetEnabled(int) override;
60
62
69
75 void Record();
76
82 void Play();
83
87 void Stop();
88
93 void Clear();
94
98 void Rewind();
99
101
105 vtkSetMacro(ReadFromInputString, vtkTypeBool);
106 vtkGetMacro(ReadFromInputString, vtkTypeBool);
107 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
109
111
114 vtkSetStringMacro(InputString);
115 vtkGetStringMacro(InputString);
117
118protected:
121
122 // file to read/write from
123 char* FileName;
124
125 // listens to delete events
127
128 // control whether to read from string
131
132 // for reading and writing
133 istream* InputStream;
134 ostream* OutputStream;
135
136 // methods for processing events
137 static void ProcessCharEvent(
138 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
140 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
141 static void ProcessEvents(
142 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
143
144 virtual void WriteEvent(const char* event, int pos[2], int modifiers, int keyCode,
145 int repeatCount, char* keySym, void* callData = nullptr);
146
148 "This method was not used at all and has been replaced by ReadEvent(const std::string&)")
149 virtual void ReadEvent(){};
150
154 virtual void ReadEvent(const std::string& line);
155
156 // Manage the state of the recorder
157 int State;
159 {
160 Start = 0,
162 Recording
163 };
164
165 // Associate a modifier with a bit
167 {
168 ShiftKey = 1,
169 ControlKey = 2,
170 AltKey = 4
171 };
172
173 static float StreamVersion;
175
176private:
178 void operator=(const vtkInteractorEventRecorder&) = delete;
179};
180
181VTK_ABI_NAMESPACE_END
182#endif /* vtkInteractorEventRecorder_h */
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:29
record and play VTK events passing through a vtkRenderWindowInteractor
virtual void ReadEvent(const std::string &line)
A method that parse a event line and invoke the corresponding event.
void Record()
Invoke this method to begin recording events.
vtkGetFilePathMacro(FileName)
Set/Get the name of a file events should be written to/from.
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 the play stream 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.
virtual void WriteEvent(const char *event, int pos[2], int modifiers, int keyCode, int repeatCount, char *keySym, void *callData=nullptr)
~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)
void Clear()
Invoke this method to clear recording/playing stream and be able to open another file using the same ...
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:49
platform-independent render window interaction including picking and frame rate control.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_2_0(reason)