VTK  9.7.20261002
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
34
35#ifndef vtkInteractorEventRecorder_h
36#define vtkInteractorEventRecorder_h
37
39#include "vtkRenderingCoreModule.h" // For export macro
40#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
41
42#include "vtkNew.h" // vtkNew
43
44VTK_ABI_NAMESPACE_BEGIN
45
46class vtkActor2D;
47class vtkStringArray;
48
49// The superclass that all commands should be subclasses of
50class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkInteractorEventRecorder
52{
53public:
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
58 // enumeration of data type
59 enum class vtkEventDataType : int
60 {
61 None = 0,
62 StringArray
63 };
64
65 // Satisfy the superclass API. Enable/disable listening for events.
66 void SetEnabled(int) override;
68
70
77
83 void Record();
84
90 void Play();
91
95 void Stop();
96
101 void Clear();
102
106 void Rewind();
107
109
117
119
122 vtkSetStringMacro(InputString);
123 vtkGetStringMacro(InputString);
125
127
134 vtkSetMacro(ShowCursor, bool);
135 vtkGetMacro(ShowCursor, bool);
136 vtkBooleanMacro(ShowCursor, bool);
138
140
150 vtkSetMacro(OldRepeatCountWorkAround, bool);
151 vtkGetMacro(OldRepeatCountWorkAround, bool);
152 vtkBooleanMacro(OldRepeatCountWorkAround, bool);
154
155protected:
158
159 // file to read/write from
160 char* FileName;
161
162 // listens to delete events
164
165 // control whether to read from string
168
169 // for reading and writing
170 istream* InputStream;
171 ostream* OutputStream;
172
173 // methods for processing events
174 static void ProcessCharEvent(
175 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
177 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
178 static void ProcessEvents(
179 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
180
181 virtual void WriteEvent(const char* event, int pos[2], int modifiers, int keyCode,
182 int repeatCount, char* keySym, void* callData = nullptr);
183
187 virtual void ReadEvent(const std::string& line);
188
189 // Manage the state of the recorder
190 int State;
197
198 // Associate a modifier with a bit
200 {
204 };
205
206 static float StreamVersion;
208
209private:
211 void operator=(const vtkInteractorEventRecorder&) = delete;
212
213 bool ShowCursor = false;
214 bool OldRepeatCountWorkAround = false;
215 vtkNew<vtkActor2D> CursorActor;
216};
217
218VTK_ABI_NAMESPACE_END
219#endif /* vtkInteractorEventRecorder_h */
a actor that draws 2D data
Definition vtkActor2D.h:145
supports function callbacks
a simple class to control print indentation
Definition vtkIndent.h:108
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()
Allocate and hold a VTK object.
Definition vtkNew.h:168
platform-independent render window interaction including picking and frame rate control.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
@ None
!< For HCURL
#define VTK_MARSHALAUTO