VTK  9.1.0
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 =========================================================================*/
30 #ifndef vtkAndroidRenderWindowInteractor_h
31 #define vtkAndroidRenderWindowInteractor_h
32 
34 #include "vtkRenderingUIModule.h" // For export macro
35 
36 struct AInputEvent;
37 
38 class VTKRENDERINGUI_EXPORT vtkAndroidRenderWindowInteractor : public vtkRenderWindowInteractor
39 {
40 public:
45 
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
52  void Initialize() override;
53 
55 
64  void Enable() override;
65  void Disable() override;
67 
73  void TerminateApp(void) override;
74 
76 
82  static void SetClassExitMethod(void (*f)(void*), void* arg);
83  static void SetClassExitMethodArgDelete(void (*f)(void*));
85 
90  void ExitCallback() override;
91 
92  virtual void SetAndroidApplication(struct android_app* app) { this->AndroidApplication = app; }
93 
97  void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt);
98 
103  int actionType, int actionId, int numPtrs, int* xPtr, int* yPtr, int* idPtr, int metaState);
104 
108  const char* GetKeySym(int keyCode);
109 
110  void HandleCommand(int32_t cmd);
111  int32_t HandleInput(AInputEvent* event);
112 
114 
117  vtkSetMacro(OwnWindow, bool);
118  vtkGetMacro(OwnWindow, bool);
120 
121 protected:
124 
127 
128  struct android_app* AndroidApplication;
129  const char** KeyCodeToKeySymTable;
130 
131  bool Done; // is the event loop done running
132 
134 
139  static void (*ClassExitMethod)(void*);
140  static void (*ClassExitMethodArgDelete)(void*);
141  static void* ClassExitMethodArg;
143 
145 
149  int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override;
150  int InternalDestroyTimer(int platformTimerId) override;
152 
158  void StartEventLoop() override;
159 
161 
162 private:
164  void operator=(const vtkAndroidRenderWindowInteractor&) = delete;
165 };
166 
167 #endif
implements Win32 specific functions required by vtkRenderWindowInteractor.
void TerminateApp(void) override
Android specific application terminate, calls ClassExitMethod then calls PostQuitMessage(0) to termin...
static void * ClassExitMethodArg
Class variables so an exit method can be defined for this class (used to set different exit methods f...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ExitCallback() override
These methods correspond to the Exit, User and Pick callbacks.
void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt)
Handle key up/down events.
int InternalDestroyTimer(int platformTimerId) override
Win32-specific internal timer methods.
void HandleMotionEvent(int actionType, int actionId, int numPtrs, int *xPtr, int *yPtr, int *idPtr, int metaState)
Handle motion events.
static vtkAndroidRenderWindowInteractor * New()
Construct object so that light follows camera motion.
const char * GetKeySym(int keyCode)
used for converting keyCodes on Android
void Enable() override
Enable/Disable interactions.
void Initialize() override
Initialize the event handler.
void StartEventLoop() override
This will start up the event loop and never return.
virtual void SetAndroidApplication(struct android_app *app)
static void SetClassExitMethod(void(*f)(void *), void *arg)
Methods to set the default exit method for the class.
static void SetClassExitMethodArgDelete(void(*f)(void *))
Methods to set the default exit method for the class.
int InternalCreateTimer(int timerId, int timerType, unsigned long duration) override
Win32-specific internal timer methods.
int32_t HandleInput(AInputEvent *event)
void Disable() override
Enable/Disable interactions.
a simple class to control print indentation
Definition: vtkIndent.h:34
platform-independent render window interaction including picking and frame rate control.
int vtkTypeBool
Definition: vtkABI.h:69