VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkCocoaRenderWindow.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 =========================================================================*/ 00041 #ifndef __vtkCocoaRenderWindow_h 00042 #define __vtkCocoaRenderWindow_h 00043 00044 #include "vtkOpenGLRenderWindow.h" 00045 00046 class VTK_RENDERING_EXPORT vtkCocoaRenderWindow : public vtkOpenGLRenderWindow 00047 { 00048 public: 00049 static vtkCocoaRenderWindow *New(); 00050 vtkTypeMacro(vtkCocoaRenderWindow,vtkOpenGLRenderWindow); 00051 void PrintSelf(ostream& os, vtkIndent indent); 00052 00054 virtual void Start(); 00055 00057 virtual void Frame(); 00058 00060 virtual void WindowConfigure(); 00061 00065 virtual void Initialize(); 00066 00068 virtual void SetFullScreen(int); 00069 00071 virtual void WindowRemap(); 00072 00074 virtual void PrefFullScreen(); 00075 00077 00078 virtual void SetSize(int*); 00079 virtual void SetSize(int,int); 00081 00083 virtual int *GetSize(); 00084 00086 00087 virtual void SetPosition(int*); 00088 virtual void SetPosition(int,int); 00090 00092 virtual int *GetScreenSize(); 00093 00095 virtual int *GetPosition(); 00096 00099 virtual void SetWindowName(const char *); 00100 00101 void SetNextWindowInfo(char *) 00102 { 00103 vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented)."); 00104 } 00105 virtual void* GetGenericDrawable() 00106 { 00107 vtkWarningMacro("Method not implemented."); 00108 return 0; 00109 } 00110 virtual void SetDisplayId(void*) 00111 { 00112 vtkWarningMacro("Method not implemented."); 00113 } 00114 virtual void *GetGenericDisplayId() 00115 { 00116 vtkWarningMacro("Method not implemented."); 00117 return 0; 00118 } 00119 00123 virtual void SetWindowInfo(char*); 00124 00128 virtual void SetParentInfo(char*); 00129 00130 void SetNextWindowId(void*) 00131 { 00132 vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented)."); 00133 } 00134 00135 00137 virtual void StereoUpdate(); 00138 00143 virtual void SetStereoCapableWindow(int capable); 00144 00146 virtual void MakeCurrent(); 00147 00150 virtual bool IsCurrent(); 00151 00153 void UpdateContext(); 00154 00156 const char *ReportCapabilities(); 00157 00159 int SupportsOpenGL(); 00160 00162 int IsDirect(); 00163 00167 virtual void SetForceMakeCurrent(); 00168 00171 virtual int GetEventPending(); 00172 00174 00175 virtual void SetupPalette(void *hDC); 00176 virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 00177 int bpp=16, int zbpp=16); 00179 00181 void Finalize(); 00182 00184 void RegisterTextureResource (GLuint id); 00185 00187 int GetDepthBufferSize(); 00188 00190 00193 virtual void HideCursor(); 00194 virtual void ShowCursor(); 00195 virtual void SetCursorPosition(int x, int y); 00197 00199 virtual void SetCurrentCursor(int); 00200 00203 virtual int GetWindowCreated(); 00204 00206 00207 void SetContextId(void *); 00208 void *GetContextId(); 00209 virtual void *GetGenericContext() {return this->GetContextId();} 00211 00220 virtual void SetRootWindow(void *); 00221 00223 virtual void *GetRootWindow(); 00224 00233 virtual void SetWindowId(void *); 00234 00236 00237 virtual void *GetWindowId(); 00238 virtual void *GetGenericWindowId() {return this->GetWindowId();} 00240 00245 virtual void SetParentId(void *nsview); 00246 00248 00251 virtual void *GetParentId(); 00252 virtual void *GetGenericParentId() { return this->GetParentId(); } 00254 00256 00258 vtkGetMacro(ScaleFactor, double); 00260 00262 00264 void SetPixelFormat(void *pixelFormat); 00265 void *GetPixelFormat(); 00267 00268 protected: 00269 vtkCocoaRenderWindow(); 00270 ~vtkCocoaRenderWindow(); 00271 00272 void CreateGLContext(); 00273 00274 void CreateAWindow(); 00275 void DestroyWindow(); 00276 void DestroyOffScreenWindow(); 00277 00278 int OffScreenInitialized; 00279 int OnScreenInitialized; 00280 00281 // Using CGFloat would be better, but doing it this way avoids pulling in 00282 // Apple headers, which cause problems with the 10.3 SDK and python wrappings. 00283 #if defined(__LP64__) && __LP64__ 00284 double ScaleFactor; 00285 #else 00286 float ScaleFactor; 00287 #endif 00288 00290 00292 void SetCocoaManager(void *manager); 00293 void *GetCocoaManager(); 00295 00296 private: 00297 vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented. 00298 void operator=(const vtkCocoaRenderWindow&); // Not implemented. 00299 00300 private: 00301 // Important: this class cannot contain Objective-C instance 00302 // variables for 2 reasons: 00303 // 1) C++ files include this header 00304 // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new) 00305 // Instead, use the CocoaManager dictionary to keep a collection 00306 // of what would otherwise be Objective-C instance variables. 00307 void *CocoaManager; // Really an NSMutableDictionary* 00308 00309 int WindowCreated; 00310 int ViewCreated; 00311 int CursorHidden; 00312 00313 int ForceMakeCurrent; 00314 char *Capabilities; 00315 }; 00316 00317 #endif