VTK  9.5.20250525
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
23#ifndef vtkWebAssemblyRenderWindowInteractor_h
24#define vtkWebAssemblyRenderWindowInteractor_h
25
26#ifndef __EMSCRIPTEN__
27#error "vtkWebAssemblyRenderWindowInteractor requires the Emscripten SDK"
28#endif
29
31#include "vtkRenderingUIModule.h" // For export macro
32#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
33#include <memory> // for shared_ptr
34
35VTK_ABI_NAMESPACE_BEGIN
36
39{
40public:
45
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
52 void Initialize() override;
53
58 void ProcessEvents() override;
59
65 void TerminateApp() override;
66
71 void ExitCallback() override;
72
76 vtkGetStringMacro(CanvasSelector);
77 virtual void SetCanvasSelector(const char* value);
78
83 vtkGetMacro(ExpandCanvasToContainer, bool);
84 vtkSetMacro(ExpandCanvasToContainer, bool);
85 vtkBooleanMacro(ExpandCanvasToContainer, bool);
86
92 vtkGetMacro(InstallHTMLResizeObserver, bool);
93 vtkSetMacro(InstallHTMLResizeObserver, bool);
94 vtkBooleanMacro(InstallHTMLResizeObserver, bool);
95
96protected:
99
101
112
113 void ProcessEvent(int type, const std::uint8_t* event);
114
116
122 int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
123 int InternalDestroyTimer(int platformTimerId) override;
125
129 void StartEventLoop() override;
130
131 char* CanvasSelector = nullptr;
134
135private:
137 void operator=(const vtkWebAssemblyRenderWindowInteractor&) = delete;
138
139 friend class vtkInternals;
140 class vtkInternals;
141 std::shared_ptr<vtkInternals> Internals; // the pointer is also shared with timer's callback data.
142};
143
144extern "C"
145{
146 typedef void (*vtkTimerCallbackFunc)(void*);
148 unsigned long duration, bool isOneShot, vtkTimerCallbackFunc callback, void* userData);
149 void vtkDestroyTimer(int timerId, bool isOneShot);
150 int* vtkGetParentElementBoundingRectSize(const char* selector);
151 void vtkInitializeCanvasElement(const char* selector, bool applyStyle);
152}
153
154VTK_ABI_NAMESPACE_END
155#endif
a simple class to control print indentation
Definition vtkIndent.h:108
platform-independent render window interaction including picking and frame rate control.
Handles user interaction in web browsers.
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.
int vtkCreateTimer(unsigned long duration, bool isOneShot, vtkTimerCallbackFunc callback, void *userData)
void vtkInitializeCanvasElement(const char *selector, bool applyStyle)
void(* vtkTimerCallbackFunc)(void *)
void vtkDestroyTimer(int timerId, bool isOneShot)
int * vtkGetParentElementBoundingRectSize(const char *selector)
#define VTK_MARSHALAUTO