]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/glcanvas.cpp
fixed compilation and added a test for OnErase() to the sample
[wxWidgets.git] / src / msw / glcanvas.cpp
index 218b4969b28c18f394b2f6d8343051d7a7e0fcf0..3d3fc51624b4445ca5985b4afd6501346e0f0800 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        glcanvas.cpp
+// Name:        src/msw/glcanvas.cpp
 // Purpose:     wxGLCanvas, for using OpenGL with wxWindows under MS Windows
 // Author:      Julian Smart
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
@@ -143,8 +143,8 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
 
   if ( ret )
   {
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-    SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
   }
 
   m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
@@ -167,8 +167,8 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent,
 
   if ( ret )
   {
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-    SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
   }
 
   m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
@@ -192,8 +192,8 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID i
 
   if ( ret )
   {
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
-    SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
+    SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
   }
 
   m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
@@ -319,14 +319,6 @@ bool wxGLCanvas::Create(wxWindow *parent,
     msflags |= WS_BORDER;
   }
 
-  // calculate the value to return from WM_GETDLGCODE handler
-  if ( GetWindowStyleFlag() & wxWANTS_CHARS )
-  {
-    // want everything: i.e. all keys and WM_CHAR message
-    m_lDlgCode = DLGC_WANTARROWS | DLGC_WANTCHARS |
-                 DLGC_WANTTAB | DLGC_WANTMESSAGE;
-  }
-
   return MSWCreate(wxGLCanvasClassName, NULL, pos, size, msflags, exStyle);
 }
 
@@ -351,11 +343,11 @@ static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList)
         case WX_GL_LEVEL:
           // this member looks like it may be obsolete
           if (attribList[arg] > 0) {
-            pfd.iLayerType = PFD_OVERLAY_PLANE;
+            pfd.iLayerType = (BYTE)PFD_OVERLAY_PLANE;
           } else if (attribList[arg] < 0) {
-            pfd.iLayerType = PFD_UNDERLAY_PLANE;
+            pfd.iLayerType = (BYTE)PFD_UNDERLAY_PLANE;
           } else {
-            pfd.iLayerType = PFD_MAIN_PLANE;
+            pfd.iLayerType = (BYTE)PFD_MAIN_PLANE;
           }
           arg++;
           break;
@@ -522,19 +514,6 @@ void wxGLCanvas::SwapBuffers()
 
 void wxGLCanvas::OnSize(wxSizeEvent& event)
 {
-  int width, height;
-  GetClientSize(& width, & height);
-
-  if (m_glContext)
-  {
-    m_glContext->SetCurrent();
-
-    glViewport(0, 0, (GLint)width, (GLint)height);
-    glMatrixMode(GL_PROJECTION);
-    glLoadIdentity();
-    glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
-    glMatrixMode(GL_MODELVIEW);
-  }
 }
 
 void wxGLCanvas::SetCurrent()
@@ -746,7 +725,7 @@ bool wxGLApp::InitGLVisual(int *attribList)
   AdjustPFDForAttributes(pfd, attribList);
 
   // use DC for whole (root) screen, since no windows have yet been created
-  pixelFormat = ChoosePixelFormat((HDC) ::GetDC(NULL), &pfd);
+  pixelFormat = ChoosePixelFormat(ScreenHDC(), &pfd);
 
   if (pixelFormat == 0) {
     wxLogError(_("Failed to initialize OpenGL"));