VTK  9.3.1
vtkAndroidRenderWindowInteractor.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
24 #ifndef vtkAndroidRenderWindowInteractor_h
25 #define vtkAndroidRenderWindowInteractor_h
26 
28 #include "vtkRenderingUIModule.h" // For export macro
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 struct AInputEvent;
32 
33 class VTKRENDERINGUI_EXPORT vtkAndroidRenderWindowInteractor : public vtkRenderWindowInteractor
34 {
35 public:
40 
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  void Initialize() override;
48 
50 
59  void Enable() override;
60  void Disable() override;
62 
68  void TerminateApp() override;
69 
71 
77  static void SetClassExitMethod(void (*f)(void*), void* arg);
78  static void SetClassExitMethodArgDelete(void (*f)(void*));
80 
85  void ExitCallback() override;
86 
87  virtual void SetAndroidApplication(struct android_app* app) { this->AndroidApplication = app; }
88 
92  void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt);
93 
97  void HandleMotionEvent(
98  int actionType, int actionId, int numPtrs, int* xPtr, int* yPtr, int* idPtr, int metaState);
99 
103  const char* GetKeySym(int keyCode);
104 
105  void HandleCommand(int32_t cmd);
106  int32_t HandleInput(AInputEvent* event);
107 
109 
112  vtkSetMacro(OwnWindow, bool);
113  vtkGetMacro(OwnWindow, bool);
115 
116 protected:
119 
122 
123  struct android_app* AndroidApplication;
124  const char** KeyCodeToKeySymTable;
125 
126  bool Done; // is the event loop done running
127 
129 
134  static void (*ClassExitMethod)(void*);
135  static void (*ClassExitMethodArgDelete)(void*);
136  static void* ClassExitMethodArg;
138 
140 
144  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
145  int InternalDestroyTimer(int platformTimerId) override;
147 
153  void StartEventLoop() override;
154 
156 
157 private:
159  void operator=(const vtkAndroidRenderWindowInteractor&) = delete;
160 };
161 
162 VTK_ABI_NAMESPACE_END
163 #endif
virtual void Enable()
Enable/Disable interactions.
virtual char * GetKeySym()
Set/get the key symbol for the key that was pressed.
virtual int InternalDestroyTimer(int platformTimerId)
Internal methods for creating and destroying timers that must be implemented by subclasses.
implements Win32 specific functions required by vtkRenderWindowInteractor.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Internal methods for creating and destroying timers that must be implemented by subclasses.
virtual void SetAndroidApplication(struct android_app *app)
virtual void Initialize()
Prepare for handling events and set the Enabled flag to true.
static vtkRenderWindowInteractor * New()
int vtkTypeBool
Definition: vtkABI.h:64
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void ExitCallback()
These methods correspond to the Exit, User and Pick callbacks.
virtual void StartEventLoop()
Run the event loop (does not return until TerminateApp is called).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void TerminateApp()
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...