VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkAndroidRenderWindowInteractor.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00035 #ifndef vtkAndroidRenderWindowInteractor_h 00036 #define vtkAndroidRenderWindowInteractor_h 00037 00038 #include "vtkRenderingOpenGL2Module.h" // For export macro 00039 #include "vtkRenderWindowInteractor.h" 00040 00041 struct AInputEvent; 00042 00043 class VTKRENDERINGOPENGL2_EXPORT vtkAndroidRenderWindowInteractor : public vtkRenderWindowInteractor 00044 { 00045 public: 00047 static vtkAndroidRenderWindowInteractor *New(); 00048 00049 vtkTypeMacro(vtkAndroidRenderWindowInteractor,vtkRenderWindowInteractor); 00050 void PrintSelf(ostream& os, vtkIndent indent); 00051 00053 virtual void Initialize(); 00054 00056 00063 virtual void Enable(); 00064 virtual void Disable(); 00066 00071 void TerminateApp(void); 00072 00074 00078 static void SetClassExitMethod(void (*f)(void *), void *arg); 00079 static void SetClassExitMethodArgDelete(void (*f)(void *)); 00081 00084 virtual void ExitCallback(); 00085 00086 virtual void SetAndroidApplication(struct android_app *app) 00087 { this->AndroidApplication = app; }; 00088 00090 void HandleKeyEvent(bool down, int nChar, int metaState, int nRepCnt); 00091 00093 00094 void HandleMotionEvent(int action, int eventPointer, int numPtrs, 00095 int *xPtr, int *yPtr, int *idPtr, int metaState); 00097 00099 const char *GetKeySym(int keyCode); 00100 00101 void HandleCommand(int32_t cmd); 00102 int32_t HandleInput(AInputEvent* event); 00103 00104 00105 protected: 00106 vtkAndroidRenderWindowInteractor(); 00107 ~vtkAndroidRenderWindowInteractor(); 00108 00109 int MouseInWindow; 00110 int StartedMessageLoop; 00111 00112 struct android_app *AndroidApplication; 00113 const char **KeyCodeToKeySymTable; 00114 00115 bool Done; // is the event loop done running 00116 00118 00121 static void (*ClassExitMethod)(void *); 00122 static void (*ClassExitMethodArgDelete)(void *); 00123 static void *ClassExitMethodArg; 00125 00127 00129 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration); 00130 virtual int InternalDestroyTimer(int platformTimerId); 00132 00136 virtual void StartEventLoop(); 00137 00138 private: 00139 vtkAndroidRenderWindowInteractor(const vtkAndroidRenderWindowInteractor&); // Not implemented. 00140 void operator=(const vtkAndroidRenderWindowInteractor&); // Not implemented. 00141 }; 00142 00143 #endif