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 =========================================================================*/ 00042 #ifndef vtkCocoaRenderWindow_h 00043 #define vtkCocoaRenderWindow_h 00044 00045 #include "vtkRenderingOpenGLModule.h" // For export macro 00046 #include "vtkOpenGLRenderWindow.h" 00047 00048 class VTKRENDERINGOPENGL_EXPORT vtkCocoaRenderWindow : public vtkOpenGLRenderWindow 00049 { 00050 public: 00051 static vtkCocoaRenderWindow *New(); 00052 vtkTypeMacro(vtkCocoaRenderWindow,vtkOpenGLRenderWindow); 00053 void PrintSelf(ostream& os, vtkIndent indent); 00054 00056 virtual void Start(); 00057 00059 virtual void Frame(); 00060 00062 virtual void WindowConfigure(); 00063 00067 virtual void Initialize(); 00068 00073 virtual void SetFullScreen(int); 00074 00077 virtual void WindowRemap(); 00078 00081 virtual void PrefFullScreen(); 00082 00084 00085 virtual void SetSize(int a[2]); 00086 virtual void SetSize(int,int); 00088 00090 virtual int *GetSize(); 00091 00093 00094 virtual void SetPosition(int a[2]); 00095 virtual void SetPosition(int,int); 00097 00099 virtual int *GetScreenSize(); 00100 00102 virtual int *GetPosition(); 00103 00106 virtual void SetWindowName(const char *); 00107 00108 void SetNextWindowInfo(char *) 00109 { 00110 vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented)."); 00111 } 00112 virtual void* GetGenericDrawable() 00113 { 00114 vtkWarningMacro("Method not implemented."); 00115 return 0; 00116 } 00117 virtual void SetDisplayId(void*) 00118 { 00119 vtkWarningMacro("Method not implemented."); 00120 } 00121 virtual void *GetGenericDisplayId() 00122 { 00123 vtkWarningMacro("Method not implemented."); 00124 return 0; 00125 } 00126 00130 virtual void SetWindowInfo(char*); 00131 00135 virtual void SetParentInfo(char*); 00136 00137 void SetNextWindowId(void*) 00138 { 00139 vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented)."); 00140 } 00141 00144 virtual bool InitializeFromCurrentContext(); 00145 00147 virtual void StereoUpdate(); 00148 00153 virtual void SetStereoCapableWindow(int capable); 00154 00156 virtual void MakeCurrent(); 00157 00160 virtual bool IsCurrent(); 00161 00166 virtual bool IsDrawable(); 00167 00169 void UpdateContext(); 00170 00172 const char *ReportCapabilities(); 00173 00175 int SupportsOpenGL(); 00176 00178 int IsDirect(); 00179 00183 virtual void SetForceMakeCurrent(); 00184 00187 virtual int GetEventPending(); 00188 00190 00191 virtual void SetupPalette(void *hDC); 00192 virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 00193 int bpp=16, int zbpp=16); 00195 00197 void Finalize(); 00198 00200 int GetDepthBufferSize(); 00201 00203 00206 virtual void HideCursor(); 00207 virtual void ShowCursor(); 00208 virtual void SetCursorPosition(int x, int y); 00210 00212 virtual void SetCurrentCursor(int); 00213 00216 virtual int GetViewCreated(); 00217 00220 virtual int GetWindowCreated(); 00221 00223 00224 void SetContextId(void *); 00225 void *GetContextId(); 00226 virtual void *GetGenericContext() {return this->GetContextId();} 00228 00237 virtual void SetRootWindow(void *); 00238 00240 virtual void *GetRootWindow(); 00241 00250 virtual void SetWindowId(void *); 00251 00253 00254 virtual void *GetWindowId(); 00255 virtual void *GetGenericWindowId() {return this->GetWindowId();} 00257 00262 virtual void SetParentId(void *nsview); 00263 00265 00268 virtual void *GetParentId(); 00269 virtual void *GetGenericParentId() { return this->GetParentId(); } 00271 00273 00275 void SetPixelFormat(void *pixelFormat); 00276 void *GetPixelFormat(); 00278 00279 protected: 00280 vtkCocoaRenderWindow(); 00281 ~vtkCocoaRenderWindow(); 00282 00283 void CreateGLContext(); 00284 00285 void CreateAWindow(); 00286 void DestroyWindow(); 00287 void DestroyOffScreenWindow(); 00288 00289 int OffScreenInitialized; 00290 int OnScreenInitialized; 00291 00293 00295 void SetCocoaManager(void *manager); 00296 void *GetCocoaManager(); 00298 00299 void SetCocoaServer(void *server); // Really a vtkCocoaServer* 00300 void *GetCocoaServer(); 00301 00302 private: 00303 vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented. 00304 void operator=(const vtkCocoaRenderWindow&); // Not implemented. 00305 00306 private: 00307 // Important: this class cannot contain Objective-C instance 00308 // variables for 2 reasons: 00309 // 1) C++ files include this header 00310 // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new) 00311 // Instead, use the CocoaManager dictionary to keep a collection 00312 // of what would otherwise be Objective-C instance variables. 00313 void *CocoaManager; // Really an NSMutableDictionary* 00314 00315 int WindowCreated; 00316 int ViewCreated; 00317 int CursorHidden; 00318 00319 int ForceMakeCurrent; 00320 char *Capabilities; 00321 }; 00322 00323 #endif