+ msflags |= WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS;
+ // if ( style & wxCLIP_CHILDREN )
+ // msflags |= WS_CLIPCHILDREN;
+ msflags |= WS_CLIPCHILDREN;
+
+ bool want3D;
+ WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D);
+
+ // Even with extended styles, need to combine with WS_BORDER
+ // for them to look right.
+ if ( want3D || (m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER ) ||
+ (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))
+ {
+ 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;
+ }
+
+ MSWCreate(m_windowId, parent, wxGLCanvasClassName, this, NULL,
+ pos.x, pos.y,
+ WidthDefault(size.x), HeightDefault(size.y),
+ msflags, NULL, exStyle);
+
+ return TRUE;
+}
+
+void wxGLCanvas::SetupPixelFormat(int *attribList) // (HDC hDC)
+{
+ int pixelFormat;
+ PIXELFORMATDESCRIPTOR pfd = {
+ sizeof(PIXELFORMATDESCRIPTOR), /* size */
+ 1, /* version */
+ PFD_SUPPORT_OPENGL |
+ PFD_DRAW_TO_WINDOW |
+ PFD_DOUBLEBUFFER, /* support double-buffering */
+ PFD_TYPE_RGBA, /* color type */
+ 16, /* prefered color depth */
+ 0, 0, 0, 0, 0, 0, /* color bits (ignored) */
+ 0, /* no alpha buffer */
+ 0, /* alpha bits (ignored) */
+ 0, /* no accumulation buffer */
+ 0, 0, 0, 0, /* accum bits (ignored) */
+ 16, /* depth buffer */
+ 0, /* no stencil buffer */
+ 0, /* no auxiliary buffers */
+ PFD_MAIN_PLANE, /* main layer */
+ 0, /* reserved */
+ 0, 0, 0, /* no layer, visible, damage masks */
+ };
+
+ if (attribList) {
+ pfd.dwFlags &= ~PFD_DOUBLEBUFFER;
+ pfd.iPixelType = PFD_TYPE_COLORINDEX;
+ pfd.cColorBits = 0;
+ int arg=0;
+
+ while( (attribList[arg]!=0) )
+ {
+ switch( attribList[arg++] )
+ {
+ case WX_GL_RGBA:
+ pfd.iPixelType = PFD_TYPE_RGBA;
+ break;
+ case WX_GL_BUFFER_SIZE:
+ pfd.cColorBits = attribList[arg++];
+ break;
+ case WX_GL_LEVEL:
+ // this member looks like it may be obsolete
+ if (attribList[arg] > 0) {
+ pfd.iLayerType = PFD_OVERLAY_PLANE;
+ } else if (attribList[arg] < 0) {
+ pfd.iLayerType = PFD_UNDERLAY_PLANE;
+ } else {
+ pfd.iLayerType = PFD_MAIN_PLANE;
+ }
+ arg++;
+ break;
+ case WX_GL_DOUBLEBUFFER:
+ pfd.dwFlags |= PFD_DOUBLEBUFFER;
+ break;
+ case WX_GL_STEREO:
+ pfd.dwFlags |= PFD_STEREO;
+ break;
+ case WX_GL_AUX_BUFFERS:
+ pfd.cAuxBuffers = attribList[arg++];
+ break;
+ case WX_GL_MIN_RED:
+ pfd.cColorBits += (pfd.cRedBits = attribList[arg++]);
+ break;
+ case WX_GL_MIN_GREEN:
+ pfd.cColorBits += (pfd.cGreenBits = attribList[arg++]);
+ break;
+ case WX_GL_MIN_BLUE:
+ pfd.cColorBits += (pfd.cBlueBits = attribList[arg++]);
+ break;
+ case WX_GL_MIN_ALPHA:
+ // doesn't count in cColorBits
+ pfd.cAlphaBits = attribList[arg++];
+ break;
+ case WX_GL_DEPTH_SIZE:
+ pfd.cDepthBits = attribList[arg++];
+ break;
+ case WX_GL_STENCIL_SIZE:
+ pfd.cStencilBits = attribList[arg++];
+ break;
+ case WX_GL_MIN_ACCUM_RED:
+ pfd.cAccumBits += (pfd.cAccumRedBits = attribList[arg++]);
+ break;
+ case WX_GL_MIN_ACCUM_GREEN:
+ pfd.cAccumBits += (pfd.cAccumGreenBits = attribList[arg++]);
+ break;
+ case WX_GL_MIN_ACCUM_BLUE:
+ pfd.cAccumBits += (pfd.cAccumBlueBits = attribList[arg++]);
+ break;
+ case WX_GL_MIN_ACCUM_ALPHA:
+ pfd.cAccumBits += (pfd.cAccumAlphaBits = attribList[arg++]);
+ break;
+ default:
+ break;
+ }