VTK  9.7.20260911
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
139protected:
142
143 // file to read/write from
144 char* FileName;
145
146 // listens to delete events
148
149 // control whether to read from string
152
153 // for reading and writing
154 istream* InputStream;
155 ostream* OutputStream;
156
157 // methods for processing events
158 static void ProcessCharEvent(
159 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
161 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
162 static void ProcessEvents(
163 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
164
165 virtual void WriteEvent(const char* event, int pos[2], int modifiers, int keyCode,
166 int repeatCount, char* keySym, void* callData = nullptr);
167
171 virtual void ReadEvent(const std::string& line);
172
173 // Manage the state of the recorder
174 int State;
181
182 // Associate a modifier with a bit
184 {
188 };
189
190 static float StreamVersion;
192
193private:
195 void operator=(const vtkInteractorEventRecorder&) = delete;
196
197 bool ShowCursor = false;
198 vtkNew<vtkActor2D> CursorActor;
199};
200
201VTK_ABI_NAMESPACE_END
202#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