]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/glcanvas/msw/myglcanvas.cpp
fixed wxBase and GUI separation for sockets code
[wxWidgets.git] / wxPython / contrib / glcanvas / msw / myglcanvas.cpp
index a888a64f383fa3799aae71106538bf015e2139d3..59157560fa56d58abdf4ad878c2c29436c884ecd 100644 (file)
 #if wxUSE_GLCANVAS
 
 #ifndef WX_PRECOMP
-#include <wx/frame.h>
+    #include "wx/frame.h"
+    #include "wx/settings.h"
+    #include "wx/intl.h"
+    #include "wx/log.h"
 #endif
 
-#include <wx/msw/private.h>
-#include <wx/settings.h>
-#include <wx/log.h>
+#include "wx/msw/private.h"
 
 #include "myglcanvas.h"
 
+const wxChar* wxGLCanvasName = wxT("GLcanvas");
 static const wxChar *wxGLCanvasClassName = wxT("wxGLCanvasClass");
 static const wxChar *wxGLCanvasClassNameNoRedraw = wxT("wxGLCanvasClassNR");
 
@@ -108,7 +110,7 @@ void wxGLContext::SetCurrent()
   */
 }
 
-void wxGLContext::SetColour(const char *colour)
+void wxGLContext::SetColour(const wxChar *colour)
 {
   float r = 0.0;
   float g = 0.0;
@@ -322,14 +324,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);
 }
 
@@ -354,11 +348,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;
@@ -411,7 +405,6 @@ static void AdjustPFDForAttributes(PIXELFORMATDESCRIPTOR& pfd, int *attribList)
 
 void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
 {
-  int pixelFormat;
   PIXELFORMATDESCRIPTOR pfd = {
         sizeof(PIXELFORMATDESCRIPTOR),    /* size */
         1,                /* version */
@@ -435,13 +428,13 @@ void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
 
   AdjustPFDForAttributes(pfd, attribList);
 
-  pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
+  int pixelFormat = ChoosePixelFormat((HDC) m_hDC, &pfd);
   if (pixelFormat == 0) {
-    wxLogWarning(_("ChoosePixelFormat failed."));
+    wxLogLastError(_T("ChoosePixelFormat"));
   }
   else {
-    if (SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) != TRUE) {
-      wxLogWarning(_("SetPixelFormat failed."));
+    if ( !::SetPixelFormat((HDC) m_hDC, pixelFormat, &pfd) ) {
+      wxLogLastError(_T("SetPixelFormat"));
     }
   }
 }
@@ -535,7 +528,7 @@ void wxGLCanvas::SetCurrent()
   }
 }
 
-void wxGLCanvas::SetColour(const char *colour)
+void wxGLCanvas::SetColour(const wxChar *colour)
 {
   if (m_glContext)
     m_glContext->SetColour(colour);
@@ -736,7 +729,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"));