VTK
dox/Rendering/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 "vtkRenderWindowInteractor.h"
00032 
00033 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
00034 #ifdef VTK_USE_TDX
00035 class vtkTDxMacDevice;
00036 #endif
00037 
00038 // The 10.3.9 SDK (and older probably) have a bug in fp.h (in the Carbon
00039 // umbrella framework) which this works around. Without this, there
00040 // would be a compile error from the Carbon header if Python wrappings
00041 // were enabled.
00042 #include <AvailabilityMacros.h> // Needed for MAC_OS_X_VERSION_MAX_ALLOWED
00043 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
00044   #define scalb scalbn
00045 #endif
00046 
00047 #include <Carbon/Carbon.h> // Carbon and Mac specific
00048 
00049 class VTK_RENDERING_EXPORT vtkCarbonRenderWindowInteractor : public vtkRenderWindowInteractor
00050 {
00051 public:
00053   static vtkCarbonRenderWindowInteractor *New();
00054 
00055   vtkTypeMacro(vtkCarbonRenderWindowInteractor,vtkRenderWindowInteractor);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00059   virtual void Initialize();
00060 
00062 
00069   virtual void Enable();
00070   virtual void Disable();
00072 
00076   virtual void Start();
00077 
00079 
00084   vtkSetMacro(InstallMessageProc,int);
00085   vtkGetMacro(InstallMessageProc,int);
00086   vtkBooleanMacro(InstallMessageProc,int);
00088 
00093   void TerminateApp(void);
00094 
00096 
00100   static void SetClassExitMethod(void (*f)(void *), void *arg);
00101   static void SetClassExitMethodArgDelete(void (*f)(void *));
00103 
00106   virtual void ExitCallback();
00107 
00109 
00111   void GetLastMouseDelta(int delta[2]) {
00112     delta[0] = this->LastMouseDelta[0]; delta[1] = this->LastMouseDelta[1]; };
00113   void SetLastMouseDelta(int deltaX, int deltaY) {
00114     this->LastMouseDelta[0] = deltaX; this->LastMouseDelta[1] = deltaY; };
00116 
00118 
00122   void SetMouseInsideWindow(int val) {
00123      this->MouseInsideWindow = val; };
00124   int GetMouseInsideWindow() {
00125      return this->MouseInsideWindow; };
00127 
00129 
00132   void SetMouseButtonDown(int val) {
00133      this->MouseButtonDown = val; };
00134   int GetMouseButtonDown() {
00135      return this->MouseButtonDown; };
00137 
00138 protected:
00139   vtkCarbonRenderWindowInteractor();
00140   ~vtkCarbonRenderWindowInteractor();
00141 
00142   EventHandlerUPP   ViewProcUPP;
00143   EventHandlerUPP   WindowProcUPP;
00144   int               InstallMessageProc;
00145 
00146   // For generating event info that Carbon doesn't
00147   int   LastMouseDelta[2];
00148   int   LeaveCheckId;
00149   int   MouseInsideWindow;
00150   int   MouseButtonDown;
00151 
00152   //BTX
00154 
00157   static void (*ClassExitMethod)(void *);
00158   static void (*ClassExitMethodArgDelete)(void *);
00159   static void *ClassExitMethodArg;
00160   //ETX
00162 
00164 
00166   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00167   virtual int InternalDestroyTimer(int platformTimerId);
00169 
00170 #ifdef VTK_USE_TDX
00171   vtkTDxMacDevice *Device;
00172 #endif
00173   
00174 private:
00175   vtkCarbonRenderWindowInteractor(const vtkCarbonRenderWindowInteractor&);  // Not implemented.
00176   void operator=(const vtkCarbonRenderWindowInteractor&);  // Not implemented.
00177 };
00178 
00179 #endif