VTK  9.4.20250103
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
20#ifndef vtkWebAssemblyRenderWindowInteractor_h
21#define vtkWebAssemblyRenderWindowInteractor_h
22
23#ifndef __EMSCRIPTEN__
24#error "vtkWebAssemblyRenderWindowInteractor requires the Emscripten SDK"
25#endif
26
28#include "vtkRenderingUIModule.h" // For export macro
29#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
30#include <memory> // for shared_ptr
31
32VTK_ABI_NAMESPACE_BEGIN
33
36{
37public:
42
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
49 void Initialize() override;
50
55 void ProcessEvents() override;
56
62 void TerminateApp() override;
63
68 void ExitCallback() override;
69
73 vtkGetStringMacro(CanvasSelector);
74 virtual void SetCanvasSelector(const char* value);
75
80 vtkGetMacro(ExpandCanvasToContainer, bool);
81 vtkSetMacro(ExpandCanvasToContainer, bool);
82 vtkBooleanMacro(ExpandCanvasToContainer, bool);
83
89 vtkGetMacro(InstallHTMLResizeObserver, bool);
90 vtkSetMacro(InstallHTMLResizeObserver, bool);
91 vtkBooleanMacro(InstallHTMLResizeObserver, bool);
92
93protected:
96
98
109
110 void ProcessEvent(int type, const std::uint8_t* event);
111
113
119 int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
120 int InternalDestroyTimer(int platformTimerId) override;
122
126 void StartEventLoop() override;
127
128 char* CanvasSelector = nullptr;
131
132private:
134 void operator=(const vtkWebAssemblyRenderWindowInteractor&) = delete;
135
136 friend class vtkInternals;
137 class vtkInternals;
138 std::shared_ptr<vtkInternals> Internals; // the pointer is also shared with timer's callback data.
139};
140
141extern "C"
142{
143 typedef void (*vtkTimerCallbackFunc)(void*);
145 unsigned long duration, bool isOneShot, vtkTimerCallbackFunc callback, void* userData);
146 void vtkDestroyTimer(int timerId, bool isOneShot);
147 int* vtkGetParentElementBoundingRectSize(const char* selector);
148 void vtkInitializeCanvasElement(const char* selector, bool applyStyle);
149}
150
151VTK_ABI_NAMESPACE_END
152#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