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 00071 virtual void SetFullScreen(int); 00072 00075 virtual void WindowRemap(); 00076 00079 virtual void PrefFullScreen(); 00080 00082 00083 virtual void SetSize(int a[2]); 00084 virtual void SetSize(int,int); 00086 00088 virtual int *GetSize(); 00089 00091 00092 virtual void SetPosition(int a[2]); 00093 virtual void SetPosition(int,int); 00095 00097 virtual int *GetScreenSize(); 00098 00100 virtual int *GetPosition(); 00101 00104 virtual void SetWindowName(const char *); 00105 00106 void SetNextWindowInfo(char *) 00107 { 00108 vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented)."); 00109 } 00110 virtual void* GetGenericDrawable() 00111 { 00112 vtkWarningMacro("Method not implemented."); 00113 return 0; 00114 } 00115 virtual void SetDisplayId(void*) 00116 { 00117 vtkWarningMacro("Method not implemented."); 00118 } 00119 virtual void *GetGenericDisplayId() 00120 { 00121 vtkWarningMacro("Method not implemented."); 00122 return 0; 00123 } 00124 00128 virtual void SetWindowInfo(char*); 00129 00133 virtual void SetParentInfo(char*); 00134 00135 void SetNextWindowId(void*) 00136 { 00137 vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented)."); 00138 } 00139 00140 00142 virtual void StereoUpdate(); 00143 00148 virtual void SetStereoCapableWindow(int capable); 00149 00151 virtual void MakeCurrent(); 00152 00155 virtual bool IsCurrent(); 00156 00158 void UpdateContext(); 00159 00161 const char *ReportCapabilities(); 00162 00164 int SupportsOpenGL(); 00165 00167 int IsDirect(); 00168 00172 virtual void SetForceMakeCurrent(); 00173 00176 virtual int GetEventPending(); 00177 00179 00180 virtual void SetupPalette(void *hDC); 00181 virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 00182 int bpp=16, int zbpp=16); 00184 00186 void Finalize(); 00187 00189 int GetDepthBufferSize(); 00190 00192 00195 virtual void HideCursor(); 00196 virtual void ShowCursor(); 00197 virtual void SetCursorPosition(int x, int y); 00199 00201 virtual void SetCurrentCursor(int); 00202 00205 virtual int GetWindowCreated(); 00206 00208 00209 void SetContextId(void *); 00210 void *GetContextId(); 00211 virtual void *GetGenericContext() {return this->GetContextId();} 00213 00222 virtual void SetRootWindow(void *); 00223 00225 virtual void *GetRootWindow(); 00226 00235 virtual void SetWindowId(void *); 00236 00238 00239 virtual void *GetWindowId(); 00240 virtual void *GetGenericWindowId() {return this->GetWindowId();} 00242 00247 virtual void SetParentId(void *nsview); 00248 00250 00253 virtual void *GetParentId(); 00254 virtual void *GetGenericParentId() { return this->GetParentId(); } 00256 00258 00260 vtkGetMacro(ScaleFactor, double); 00262 00264 00266 void SetPixelFormat(void *pixelFormat); 00267 void *GetPixelFormat(); 00269 00270 protected: 00271 vtkCocoaRenderWindow(); 00272 ~vtkCocoaRenderWindow(); 00273 00274 void CreateGLContext(); 00275 00276 void CreateAWindow(); 00277 void DestroyWindow(); 00278 void DestroyOffScreenWindow(); 00279 00280 int OffScreenInitialized; 00281 int OnScreenInitialized; 00282 00283 // Using CGFloat would be better, but doing it this way avoids pulling in 00284 // Apple headers, which cause problems with the 10.3 SDK and python wrappings. 00285 #if defined(__LP64__) && __LP64__ 00286 double ScaleFactor; 00287 #else 00288 float ScaleFactor; 00289 #endif 00290 00292 00294 void SetCocoaManager(void *manager); 00295 void *GetCocoaManager(); 00297 00298 private: 00299 vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented. 00300 void operator=(const vtkCocoaRenderWindow&); // Not implemented. 00301 00302 private: 00303 // Important: this class cannot contain Objective-C instance 00304 // variables for 2 reasons: 00305 // 1) C++ files include this header 00306 // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new) 00307 // Instead, use the CocoaManager dictionary to keep a collection 00308 // of what would otherwise be Objective-C instance variables. 00309 void *CocoaManager; // Really an NSMutableDictionary* 00310 00311 int WindowCreated; 00312 int ViewCreated; 00313 int CursorHidden; 00314 00315 int ForceMakeCurrent; 00316 char *Capabilities; 00317 }; 00318 00319 #endif