]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/private/textmeasure.h
Revert wxDO_LOG_IF_ENABLED() change for MSVC6 in r74735.
[wxWidgets.git] / include / wx / private / textmeasure.h
index 4788c992eda29c2ca3a55bb7356065538519396e..69fbf85ab290a6483fed9d226c70b02cfc248699 100644 (file)
@@ -3,7 +3,6 @@
 // Purpose:     declaration of wxTextMeasure class
 // Author:      Manuel Martin
 // Created:     2012-10-05
-// RCS-ID:      $Id:
 // Copyright:   (c) 1997-2012 wxWidgets team
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -75,6 +74,9 @@ public:
     virtual void BeginMeasuring() { }
     virtual void EndMeasuring() { }
 
+    // This is another method which is only used by MeasuringGuard.
+    bool IsUsingDCImpl() const { return m_useDCImpl; }
+
 protected:
     // RAII wrapper for the two methods above.
     class MeasuringGuard
@@ -82,12 +84,16 @@ protected:
     public:
         MeasuringGuard(wxTextMeasureBase& tm) : m_tm(tm)
         {
-            m_tm.BeginMeasuring();
+            // BeginMeasuring() should only be called if we have a native DC,
+            // so don't call it if we delegate to a DC of unknown type.
+            if ( !m_tm.IsUsingDCImpl() )
+                m_tm.BeginMeasuring();
         }
 
         ~MeasuringGuard()
         {
-            m_tm.EndMeasuring();
+            if ( !m_tm.IsUsingDCImpl() )
+                m_tm.EndMeasuring();
         }
 
     private: