]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textmeasure.cpp
Don't use any icon for items inserted without one in wxMSW wxListCtrl.
[wxWidgets.git] / src / msw / textmeasure.cpp
index e25eeac859327511d04d49aae9f021367b4149bf..d03a5f369acdf5d1ae79a4046f7dc92b6f7b0c25 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     wxTextMeasure implementation for wxMSW
 // Author:      Manuel Martin
 // Created:     2012-10-05
-// RCS-ID:      $Id:
 // Copyright:   (c) 1997-2012 wxWidgets team
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -69,8 +68,12 @@ void wxTextMeasure::BeginMeasuring()
         m_hdc = ::GetDC(GetHwndOf(m_win));
     }
 
-    if ( m_font )
-        m_hfontOld = (HFONT)::SelectObject(m_hdc, GetHfontOf(*m_font));
+    // We need to set the font if it's explicitly specified, of course, but
+    // also if we're associated with a window because the window HDC created
+    // above has the default font selected into it and not the font of the
+    // window.
+    if ( m_font || m_win )
+        m_hfontOld = (HFONT)::SelectObject(m_hdc, GetHfontOf(GetFont()));
 }
 
 void wxTextMeasure::EndMeasuring()
@@ -146,8 +149,11 @@ void wxTextMeasure::DoGetTextExtent(const wxString& string,
 
 bool wxTextMeasure::DoGetPartialTextExtents(const wxString& text,
                                             wxArrayInt& widths,
-                                            double WXUNUSED(scaleX))
+                                            double scaleX)
 {
+    if ( !m_hdc )
+        return wxTextMeasureBase::DoGetPartialTextExtents(text, widths, scaleX);
+
     static int maxLenText = -1;
     static int maxWidth = -1;