Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

Rendering/vtkCocoaRenderWindow.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCocoaRenderWindow.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00038 #ifndef __vtkCocoaRenderWindow_h
00039 #define __vtkCocoaRenderWindow_h
00040 
00041 #include "vtkOpenGLRenderWindow.h"
00042 #include <OpenGL/gl.h> // Needed for types used in public interface
00043 
00044 class vtkIdList;
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(void);
00055 
00057   virtual void Frame(void);
00058 
00060   virtual void WindowConfigure(void);
00061 
00063   virtual void WindowInitialize(void);
00064 
00066   virtual void Initialize(void);
00067 
00069   virtual void SetFullScreen(int);
00070 
00072   virtual void WindowRemap(void);
00073 
00075   virtual void PrefFullScreen(void);
00076 
00078   virtual void SetSize(int,int);
00079 
00081   virtual int *GetSize();
00082 
00084   virtual void SetPosition(int,int);
00085   
00087   virtual int *GetScreenSize();
00088 
00090   virtual int *GetPosition();
00091 
00094   virtual void SetWindowName(const char *);
00095   
00097   virtual void SetWindowInfo(void *);
00098 
00099   //BTX
00100   virtual void *GetGenericDisplayId() {return (void *)this->ContextId;};
00101   virtual void *GetGenericWindowId()  {return (void *)this->WindowId;};
00102   virtual void *GetGenericContext()   {return (void *)this->DeviceContext;};
00103   virtual void SetDisplayId(void *) {};
00104   virtual void SetParentId(void *) 
00105     {
00106       vtkWarningMacro("Method not implemented.");
00107     }
00108   virtual void* GetGenericParentId()
00109     {
00110       vtkWarningMacro("Method not implemented.");
00111       return 0;
00112     }
00113   virtual void* GetGenericDrawable()
00114     {
00115       vtkWarningMacro("Method not implemented.");
00116       return 0;
00117     }
00118   virtual void SetWindowInfo(char*)
00119     {
00120       vtkWarningMacro("Method not implemented.");
00121     }
00122   virtual void SetParentInfo(char*)
00123     {
00124       vtkWarningMacro("Method not implemented.");
00125     }
00126 
00128   virtual void *GetWindowId();
00129 
00131   virtual void  SetWindowId(void *);
00132   
00133   void  SetContextId(void *);   // hsr
00134   void  SetDeviceContext(void *);       // hsr
00135 
00136   //ETX
00137 
00138   // supply base class virtual function
00139   vtkSetMacro(MultiSamples,int);
00140   vtkGetMacro(MultiSamples,int);
00141 
00143   virtual void StereoUpdate();
00144   
00149   virtual void SetStereoCapableWindow(int capable);
00150 
00152   virtual void MakeCurrent();
00153 
00155   const char *ReportCapabilities();
00156 
00158   int SupportsOpenGL();
00159 
00161   int IsDirect();
00162 
00166   virtual void SetForceMakeCurrent();
00167 
00170   virtual  int GetEventPending();
00171 
00179   virtual void OpenGLInit();
00180   virtual void SetupPalette(void *hDC);
00181   virtual void SetupPixelFormat(void *hDC, void *dwFlags, int debug, 
00182                                 int bpp=16, int zbpp=16);
00184   
00186   void Clean();
00187 
00189   void RegisterTextureResource (GLuint id);
00190 
00192   int GetDepthBufferSize();
00193 
00195 
00197   virtual void HideCursor();
00198   virtual void ShowCursor();
00200   
00201   void UpdateSizeAndPosition(int xPos, int yPos, int xSize, int ySize);
00202 
00203   
00204 protected:
00205   vtkCocoaRenderWindow();
00206   ~vtkCocoaRenderWindow();
00207 
00208   int       ApplicationInitialized; //NSApplication called?
00209   void     *ContextId;
00210   void     *DeviceContext;
00211   void     *WindowId;
00212   void     *WindowController;
00213   int       OwnWindow;
00214   int       ScreenSize[2];
00215   int       MultiSamples;
00216   vtkIdList *TextureResourceIds;
00217 
00218   int GetPixelData(int x,int y,int x2,int y2,int front, unsigned char* data);
00219   int GetZbufferData( int x1, int y1, int x2, int y2, float* z );
00220   int GetRGBAPixelData(int x,int y,int x2,int y2, int front, float* data);
00221   int GetRGBACharPixelData(int x,int y,int x2,int y2, int front,
00222                            unsigned char* data);
00223 
00224   // the following is used to support rendering into memory
00225 //  void *MemoryDataHeader;
00226 //  void *MemoryBuffer;
00227 //  unsigned char *MemoryData;  // the data in the DIBSection
00228 //  void *MemoryHdc;
00229 
00230   int ScreenMapped;
00231   int ScreenWindowSize[2];
00232   void *ScreenDeviceContext;
00233   int ScreenDoubleBuffer;
00234   void *ScreenContextId;
00235 
00236   int CursorHidden;
00237   int ForceMakeCurrent;
00238 
00239   char *Capabilities;
00240 
00241 private:
00242   vtkCocoaRenderWindow(const vtkCocoaRenderWindow&);  // Not implemented.
00243   void operator=(const vtkCocoaRenderWindow&);  // Not implemented.
00244 };
00245 
00246 #endif