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 00163 void UpdateContext(); 00164 00166 const char *ReportCapabilities(); 00167 00169 int SupportsOpenGL(); 00170 00172 int IsDirect(); 00173 00177 virtual void SetForceMakeCurrent(); 00178 00181 virtual int GetEventPending(); 00182 00184 00185 virtual void SetupPalette(void *hDC); 00186 virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 00187 int bpp=16, int zbpp=16); 00189 00191 void Finalize(); 00192 00194 int GetDepthBufferSize(); 00195 00197 00200 virtual void HideCursor(); 00201 virtual void ShowCursor(); 00202 virtual void SetCursorPosition(int x, int y); 00204 00206 virtual void SetCurrentCursor(int); 00207 00210 virtual int GetWindowCreated(); 00211 00213 00214 void SetContextId(void *); 00215 void *GetContextId(); 00216 virtual void *GetGenericContext() {return this->GetContextId();} 00218 00227 virtual void SetRootWindow(void *); 00228 00230 virtual void *GetRootWindow(); 00231 00240 virtual void SetWindowId(void *); 00241 00243 00244 virtual void *GetWindowId(); 00245 virtual void *GetGenericWindowId() {return this->GetWindowId();} 00247 00252 virtual void SetParentId(void *nsview); 00253 00255 00258 virtual void *GetParentId(); 00259 virtual void *GetGenericParentId() { return this->GetParentId(); } 00261 00263 00265 void SetPixelFormat(void *pixelFormat); 00266 void *GetPixelFormat(); 00268 00269 protected: 00270 vtkCocoaRenderWindow(); 00271 ~vtkCocoaRenderWindow(); 00272 00273 void CreateGLContext(); 00274 00275 void CreateAWindow(); 00276 void DestroyWindow(); 00277 void DestroyOffScreenWindow(); 00278 00279 int OffScreenInitialized; 00280 int OnScreenInitialized; 00281 00283 00285 void SetCocoaManager(void *manager); 00286 void *GetCocoaManager(); 00288 00289 private: 00290 vtkCocoaRenderWindow(const vtkCocoaRenderWindow&); // Not implemented. 00291 void operator=(const vtkCocoaRenderWindow&); // Not implemented. 00292 00293 private: 00294 // Important: this class cannot contain Objective-C instance 00295 // variables for 2 reasons: 00296 // 1) C++ files include this header 00297 // 2) because of garbage collection (the GC scanner does not scan objects create by C++'s new) 00298 // Instead, use the CocoaManager dictionary to keep a collection 00299 // of what would otherwise be Objective-C instance variables. 00300 void *CocoaManager; // Really an NSMutableDictionary* 00301 00302 int WindowCreated; 00303 int ViewCreated; 00304 int CursorHidden; 00305 00306 int ForceMakeCurrent; 00307 char *Capabilities; 00308 }; 00309 00310 #endif