VTK  9.6.20260619
vtkWebAssemblyRenderWindowInteractor.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
25
26#ifndef vtkWebAssemblyRenderWindowInteractor_h
27#define vtkWebAssemblyRenderWindowInteractor_h
28
29#ifndef __EMSCRIPTEN__
30#error "vtkWebAssemblyRenderWindowInteractor requires the Emscripten SDK"
31#endif
32
34#include "vtkRenderingUIModule.h" // For export macro
35#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
36#include <memory> // for shared_ptr
37
38VTK_ABI_NAMESPACE_BEGIN
39
42{
43public:
48
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
55 void Initialize() override;
56
61 void ProcessEvents() override;
62
68 void TerminateApp() override;
69
74 void ExitCallback() override;
75
79 vtkGetStringMacro(CanvasSelector);
80 virtual void SetCanvasSelector(const char* value);
81
86 vtkGetMacro(ExpandCanvasToContainer, bool);
87 vtkSetMacro(ExpandCanvasToContainer, bool);
88 vtkBooleanMacro(ExpandCanvasToContainer, bool);
89
95 vtkGetMacro(InstallHTMLResizeObserver, bool);
96 vtkSetMacro(InstallHTMLResizeObserver, bool);
97 vtkBooleanMacro(InstallHTMLResizeObserver, bool);
98
99protected:
102
104
115
116 void ProcessEvent(int type, const std::uint8_t* event);
117
119
125 int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
126 int InternalDestroyTimer(int platformTimerId) override;
128
132 void StartEventLoop() override;
133
134 char* CanvasSelector = nullptr;
137
138private:
140 void operator=(const vtkWebAssemblyRenderWindowInteractor&) = delete;
141
142 friend class vtkInternals;
143 class vtkInternals;
144 std::shared_ptr<vtkInternals> Internals; // the pointer is also shared with timer's callback data.
145};
146
147extern "C"
148{
149 typedef void (*vtkTimerCallbackFunc)(void*);
150 typedef bool (*vtkEventProcessingFunc)(void*);
151 typedef void (*vtkUnRegisterInteractorFunc)(void*);
152
154 unsigned long duration, bool isOneShot, vtkTimerCallbackFunc callback, void* userData);
155 void vtkDestroyTimer(int timerId, bool isOneShot);
156 int* vtkGetParentElementBoundingRectSize(const char* selector);
157 void vtkInitializeCanvasElement(const char* selector, bool applyStyle);
159 vtkUnRegisterInteractorFunc unRegisterInteractor, void* arg);
161 vtkUnRegisterInteractorFunc unRegisterInteractor, void* arg);
162}
163
164VTK_ABI_NAMESPACE_END
165#endif
a simple class to control print indentation
Definition vtkIndent.h:108
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ProcessEvents() override
Process all user-interaction, timer events and return.
virtual void SetCanvasSelector(const char *value)
void StartEventLoop() override
This will start up the event loop without blocking the main thread.
void ExitCallback() override
These methods correspond to the Exit, User and Pick callbacks.
int InternalDestroyTimer(int platformTimerId) override
Internal methods for creating and destroying timers that must be implemented by subclasses.
void Initialize() override
Initialize the event handler.
void ProcessEvent(int type, const std::uint8_t *event)
void RegisterUICallbacks()
Register/UnRegister callback functions for all recognized events on the document.
void UnRegisterUICallbacks()
Register/UnRegister callback functions for all recognized events on the document.
static vtkWebAssemblyRenderWindowInteractor * New()
Construct object so that light follows camera motion.
void TerminateApp() override
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
Internal methods for creating and destroying timers that must be implemented by subclasses.
void vtkStartEventLoopSync(vtkEventProcessingFunc spinOnceAndGetDone, vtkUnRegisterInteractorFunc unRegisterInteractor, void *arg)
bool(* vtkEventProcessingFunc)(void *)
int vtkCreateTimer(unsigned long duration, bool isOneShot, vtkTimerCallbackFunc callback, void *userData)
void vtkStartEventLoopAsync(vtkEventProcessingFunc spinOnceAndGetDone, vtkUnRegisterInteractorFunc unRegisterInteractor, void *arg)
void vtkInitializeCanvasElement(const char *selector, bool applyStyle)
void(* vtkTimerCallbackFunc)(void *)
void vtkDestroyTimer(int timerId, bool isOneShot)
int * vtkGetParentElementBoundingRectSize(const char *selector)
void(* vtkUnRegisterInteractorFunc)(void *)
#define VTK_MARSHALAUTO