X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f3e4a2a4146a4a28fedce563f42f1e3f38462d80..8f4fcc4ee080b020057cc028a809ffc884f63bb8:/src/os2/window.cpp diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 9bc6c64ae5..96e10ba3cd 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -583,77 +583,11 @@ bool wxWindowOS2::SetFont( HWND hWnd = GetHwnd(); - if (hWnd != 0) - { - char zFont[128]; - char zFacename[30]; - char zWeight[30]; - char zStyle[30]; - - // - // The fonts available for Presentation Params are just three - // outline fonts, the rest are available to the GPI, so we must - // map the families to one of these three - // - switch(rFont.GetFamily()) - { - case wxSCRIPT: - case wxDECORATIVE: - case wxROMAN: - strcpy(zFacename,"Times New Roman"); - break; - - case wxTELETYPE: - case wxMODERN: - strcpy(zFacename, "Courier"); - break; - - case wxSWISS: - case wxDEFAULT: - default: - strcpy(zFacename, "Helvetica"); - break; - } - - switch(rFont.GetWeight()) - { - default: - case wxNORMAL: - case wxLIGHT: - zWeight[0] = '\0'; - break; - - case wxBOLD: - case wxFONTWEIGHT_MAX: - strcpy(zWeight, "Bold"); - break; - } - switch(rFont.GetStyle()) - { - case wxITALIC: - case wxSLANT: - strcpy(zStyle, "Italic"); - break; - - default: - zStyle[0] = '\0'; - break; - } - sprintf(zFont, "%d.%s", rFont.GetPointSize(), zFacename); - if (zWeight[0] != '\0') - { - strcat(zFont, " "); - strcat(zFont, zWeight); - } - if (zStyle[0] != '\0') - { - strcat(zFont, " "); - strcat(zFont, zStyle); - } - ::WinSetPresParam(hWnd, PP_FONTNAMESIZE, strlen(zFont) + 1, (PVOID)zFont); - } + wxOS2SetFont( hWnd + ,rFont + ); return(TRUE); -} +} // end of wxWindowOS2::SetFont bool wxWindowOS2::SetCursor( const wxCursor& rCursor @@ -1051,9 +985,20 @@ void wxWindowOS2::SubclassWin( { HWND hwnd = (HWND)hWnd; - wxASSERT_MSG( !m_fnOldWndProc, wxT("subclassing window twice?") ); wxCHECK_RET(::WinIsWindow(vHabmain, hwnd), wxT("invalid HWND in SubclassWin") ); - m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc); + wxAssociateWinWithHandle( hWnd + ,(wxWindow*)this + ); + if (!wxCheckWindowWndProc( hWnd + ,(WXFARPROC)wxWndProc + )) + { + m_fnOldWndProc = (WXFARPROC) ::WinSubclassWindow(hwnd, (PFNWP)wxWndProc); + } + else + { + m_fnOldWndProc = (WXFARPROC)NULL; + } } // end of wxWindowOS2::SubclassWin void wxWindowOS2::UnsubclassWin() @@ -2265,6 +2210,14 @@ bool wxWindowOS2::OS2TranslateMessage( #endif //wxUSE_ACCEL } // end of wxWindowOS2::OS2TranslateMessage +bool wxWindowOS2::OS2ShouldPreProcessMessage( + WXMSG* pMsg +) +{ + // preprocess all messages by default + return TRUE; +} // end of wxWindowOS2::OS2ShouldPreProcessMessage + // --------------------------------------------------------------------------- // message params unpackers // --------------------------------------------------------------------------- @@ -3018,17 +2971,22 @@ bool wxWindowOS2::OS2Create( // if (pParent) { - if (IsKindOf(CLASSINFO(wxStatusBar)) && - pParent->IsKindOf(CLASSINFO(wxFrame))) + if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) || + pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) + ) { - RECTL vRect; - wxFrame* pFrame = wxDynamicCast(pParent, wxFrame); + if (IsKindOf(CLASSINFO(wxStatusBar)) && + pParent->IsKindOf(CLASSINFO(wxFrame))) + { + RECTL vRect; + wxFrame* pFrame = wxDynamicCast(pParent, wxFrame); - ::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect); - nY = vRect.yTop - (nY + nHeight); + ::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect); + nY = vRect.yTop - (nY + nHeight); + } + else + nY = pParent->GetSize().y - (nY + nHeight); } - else - nY = pParent->GetSize().y - (nY + nHeight); } else { @@ -3138,6 +3096,13 @@ bool wxWindowOS2::HandleSetFocus( WXHWND WXUNUSED(hWnd) ) { + // + // Notify the parent keeping track of focus for the kbd navigation + // purposes that we got it + // + wxChildFocusEvent vEventFocus((wxWindow *)this); + (void)GetEventHandler()->ProcessEvent(vEventFocus); + #if wxUSE_CARET // // Deal with caret