From 5c89255496fb6226011db39f6e61b892bedb97bb Mon Sep 17 00:00:00 2001 From: David Webster Date: Fri, 5 May 2000 19:07:28 +0000 Subject: [PATCH] Some DC and Statusbar fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/dc.cpp | 34 ++++++++++++++++++++++++++++++++-- src/os2/frame.cpp | 2 +- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/os2/dc.cpp b/src/os2/dc.cpp index 2d7584d14e..63a91c8b71 100644 --- a/src/os2/dc.cpp +++ b/src/os2/dc.cpp @@ -370,9 +370,39 @@ void wxDC::SetPalette(const wxPalette& palette) // TODO } -void wxDC::SetFont(const wxFont& font) +void wxDC::SetFont( + const wxFont& rFont +) { - // TODO + // + // Set the old object temporarily, in case the assignment deletes an object + // that's not yet selected out. + // + if (m_hOldFont) + { +// ::SelectObject(GetHdc(), (HFONT) m_hOldFont); + m_hOldFont = 0; + } + + m_font = rFont; + + if (!rFont.Ok()) + { + if (m_hOldFont) +// ::SelectObject(GetHdc(), (HFONT) m_hOldFont); + m_hOldFont = 0; + } + + if (m_font.Ok() && m_font.GetResourceHandle()) + { + HFONT hFont = (HFONT)0; //::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle()); + if (hFont == (HFONT) NULL) + { + wxLogDebug(wxT("::SelectObject failed in wxDC::SetFont.")); + } + if (!m_hOldFont) + m_hOldFont = (WXHFONT) hFont; + } } void wxDC::SetPen(const wxPen& pen) diff --git a/src/os2/frame.cpp b/src/os2/frame.cpp index 5c2bd32aa8..fe19a3d024 100644 --- a/src/os2/frame.cpp +++ b/src/os2/frame.cpp @@ -490,7 +490,7 @@ wxStatusBar* wxFrame::OnCreateStatusBar( vError = ::WinGetLastError(vHabmain); sError = wxPMErrorToStr(vError); wxLogError("Error setting parent for statusbar. Error: %s\n", sError); -// return NULL; + return NULL; } //