X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e938f5b0bffb7102fe4a3b2ba3baf7d5a067fb4..9b7e522ae97eb3d62bfb9ce6f527f1368c576e93:/src/msw/app.cpp diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 2982fd9716..d1a70a3d3c 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -69,11 +69,13 @@ #endif // OLE is used for drag-and-drop, clipboard, OLE Automation... +#ifndef wxUSE_NORLANDER_HEADERS #if defined(__GNUWIN32__) || defined(__SC__) || defined(__SALFORDC__) #undef wxUSE_OLE #define wxUSE_OLE 0 #endif // broken compilers +#endif #if wxUSE_OLE #include @@ -82,7 +84,7 @@ #include #include -#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) +#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__) || defined(wxUSE_NORLANDER_HEADERS) #include #endif @@ -108,9 +110,15 @@ MSG s_currentMsg; wxApp *wxTheApp = NULL; // FIXME why not const? and not static? + +// NB: all "NoRedraw" classes must have the same names as the "normal" classes +// with NR suffix - wxWindow::MSWCreate() supposes this wxChar wxFrameClassName[] = _T("wxFrameClass"); +wxChar wxFrameClassNameNoRedraw[] = _T("wxFrameClassNR"); wxChar wxMDIFrameClassName[] = _T("wxMDIFrameClass"); +wxChar wxMDIFrameClassNameNoRedraw[] = _T("wxMDIFrameClassNR"); wxChar wxMDIChildFrameClassName[] = _T("wxMDIChildFrameClass"); +wxChar wxMDIChildFrameClassNameNoRedraw[] = _T("wxMDIChildFrameClassNR"); wxChar wxPanelClassName[] = _T("wxPanelClass"); wxChar wxCanvasClassName[] = _T("wxCanvasClass"); @@ -204,15 +212,18 @@ bool wxApp::Initialize() #endif // __WIN95__ +#if wxUSE_OLE + +#ifdef __WIN16__ // for OLE, enlarge message queue to be as large as possible int iMsg = 96; - while (!SetMessageQueue(iMsg) && (iMsg -= 8)); - -#if wxUSE_OLE + while (!SetMessageQueue(iMsg) && (iMsg -= 8)) + ; +#endif // Win16 // we need to initialize OLE library if ( FAILED(::OleInitialize(NULL)) ) wxLogError(_("Cannot initialize OLE")); -#endif +#endif // wxUSE_OLE #if wxUSE_CTL3D if (!Ctl3dRegister(wxhInstance)) @@ -274,11 +285,15 @@ bool wxApp::RegisterWindowClasses() { WNDCLASS wndclass; + // for each class we register one with CS_(V|H)REDRAW style and one + // without for windows created with wxNO_FULL_REDRAW_ON_REPAINT flag + static const long styleNormal = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; + static const long styleNoRedraw = CS_DBLCLKS; + // the fields which are common to all classes - wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; wndclass.lpfnWndProc = (WNDPROC)wxWndProc; wndclass.cbClsExtra = 0; - wndclass.cbWndExtra = sizeof( DWORD ); // what is this DWORD used for? + wndclass.cbWndExtra = sizeof( DWORD ); // VZ: what is this DWORD used for? wndclass.hInstance = wxhInstance; wndclass.hIcon = (HICON) NULL; wndclass.hCursor = ::LoadCursor((HINSTANCE)NULL, IDC_ARROW); @@ -286,9 +301,7 @@ bool wxApp::RegisterWindowClasses() // Register the frame window class. wndclass.hbrBackground = (HBRUSH)(COLOR_APPWORKSPACE + 1); -#ifdef _MULTIPLE_INSTANCES - sprintf( wxFrameClassName,"wxFrameClass%d", wxhInstance ); -#endif + wndclass.style = styleNormal; wndclass.lpszClassName = wxFrameClassName; if ( !RegisterClass(&wndclass) ) @@ -298,9 +311,20 @@ bool wxApp::RegisterWindowClasses() return FALSE; } + // "no redraw" frame + wndclass.lpszClassName = wxFrameClassNameNoRedraw; + wndclass.style = styleNoRedraw; + + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError("RegisterClass(no redraw frame)"); + + return FALSE; + } + // Register the MDI frame window class. wndclass.hbrBackground = (HBRUSH)NULL; // paint MDI frame ourselves - wndclass.lpszClassName = wxMDIFrameClassName; + wndclass.lpszClassName = wxMDIFrameClassNameNoRedraw; if ( !RegisterClass(&wndclass) ) { @@ -309,6 +333,17 @@ bool wxApp::RegisterWindowClasses() return FALSE; } + // "no redraw" MDI frame + wndclass.lpszClassName = wxMDIFrameClassName; + wndclass.style = styleNoRedraw; + + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError("RegisterClass(no redraw MDI parent frame)"); + + return FALSE; + } + // Register the MDI child frame window class. wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndclass.lpszClassName = wxMDIChildFrameClassName; @@ -320,6 +355,17 @@ bool wxApp::RegisterWindowClasses() return FALSE; } + // "no redraw" MDI child frame + wndclass.lpszClassName = wxMDIChildFrameClassNameNoRedraw; + wndclass.style = styleNoRedraw; + + if ( !RegisterClass(&wndclass) ) + { + wxLogLastError("RegisterClass(no redraw MDI child)"); + + return FALSE; + } + // Register the panel window class. wndclass.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH ); wndclass.lpszClassName = wxPanelClassName;