VTK
dox/Rendering/OpenGL/vtkCarbonRenderWindowInteractor.h
Go to the documentation of this file.
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 =========================================================================*/
00028 #ifndef __vtkCarbonRenderWindowInteractor_h
00029 #define __vtkCarbonRenderWindowInteractor_h
00030 
00031 #include "vtkRenderingOpenGLModule.h" // For export macro
00032 #include "vtkRenderWindowInteractor.h"
00033 
00034 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
00035 #ifdef VTK_USE_TDX
00036 class vtkTDxMacDevice;
00037 #endif
00038 
00039 #include <Carbon/Carbon.h> // Carbon and Mac specific
00040 
00041 class VTKRENDERINGOPENGL_EXPORT vtkCarbonRenderWindowInteractor : public vtkRenderWindowInteractor
00042 {
00043 public:
00045   static vtkCarbonRenderWindowInteractor *New();
00046 
00047   vtkTypeMacro(vtkCarbonRenderWindowInteractor,vtkRenderWindowInteractor);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00051   virtual void Initialize();
00052 
00054 
00061   virtual void Enable();
00062   virtual void Disable();
00064 
00068   virtual void Start();
00069 
00071 
00076   vtkSetMacro(InstallMessageProc,int);
00077   vtkGetMacro(InstallMessageProc,int);
00078   vtkBooleanMacro(InstallMessageProc,int);
00080 
00085   void TerminateApp(void);
00086 
00088 
00092   static void SetClassExitMethod(void (*f)(void *), void *arg);
00093   static void SetClassExitMethodArgDelete(void (*f)(void *));
00095 
00098   virtual void ExitCallback();
00099 
00101 
00103   void GetLastMouseDelta(int delta[2]) {
00104     delta[0] = this->LastMouseDelta[0]; delta[1] = this->LastMouseDelta[1]; };
00105   void SetLastMouseDelta(int deltaX, int deltaY) {
00106     this->LastMouseDelta[0] = deltaX; this->LastMouseDelta[1] = deltaY; };
00108 
00110 
00114   void SetMouseInsideWindow(int val) {
00115      this->MouseInsideWindow = val; };
00116   int GetMouseInsideWindow() {
00117      return this->MouseInsideWindow; };
00119 
00121 
00124   void SetMouseButtonDown(int val) {
00125      this->MouseButtonDown = val; };
00126   int GetMouseButtonDown() {
00127      return this->MouseButtonDown; };
00129 
00130 protected:
00131   vtkCarbonRenderWindowInteractor();
00132   ~vtkCarbonRenderWindowInteractor();
00133 
00134   EventHandlerUPP   ViewProcUPP;
00135   EventHandlerUPP   WindowProcUPP;
00136   int               InstallMessageProc;
00137 
00138   // For generating event info that Carbon doesn't
00139   int   LastMouseDelta[2];
00140   int   LeaveCheckId;
00141   int   MouseInsideWindow;
00142   int   MouseButtonDown;
00143 
00144   //BTX
00146 
00149   static void (*ClassExitMethod)(void *);
00150   static void (*ClassExitMethodArgDelete)(void *);
00151   static void *ClassExitMethodArg;
00152   //ETX
00154 
00156 
00158   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00159   virtual int InternalDestroyTimer(int platformTimerId);
00161 
00162 #ifdef VTK_USE_TDX
00163   vtkTDxMacDevice *Device;
00164 #endif
00165 
00166 private:
00167   vtkCarbonRenderWindowInteractor(const vtkCarbonRenderWindowInteractor&);  // Not implemented.
00168   void operator=(const vtkCarbonRenderWindowInteractor&);  // Not implemented.
00169 };
00170 
00171 #endif