00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCocoaRenderWindow.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 =========================================================================*/ 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 vtkTypeRevisionMacro(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 SetParentId(void *) 00106 { 00107 vtkWarningMacro("Method not implemented."); 00108 } 00109 virtual void* GetGenericParentId() 00110 { 00111 vtkWarningMacro("Method not implemented."); 00112 return 0; 00113 } 00114 virtual void* GetGenericDrawable() 00115 { 00116 vtkWarningMacro("Method not implemented."); 00117 return 0; 00118 } 00119 virtual void SetWindowInfo(char*) 00120 { 00121 vtkWarningMacro("Method not implemented."); 00122 } 00123 virtual void SetParentInfo(char*) 00124 { 00125 vtkWarningMacro("Method not implemented."); 00126 } 00127 void SetNextWindowId(void*) 00128 { 00129 vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented)."); 00130 } 00131 00132 00134 virtual void StereoUpdate(); 00135 00140 virtual void SetStereoCapableWindow(int capable); 00141 00143 virtual void MakeCurrent(); 00144 00146 void UpdateContext(); 00147 00149 const char *ReportCapabilities(); 00150 00152 int SupportsOpenGL(); 00153 00155 int IsDirect(); 00156 00160 virtual void SetForceMakeCurrent(); 00161 00164 virtual int GetEventPending(); 00165 00167 00168 virtual void SetupPalette(void *hDC); 00169 virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 00170 int bpp=16, int zbpp=16); 00172 00174 void Finalize(); 00175 00177 void RegisterTextureResource (GLuint id); 00178 00180 int GetDepthBufferSize(); 00181 00183 00185 virtual void HideCursor(); 00186 virtual void ShowCursor(); 00188 00191 virtual int GetWindowCreated(); 00192 00194 00195 void SetContextId(void *); 00196 void *GetContextId(); 00197 virtual void *GetGenericContext() {return this->GetContextId();} 00199 00208 virtual void SetWindowId(void *); 00209 00211 00212 virtual void *GetWindowId(); 00213 virtual void *GetGenericWindowId() {return this->GetWindowId();} 00215 00224 virtual void SetDisplayId(void *); 00225 00227 00228 virtual void *GetDisplayId(); 00229 virtual void *GetGenericDisplayId() {return this->GetDisplayId();} 00231 00233 00235 vtkGetMacro(ScaleFactor, double); 00237 00238 protected: 00239 vtkCocoaRenderWindow(); 00240 ~vtkCocoaRenderWindow(); 00241 00242 void CreateGLContext(); 00243 00244 void CreateAWindow(); 00245 void DestroyWindow(); 00246 void DestroyOffScreenWindow(); 00247 00248 int OffScreenInitialized; 00249 int OnScreenInitialized; 00250 00251 double ScaleFactor; 00252 00254 00256 void SetPixelFormat(void *pixelFormat); 00257 void *GetPixelFormat(); 00259 00261 00263 void SetCocoaManager(void *manager); 00264 void *GetCocoaManager(); 00266 00267 private: 00268 vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented. 00269 void operator=(const vtkCocoaRenderWindow&); // Not implemented. 00270 00271 private: 00272 // Important: this class cannot contain Objective-C instance 00273 // variables for 2 reasons: 00274 // 1) C++ files include this header 00275 // 2) because of garbage collection 00276 // Instead, use the CocoaManager dictionary to keep a collection 00277 // of what would otherwise be Objective-C instance variables. 00278 void *CocoaManager; // Really an NSMutableDictionary* 00279 00280 int WindowCreated; 00281 int ViewCreated; 00282 int CursorHidden; 00283 00284 int ForceMakeCurrent; 00285 char *Capabilities; 00286 }; 00287 00288 #endif