X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2461cfa0d9b786a26a783237bca38c920efecb51..8f9d20d16f54a088aea5fb5e826bf1690efac2ff:/src/os2/window.cpp?ds=sidebyside diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 0db6e081e7..bac4280848 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -394,6 +394,10 @@ bool wxWindowOS2::Create( _T("wxStaticBox can't be used as a window parent!") ); #endif // wxUSE_STATBOX + // Ensure groupbox backgrounds are painted + if (IsKindOf(CLASSINFO(wxPanel))) + lStyle &= ~wxCLIP_CHILDREN; + if ( !CreateBase( pParent ,vId ,rPos @@ -583,7 +587,7 @@ void wxWindowOS2::SetTitle( const wxString& rTitle ) { - ::WinSetWindowText(GetHwnd(), rTitle.c_str()); + ::WinSetWindowText(GetHwnd(), (PSZ)rTitle.c_str()); } // end of wxWindowOS2::SetTitle wxString wxWindowOS2::GetTitle() const @@ -1623,12 +1627,19 @@ void wxWindowOS2::DoMoveWindow( ,vSwpScroll.cy - nAdjustHeight ,SWP_MOVE | SWP_SIZE ); - nYDiff += nAdjustHeight; + nYDiff -= nAdjustHeight; } MoveChildren(nYDiff); ::WinQueryWindowPos(GetHwnd(), &m_vWinSwp); } +#if 0 + // FIXME: By my logic, the next line should be needed as it moves child + // windows when resizing the parent (see comment at beginning of + // function). However, this seems to cause lots of problems. At + // least, e.g. the grid sample almost works with this line + // commented out but crashes badly with it. MoveChildren(nHeightDelta); +#endif } // end of wxWindowOS2::DoMoveWindow // @@ -1786,11 +1797,6 @@ void wxWindowOS2::DoSetClientSize( GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::DoSetClientSize -wxPoint wxWindowOS2::GetClientAreaOrigin() const -{ - return wxPoint(0, 0); -} // end of wxWindowOS2::GetClientAreaOrigin - // --------------------------------------------------------------------------- // text metrics // --------------------------------------------------------------------------- @@ -3035,9 +3041,10 @@ void wxAssociateWinWithHandle( if (pOldWin && (pOldWin != pWin)) { wxString str(pWin->GetClassInfo()->GetClassName()); - wxLogError( "Bug! Found existing HWND %X for new window of class %s" + + wxLogError( _T("Bug! Found existing HWND %X for new window of class %s") ,(int)hWnd - ,(const char*)str + ,str.c_str() ); } else if (!pOldWin) @@ -3106,7 +3113,7 @@ WXHWND wxWindowOS2::OS2GetParent() const bool wxWindowOS2::OS2Create( PSZ zClass -, const char* zTitle +, const wxChar* zTitle , WXDWORD dwStyle , const wxPoint& rPos , const wxSize& rSize @@ -3152,7 +3159,7 @@ bool wxWindowOS2::OS2Create( } m_hWnd = (WXHWND)::WinCreateWindow( (HWND)OS2GetParent() ,(PSZ)sClassName.c_str() - ,(PSZ)zTitle ? zTitle : "" + ,(PSZ)(zTitle ? zTitle : wxEmptyString) ,(ULONG)dwStyle ,(LONG)0L ,(LONG)0L @@ -3173,7 +3180,7 @@ bool wxWindowOS2::OS2Create( SubclassWin(m_hWnd); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); - m_backgroundColour.Set(wxString("GREY")); + m_backgroundColour.Set(wxString(wxT("GREY"))); LONG lColor = (LONG)m_backgroundColour.GetPixel(); @@ -3185,7 +3192,7 @@ bool wxWindowOS2::OS2Create( { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); - wxLogError("Error creating frame. Error: %s\n", sError.c_str()); + wxLogError(_T("Error creating frame. Error: %s\n"), sError.c_str()); return FALSE; } SetSize( nX @@ -3358,7 +3365,7 @@ bool wxWindowOS2::HandleShow( { wxShowEvent vEvent(GetId(), bShow); - vEvent.m_eventObject = this; + vEvent.SetEventObject(this); return GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::HandleShow @@ -3368,7 +3375,7 @@ bool wxWindowOS2::HandleInitDialog( { wxInitDialogEvent vEvent(GetId()); - vEvent.m_eventObject = this; + vEvent.SetEventObject(this); return GetEventHandler()->ProcessEvent(vEvent); } // end of wxWindowOS2::HandleInitDialog @@ -3436,7 +3443,7 @@ bool wxWindowOS2::OS2OnDrawItem( { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); - wxLogError("Unable to set current color table. Error: %s\n", sError.c_str()); + wxLogError(_T("Unable to set current color table. Error: %s\n"), sError.c_str()); } // // Set the color table to RGB mode @@ -3451,7 +3458,7 @@ bool wxWindowOS2::OS2OnDrawItem( { vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); - wxLogError("Unable to set current color table. Error: %s\n", sError.c_str()); + wxLogError(_T("Unable to set current color table. Error: %s\n"), sError.c_str()); } wxCHECK( pMenuItem->IsKindOf(CLASSINFO(wxMenuItem)), FALSE ); @@ -3673,7 +3680,7 @@ void wxWindowOS2::OnSysColourChanged( { wxSysColourChangedEvent vEvent; - rEvent.m_eventObject = pWin; + rEvent.SetEventObject(pWin); pWin->GetEventHandler()->ProcessEvent(vEvent); } node = node->GetNext(); @@ -4057,7 +4064,7 @@ void wxWindowOS2::InitMouseEvent( rEvent.m_rightDown = (::WinGetKeyState(HWND_DESKTOP, VK_BUTTON2) & 0x8000) != 0; rEvent.SetTimestamp(s_currentMsg.time); - rEvent.m_eventObject = this; + rEvent.SetEventObject(this); rEvent.SetId(GetId()); #if wxUSE_MOUSEEVENT_HACK @@ -4174,7 +4181,7 @@ wxKeyEvent wxWindowOS2::CreateKeyEvent( vEvent.m_controlDown = IsCtrlDown(); vEvent.m_altDown = (HIWORD(lParam) & KC_ALT) == KC_ALT; - vEvent.m_eventObject = (wxWindow *)this; // const_cast + vEvent.SetEventObject((wxWindow *)this); // const_cast vEvent.m_keyCode = nId; vEvent.m_rawCode = (wxUint32)wParam; vEvent.m_rawFlags = (wxUint32)lParam; @@ -4315,15 +4322,15 @@ bool wxWindowOS2::HandleKeyUp( // // Normal ASCII char // - nId = (int)wParam; + nId = CHAR1FROMMP(lParam); } if (nId != -1) { wxKeyEvent vEvent(CreateKeyEvent( wxEVT_KEY_UP ,nId - ,lParam - ,wParam + ,(MPARAM)lParam + ,(MPARAM)wParam )); if (GetEventHandler()->ProcessEvent(vEvent)) @@ -4363,32 +4370,32 @@ bool wxWindowOS2::OS2OnScroll( vEvent.SetPosition(wPos); vEvent.SetOrientation(nOrientation); - vEvent.m_eventObject = this; + vEvent.SetEventObject(this); switch (wParam) { case SB_LINEUP: - vEvent.m_eventType = wxEVT_SCROLLWIN_LINEUP; + vEvent.SetEventType(wxEVT_SCROLLWIN_LINEUP); break; case SB_LINEDOWN: - vEvent.m_eventType = wxEVT_SCROLLWIN_LINEDOWN; + vEvent.SetEventType(wxEVT_SCROLLWIN_LINEDOWN); break; case SB_PAGEUP: - vEvent.m_eventType = wxEVT_SCROLLWIN_PAGEUP; + vEvent.SetEventType(wxEVT_SCROLLWIN_PAGEUP); break; case SB_PAGEDOWN: - vEvent.m_eventType = wxEVT_SCROLLWIN_PAGEDOWN; + vEvent.SetEventType(wxEVT_SCROLLWIN_PAGEDOWN); break; case SB_SLIDERPOSITION: - vEvent.m_eventType = wxEVT_SCROLLWIN_THUMBRELEASE; + vEvent.SetEventType(wxEVT_SCROLLWIN_THUMBRELEASE); break; case SB_SLIDERTRACK: - vEvent.m_eventType = wxEVT_SCROLLWIN_THUMBTRACK; + vEvent.SetEventType(wxEVT_SCROLLWIN_THUMBTRACK); break; default: @@ -4421,6 +4428,10 @@ void wxWindowOS2::MoveChildren( ::WinQueryWindowPos( GetHwndOf(pWin) ,&vSwp ); + // Actually, only move children that already are placed on the + // frame, not ones which are still at wxDefaultCoord. + if (vSwp.y == wxDefaultCoord) + continue; if (pWin->IsKindOf(CLASSINFO(wxControl))) { wxControl* pCtrl; @@ -4625,6 +4636,8 @@ int wxCharCodeOS2ToWX( case VK_CTRL: nId = WXK_CONTROL; break; case VK_PAUSE: nId = WXK_PAUSE; break; case VK_SPACE: nId = WXK_SPACE; break; + case VK_PAGEUP: nId = WXK_PRIOR; break; + case VK_PAGEDOWN: nId = WXK_NEXT; break; case VK_ESC: nId = WXK_ESCAPE; break; case VK_END: nId = WXK_END; break; case VK_HOME : nId = WXK_HOME; break; @@ -4695,6 +4708,8 @@ int wxCharCodeWXToOS2( case WXK_SHIFT: nKeySym = VK_SHIFT; break; case WXK_CONTROL: nKeySym = VK_CTRL; break; case WXK_PAUSE: nKeySym = VK_PAUSE; break; + case WXK_PRIOR: nKeySym = VK_PAGEUP; break; + case WXK_NEXT : nKeySym = VK_PAGEDOWN; break; case WXK_END: nKeySym = VK_END; break; case WXK_HOME : nKeySym = VK_HOME; break; case WXK_LEFT : nKeySym = VK_LEFT; break;