VTK
dox/Rendering/vtkCocoaRenderWindowInteractor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCocoaRenderWindowInteractor.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 __vtkCocoaRenderWindowInteractor_h
00029 #define __vtkCocoaRenderWindowInteractor_h
00030 
00031 #include "vtkRenderWindowInteractor.h"
00032 #include "vtkTDxConfigure.h" // defines VTK_USE_TDX
00033 #ifdef VTK_USE_TDX
00034 class vtkTDxMacDevice;
00035 #endif
00036 
00037 class VTK_RENDERING_EXPORT vtkCocoaRenderWindowInteractor : public vtkRenderWindowInteractor
00038 {
00039 public:
00041   static vtkCocoaRenderWindowInteractor *New();
00042 
00043   vtkTypeMacro(vtkCocoaRenderWindowInteractor,vtkRenderWindowInteractor);
00044   void PrintSelf(ostream& os, vtkIndent indent);
00045 
00047   virtual void Initialize();
00048 
00050 
00057   virtual void Enable();
00058   virtual void Disable();
00060 
00064   virtual void Start();
00065 
00067 
00072   vtkSetMacro(InstallMessageProc,int);
00073   vtkGetMacro(InstallMessageProc,int);
00074   vtkBooleanMacro(InstallMessageProc,int);
00076 
00081   void TerminateApp();
00082 
00084 
00088   static void SetClassExitMethod(void (*f)(void *), void *arg);
00089   static void SetClassExitMethodArgDelete(void (*f)(void *));
00091 
00094   virtual void ExitCallback();
00095   
00096 //  int GetButtonDown();
00097 //  void SetButtonDown(int button);
00098 
00099 protected:
00100   vtkCocoaRenderWindowInteractor();
00101   ~vtkCocoaRenderWindowInteractor();
00102 
00103   int     InstallMessageProc;
00104   
00106 
00108   void SetTimerDictionary(void *dictionary);    // Really an NSMutableDictionary*
00109   void *GetTimerDictionary();
00110   void SetCocoaServer(void *server);            // Really a vtkCocoaServer*
00111   void *GetCocoaServer();
00113 
00114   //BTX
00116 
00119   static void (*ClassExitMethod)(void *);
00120   static void (*ClassExitMethodArgDelete)(void *);
00121   static void *ClassExitMethodArg;
00122   //ETX
00124 
00126 
00128   virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
00129   virtual int InternalDestroyTimer(int platformTimerId);
00131   
00133 
00135   void SetCocoaManager(void *manager);
00136   void *GetCocoaManager();
00138 
00139 #ifdef VTK_USE_TDX
00140   vtkTDxMacDevice *Device;
00141 #endif
00142   
00143 private:
00144   vtkCocoaRenderWindowInteractor(const vtkCocoaRenderWindowInteractor&);  // Not implemented.
00145   void operator=(const vtkCocoaRenderWindowInteractor&);  // Not implemented.
00146   
00147   // Important: this class cannot contain Objective-C instance
00148   // variables for 2 reasons:
00149   // 1) C++ files include this header
00150   // 2) because of garbage collection
00151   // Instead, use the CocoaManager dictionary to keep a collection
00152   // of what would otherwise be Objective-C instance variables.
00153   void    *CocoaManager;        // Really an NSMutableDictionary*
00154   
00155 };
00156 
00157 #endif