VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCarbonRenderWindow.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 =========================================================================*/ 00033 #ifndef __vtkCarbonRenderWindow_h 00034 #define __vtkCarbonRenderWindow_h 00035 00036 #if defined(__LP64__) && __LP64__ 00037 #error vtkCarbonRenderWindow does not work in 64 bit 00038 #endif 00039 00040 #include "vtkOpenGLRenderWindow.h" 00041 00042 // The 10.3.9 SDK (and older probably) have a bug in fp.h (in the Carbon 00043 // umbrella framework) which this works around. Without this, there 00044 // would be a compile error from the Carbon header if Python wrappings 00045 // were enabled. 00046 #include <AvailabilityMacros.h> // Needed for MAC_OS_X_VERSION_MAX_ALLOWED 00047 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040 00048 #define scalb scalbn 00049 #endif 00050 00051 #include <Carbon/Carbon.h> // Carbon and Mac specific 00052 #include <AGL/agl.h> // Carbon and Mac specific 00053 00054 class vtkCarbonRenderWindowInternal; 00055 00056 00057 class VTK_RENDERING_EXPORT vtkCarbonRenderWindow : public vtkOpenGLRenderWindow 00058 { 00059 public: 00060 static vtkCarbonRenderWindow *New(); 00061 vtkTypeRevisionMacro(vtkCarbonRenderWindow,vtkOpenGLRenderWindow); 00062 void PrintSelf(ostream& os, vtkIndent indent); 00063 00065 void Start(); 00066 00068 void Frame(); 00069 00071 virtual void WindowConfigure(); 00072 00074 virtual void WindowInitialize(); 00075 00080 virtual void Initialize(); 00081 00086 virtual void Finalize(); 00087 00089 void SetOffScreenRendering(int); 00090 00092 virtual void SetFullScreen(int); 00093 00095 virtual void WindowRemap(); 00096 00098 virtual void PrefFullScreen(); 00099 00101 00102 virtual void SetSize(int a[2]); 00103 virtual void SetSize(int,int); 00105 00107 virtual int *GetSize(); 00108 00110 00111 virtual void SetPosition(int*); 00112 virtual void SetPosition(int,int); 00114 00116 virtual int *GetScreenSize(); 00117 00119 virtual int *GetPosition(); 00120 00123 virtual void SetWindowName(const char *); 00124 00126 void SetWindowInfo(char *); 00127 00128 void SetNextWindowInfo(char *) 00129 { 00130 vtkWarningMacro("SetNextWindowInfo not implemented (WindowRemap not implemented)."); 00131 } 00132 00133 //BTX 00134 virtual void *GetGenericDisplayId() {return NULL;} 00135 virtual void *GetGenericWindowId() {return (void *)this->WindowId;} 00136 virtual void *GetGenericParentId() {return (void *)this->ParentId;} 00137 virtual AGLContext GetContextId(); 00138 virtual void *GetGenericContext() {return (void*)this->GetContextId();} 00139 virtual void SetDisplayId(void *) {} 00140 00141 virtual void* GetGenericDrawable() 00142 { 00143 vtkWarningMacro("GetGenericDrawable Method not implemented."); 00144 return 0; 00145 } 00146 00147 void SetParentInfo(char*) 00148 { 00149 vtkWarningMacro("SetParentInfo Method not implemented."); 00150 } 00151 00153 00154 virtual HIViewRef GetWindowId(); 00155 // Set the HIView window pointer. 00156 void SetWindowId(void *foo) {this->SetWindowId((HIViewRef)foo);}; 00157 void SetNextWindowId(void*) 00158 { 00159 vtkWarningMacro("SetNextWindowId not implemented (WindowRemap not implemented)."); 00160 } 00162 00164 00165 virtual void SetParentId(HIViewRef); 00166 void SetParentId(void *foo) {this->SetParentId((HIViewRef)foo);}; 00168 00170 virtual void SetWindowId(HIViewRef); 00171 00173 00174 void SetRootWindow(WindowPtr win); 00175 WindowPtr GetRootWindow(); 00177 00178 //ETX 00179 00180 // supply base class virtual function 00181 vtkSetMacro(MultiSamples,int); 00182 vtkGetMacro(MultiSamples,int); 00183 00188 virtual void SetStereoCapableWindow(int capable); 00189 00191 void MakeCurrent(); 00192 00195 virtual bool IsCurrent(); 00196 00200 void SetForceMakeCurrent(); 00201 00204 virtual int GetEventPending(); 00205 00207 int GetDepthBufferSize(); 00208 00210 00212 void HideCursor(); 00213 void ShowCursor(); 00215 00216 void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize); 00217 00220 void UpdateGLRegion(); 00221 00222 00223 protected: 00224 vtkCarbonRenderWindow(); 00225 ~vtkCarbonRenderWindow(); 00226 00227 vtkCarbonRenderWindowInternal* Internal; 00228 00229 int ApplicationInitialized; // Toolboxen initialized? 00230 GLint aglAttributes[64]; // input: pixel format attributes always required 00231 // (reset to what was actually allocated) 00232 AGLContext ContextId; 00233 HIViewRef WindowId; 00234 HIViewRef ParentId; 00235 WindowPtr RootWindow; 00236 int OwnWindow; 00237 int ScreenSize[2]; 00238 00239 int CursorHidden; 00240 int ForceMakeCurrent; 00241 00242 00243 // data and handlers to keep the GL view coincident with the HIView 00244 EventHandlerUPP RegionEventHandlerUPP; 00245 EventHandlerRef RegionEventHandler; 00246 static OSStatus RegionEventProcessor(EventHandlerCallRef er, 00247 EventRef event, 00248 void*); 00249 00250 void InitializeApplication(); 00251 00252 void CreateAWindow(); 00253 void DestroyWindow(); 00254 00255 void CreateOffScreenWindow(int x, int y); 00256 void DestroyOffScreenWindow(); 00257 void ResizeOffScreenWindow(int x, int y); 00258 00259 private: 00260 vtkCarbonRenderWindow(const vtkCarbonRenderWindow&); // Not implemented. 00261 void operator=(const vtkCarbonRenderWindow&); // Not implemented. 00262 }; 00263 00264 #endif