VTK
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 =========================================================================*/
33 #ifndef vtkAndroidRenderWindowInteractor_h
34 #define vtkAndroidRenderWindowInteractor_h
35 
36 #include "vtkRenderingOpenGL2Module.h" // For export macro
38 
39 struct AInputEvent;
40 
41 class VTKRENDERINGOPENGL2_EXPORT vtkAndroidRenderWindowInteractor : public vtkRenderWindowInteractor
42 {
43 public:
48 
50  void PrintSelf(ostream& os, vtkIndent indent);
51 
55  virtual void Initialize();
56 
58 
67  virtual void Enable();
68  virtual void Disable();
70 
76  void TerminateApp(void);
77 
79 
85  static void SetClassExitMethod(void (*f)(void *), void *arg);
86  static void SetClassExitMethodArgDelete(void (*f)(void *));
88 
93  virtual void ExitCallback();
94 
95  virtual void SetAndroidApplication(struct android_app *app)
96  { this->AndroidApplication = app; };
97 
101  void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt);
102 
106  void HandleMotionEvent(int actionType, int actionId, int numPtrs,
107  int *xPtr, int *yPtr, int *idPtr, int metaState);
108 
112  const char *GetKeySym(int keyCode);
113 
114  void HandleCommand(int32_t cmd);
115  int32_t HandleInput(AInputEvent* event);
116 
117 
118 protected:
121 
124 
125  struct android_app *AndroidApplication;
126  const char **KeyCodeToKeySymTable;
127 
128  bool Done; // is the event loop done running
129 
131 
136  static void (*ClassExitMethod)(void *);
137  static void (*ClassExitMethodArgDelete)(void *);
138  static void *ClassExitMethodArg;
140 
142 
146  virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
147  virtual int InternalDestroyTimer(int platformTimerId);
149 
155  virtual void StartEventLoop();
156 
157 private:
159  void operator=(const vtkAndroidRenderWindowInteractor&) VTK_DELETE_FUNCTION;
160 };
161 
162 #endif
implements Win32 specific functions required by vtkRenderWindowInteractor.
virtual int InternalDestroyTimer(int platformTimerId)
void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt)
Handle key up/down events.
void HandleMotionEvent(int actionType, int actionId, int numPtrs, int *xPtr, int *yPtr, int *idPtr, int metaState)
Handle motion events.
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration)
Win32-specific internal timer methods.
static vtkAndroidRenderWindowInteractor * New()
Construct object so that light follows camera motion.
virtual void Initialize()
Initialize the event handler.
const char * GetKeySym(int keyCode)
used for converting keyCodes on Android
virtual void StartEventLoop()
This will start up the event loop and never return.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void Enable()
Enable/Disable interactions.
void TerminateApp(void)
Android specific application terminate, calls ClassExitMethod then calls PostQuitMessage(0) to termin...
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 *))
virtual void ExitCallback()
These methods correspond to the the Exit, User and Pick callbacks.
int32_t HandleInput(AInputEvent *event)
a simple class to control print indentation
Definition: vtkIndent.h:40
platform-independent render window interaction including picking and frame rate control.