]> git.saurik.com Git - wxWidgets.git/commitdiff
don't cache default colours
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 23 Jun 2004 11:52:03 +0000 (11:52 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 23 Jun 2004 11:52:03 +0000 (11:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27962 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wincmn.cpp

index e6dd55946e65ed236165c7534a38d8d97ec555ff..800de3f33bc0d0278e58c6be99f7ec02feb666c8 100644 (file)
@@ -980,11 +980,10 @@ wxColour wxWindowBase::GetBackgroundColour() const
         if ( !colBg.Ok() )
             colBg = GetClassDefaultAttributes().colBg;
 
-        // cache it for the next call
-        wxConstCast(this, wxWindowBase)->m_backgroundColour = colBg;
+        return colBg;
     }
-
-    return m_backgroundColour;
+    else
+        return m_backgroundColour;
 }
 
 wxColour wxWindowBase::GetForegroundColour() const
@@ -999,10 +998,10 @@ wxColour wxWindowBase::GetForegroundColour() const
         if ( !colFg.Ok() )
             colFg = GetClassDefaultAttributes().colFg;
 
-        wxConstCast(this, wxWindowBase)->m_foregroundColour = colFg;
+        return colFg;
     }
-
-    return m_foregroundColour;
+    else
+        return m_foregroundColour;
 }
 
 bool wxWindowBase::SetBackgroundColour( const wxColour &colour )
@@ -1042,7 +1041,7 @@ bool wxWindowBase::SetCursor(const wxCursor& cursor)
     return true;
 }
 
-wxFont& wxWindowBase::DoGetFont() const
+wxFont wxWindowBase::GetFont() const
 {
     // logic is the same as in GetBackgroundColour()
     if ( !m_font.Ok() )
@@ -1053,11 +1052,10 @@ wxFont& wxWindowBase::DoGetFont() const
         if ( !font.Ok() )
             font = GetClassDefaultAttributes().font;
 
-        wxConstCast(this, wxWindowBase)->m_font = font;
+        return font;
     }
-
-    // cast is here for non-const GetFont() convenience
-    return wxConstCast(this, wxWindowBase)->m_font;
+    else
+        return m_font;
 }
 
 bool wxWindowBase::SetFont(const wxFont& font)