00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
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 
00043 
00044 
00045 
00046 #include <AvailabilityMacros.h> 
00047 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1040
00048   #define scalb scalbn
00049 #endif
00050 
00051 #include <Carbon/Carbon.h> 
00052 #include <AGL/agl.h> 
00053 
00054 class vtkCarbonRenderWindowInternal;
00055 
00056 
00057 class VTK_RENDERING_EXPORT vtkCarbonRenderWindow : public vtkOpenGLRenderWindow
00058 {
00059 public:
00060   static vtkCarbonRenderWindow *New();
00061   vtkTypeMacro(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   
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   
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   
00179 
00180   
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 IsDirect();
00205   
00208   virtual  int GetEventPending();
00209 
00211   int GetDepthBufferSize();
00212 
00214 
00216   void HideCursor();
00217   void ShowCursor();
00219   
00220   void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize);
00221 
00224   void UpdateGLRegion();
00225 
00226   
00227 protected:
00228   vtkCarbonRenderWindow();
00229   ~vtkCarbonRenderWindow();
00230 
00231   vtkCarbonRenderWindowInternal* Internal;
00232 
00233   int ApplicationInitialized; 
00234   GLint aglAttributes[64];    
00235                               
00236   AGLContext ContextId;
00237   HIViewRef WindowId;
00238   HIViewRef ParentId;
00239   WindowPtr RootWindow;
00240   int OwnWindow;
00241   int ScreenSize[2];
00242 
00243   int CursorHidden;
00244   int ForceMakeCurrent;
00245 
00246 
00247   
00248   EventHandlerUPP RegionEventHandlerUPP;
00249   EventHandlerRef RegionEventHandler;
00250   static OSStatus RegionEventProcessor(EventHandlerCallRef er,
00251                                        EventRef event,
00252                                        void*);
00253 
00254   void InitializeApplication();
00255 
00256   void CreateAWindow();
00257   void DestroyWindow();
00258   
00259   void CreateOffScreenWindow(int x, int y);
00260   void DestroyOffScreenWindow();
00261   void ResizeOffScreenWindow(int x, int y);
00262 
00263 private:
00264   vtkCarbonRenderWindow(const vtkCarbonRenderWindow&);  
00265   void operator=(const vtkCarbonRenderWindow&);  
00266 };
00267 
00268 #endif