]> git.saurik.com Git - wxWidgets.git/commitdiff
marked FindColour() as deprecated; removed AddColour() which was only used internally
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Nov 2003 13:41:12 +0000 (13:41 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Nov 2003 13:41:12 +0000 (13:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gdicmn.h
src/common/gdicmn.cpp

index 9002d14e11e138bc5fd27c6a141b5559c864f4f5..a03e1d77fe897ac68ba2a857076ddc525e6b6c3c 100644 (file)
@@ -426,9 +426,8 @@ public:
     // add a new colour to the database
     void AddColour(const wxString& name, const wxColour& colour);
 
-    // deprecated, use Find()/Add() instead
-    wxColour *FindColour(const wxString& name);
-    void AddColour(const wxString& name, wxColour *colour);
+    // deprecated, use Find() instead
+    wxDEPRECATED( wxColour *FindColour(const wxString& name) );
 
 
 #ifdef __WXPM__
index 01273b854b44b5bed8dd3edd36cf9e069cecaf15..47ffe0393b81e4eaa77fca10418bd946181c3763 100644 (file)
@@ -473,18 +473,21 @@ wxString wxColourDatabase::FindName(const wxColour& colour) const
 
 wxColour *wxColourDatabase::FindColour(const wxString& name)
 {
-    wxColour col = Find(name);
-    if ( !col.Ok() )
+    // using a static variable here is not the most elegant solution but unless
+    // we want to make wxStringToColourHashMap public (i.e. move it to the
+    // header) so that we could have a member function returning
+    // wxStringToColourHashMap::iterator, there is really no good way to do it
+    // otherwise
+    //
+    // and knowing that this function is going to disappear in the next release
+    // anyhow I don't want to waste time on this
+    static wxColour s_col;
+
+    s_col = Find(name);
+    if ( !s_col.Ok() )
         return NULL;
 
-    return new wxColour(col);
-}
-
-void wxColourDatabase::AddColour(const wxString& name, wxColour *colour)
-{
-    wxCHECK_RET( colour, _T("NULL pointer in wxColourDatabase::AddColour") );
-
-    AddColour(name, wxColour(*colour));
+    return &s_col;
 }
 
 // ============================================================================