VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCarbonRenderWindowInteractor.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 =========================================================================*/ 00031 #ifndef vtkCarbonRenderWindowInteractor_h 00032 #define vtkCarbonRenderWindowInteractor_h 00033 00034 #include "vtkRenderingOpenGLModule.h" // For export macro 00035 #include "vtkRenderWindowInteractor.h" 00036 00037 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX 00038 #ifdef VTK_USE_TDX 00039 class vtkTDxMacDevice; 00040 #endif 00041 00042 #include <Carbon/Carbon.h> // Carbon and Mac specific 00043 00044 class VTKRENDERINGOPENGL_EXPORT vtkCarbonRenderWindowInteractor : public vtkRenderWindowInteractor 00045 { 00046 public: 00048 static vtkCarbonRenderWindowInteractor *New(); 00049 00050 vtkTypeMacro(vtkCarbonRenderWindowInteractor,vtkRenderWindowInteractor); 00051 void PrintSelf(ostream& os, vtkIndent indent); 00052 00054 virtual void Initialize(); 00055 00057 00064 virtual void Enable(); 00065 virtual void Disable(); 00067 00072 void TerminateApp(void); 00073 00075 00079 static void SetClassExitMethod(void (*f)(void *), void *arg); 00080 static void SetClassExitMethodArgDelete(void (*f)(void *)); 00082 00085 virtual void ExitCallback(); 00086 00088 00090 void GetLastMouseDelta(int delta[2]) { 00091 delta[0] = this->LastMouseDelta[0]; delta[1] = this->LastMouseDelta[1]; }; 00092 void SetLastMouseDelta(int deltaX, int deltaY) { 00093 this->LastMouseDelta[0] = deltaX; this->LastMouseDelta[1] = deltaY; }; 00095 00097 00101 void SetMouseInsideWindow(int val) { 00102 this->MouseInsideWindow = val; }; 00103 int GetMouseInsideWindow() { 00104 return this->MouseInsideWindow; }; 00106 00108 00111 void SetMouseButtonDown(int val) { 00112 this->MouseButtonDown = val; }; 00113 int GetMouseButtonDown() { 00114 return this->MouseButtonDown; }; 00116 00117 protected: 00118 vtkCarbonRenderWindowInteractor(); 00119 ~vtkCarbonRenderWindowInteractor(); 00120 00121 EventHandlerUPP ViewProcUPP; 00122 EventHandlerUPP WindowProcUPP; 00123 00124 // For generating event info that Carbon doesn't 00125 int LastMouseDelta[2]; 00126 int LeaveCheckId; 00127 int MouseInsideWindow; 00128 int MouseButtonDown; 00129 00130 //BTX 00132 00135 static void (*ClassExitMethod)(void *); 00136 static void (*ClassExitMethodArgDelete)(void *); 00137 static void *ClassExitMethodArg; 00138 //ETX 00140 00142 00144 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration); 00145 virtual int InternalDestroyTimer(int platformTimerId); 00147 00151 virtual void StartEventLoop(); 00152 00153 #ifdef VTK_USE_TDX 00154 vtkTDxMacDevice *Device; 00155 #endif 00156 00157 private: 00158 vtkCarbonRenderWindowInteractor(const vtkCarbonRenderWindowInteractor&); // Not implemented. 00159 void operator=(const vtkCarbonRenderWindowInteractor&); // Not implemented. 00160 }; 00161 00162 #endif