VTK  9.2.6
vtkAndroidRenderWindowInteractor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAndroidRenderWindowInteractor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
36 #ifndef vtkAndroidRenderWindowInteractor_h
37 #define vtkAndroidRenderWindowInteractor_h
38 
40 #include "vtkRenderingUIModule.h" // For export macro
41 
42 struct AInputEvent;
43 
44 class VTKRENDERINGUI_EXPORT vtkAndroidRenderWindowInteractor : public vtkRenderWindowInteractor
45 {
46 public:
51 
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
58  void Initialize() override;
59 
61 
70  void Enable() override;
71  void Disable() override;
73 
79  void TerminateApp(void) override;
80 
82 
88  static void SetClassExitMethod(void (*f)(void*), void* arg);
89  static void SetClassExitMethodArgDelete(void (*f)(void*));
91 
96  void ExitCallback() override;
97 
98  virtual void SetAndroidApplication(struct android_app* app) { this->AndroidApplication = app; }
99 
103  void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt);
104 
108  void HandleMotionEvent(
109  int actionType, int actionId, int numPtrs, int* xPtr, int* yPtr, int* idPtr, int metaState);
110 
114  const char* GetKeySym(int keyCode);
115 
116  void HandleCommand(int32_t cmd);
117  int32_t HandleInput(AInputEvent* event);
118 
120 
123  vtkSetMacro(OwnWindow, bool);
124  vtkGetMacro(OwnWindow, bool);
126 
127 protected:
130 
133 
134  struct android_app* AndroidApplication;
135  const char** KeyCodeToKeySymTable;
136 
137  bool Done; // is the event loop done running
138 
140 
145  static void (*ClassExitMethod)(void*);
146  static void (*ClassExitMethodArgDelete)(void*);
147  static void* ClassExitMethodArg;
149 
151 
155  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
156  int InternalDestroyTimer(int platformTimerId) override;
158 
164  void StartEventLoop() override;
165 
167 
168 private:
170  void operator=(const vtkAndroidRenderWindowInteractor&) = delete;
171 };
172 
173 #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:69
platform-independent render window interaction including picking and frame rate control.
a simple class to control print indentation
Definition: vtkIndent.h:39
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).
virtual void TerminateApp(void)
This function is called on 'q','e' keypress if exitmethod is not specified and should be overridden b...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...