00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCocoaRenderWindowInteractor.h,v $ 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 00033 00034 class VTK_RENDERING_EXPORT vtkCocoaRenderWindowInteractor : public vtkRenderWindowInteractor 00035 { 00036 public: 00038 static vtkCocoaRenderWindowInteractor *New(); 00039 00040 vtkTypeRevisionMacro(vtkCocoaRenderWindowInteractor,vtkRenderWindowInteractor); 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00044 virtual void Initialize(); 00045 00047 00054 virtual void Enable(); 00055 virtual void Disable(); 00057 00061 virtual void Start(); 00062 00064 00069 vtkSetMacro(InstallMessageProc,int); 00070 vtkGetMacro(InstallMessageProc,int); 00071 vtkBooleanMacro(InstallMessageProc,int); 00073 00078 void TerminateApp(); 00079 00081 00085 static void SetClassExitMethod(void (*f)(void *), void *arg); 00086 static void SetClassExitMethodArgDelete(void (*f)(void *)); 00088 00091 virtual void ExitCallback(); 00092 00093 // int GetButtonDown(); 00094 // void SetButtonDown(int button); 00095 00096 protected: 00097 vtkCocoaRenderWindowInteractor(); 00098 ~vtkCocoaRenderWindowInteractor(); 00099 00100 int InstallMessageProc; 00101 00103 00105 void SetTimerDictionary(void *dictionary); // Really an NSMutableDictionary* 00106 void *GetTimerDictionary(); 00107 void SetCocoaServer(void *server); // Really a vtkCocoaServer* 00108 void *GetCocoaServer(); 00110 00111 //BTX 00113 00116 static void (*ClassExitMethod)(void *); 00117 static void (*ClassExitMethodArgDelete)(void *); 00118 static void *ClassExitMethodArg; 00119 //ETX 00121 00123 00125 virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration); 00126 virtual int InternalDestroyTimer(int platformTimerId); 00128 00130 00132 void SetCocoaManager(void *manager); 00133 void *GetCocoaManager(); 00135 00136 private: 00137 vtkCocoaRenderWindowInteractor(const vtkCocoaRenderWindowInteractor&); // Not implemented. 00138 void operator=(const vtkCocoaRenderWindowInteractor&); // Not implemented. 00139 00140 // Important: this class cannot contain Objective-C instance 00141 // variables for 2 reasons: 00142 // 1) C++ files include this header 00143 // 2) because of garbage collection 00144 // Instead, use the CocoaManager dictionary to keep a collection 00145 // of what would otherwise be Objective-C instance variables. 00146 void *CocoaManager; // Really an NSMutableDictionary* 00147 00148 }; 00149 00150 #endif