]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/gdi.i
compilation fix
[wxWidgets.git] / wxPython / src / gdi.i
index 697de042fa7c209cbaad9c722410a4c1b1abd2a8..a8d6dd79bc5a9a756ce1ed4f1031ee2b265004bb 100644 (file)
@@ -643,6 +643,25 @@ public:
 
     %addmethods {
         void Append(const wxString& name, int red, int green, int blue) {
+            // first see if the name is already there
+            wxString cName = name;
+            cName.MakeUpper();
+            wxString cName2 = cName;
+            if ( !cName2.Replace("GRAY", "GREY") )
+                cName2.clear();
+
+            wxNode *node = self->First();
+            while ( node ) {
+                const wxChar *key = node->GetKeyString();
+                if ( cName == key || cName2 == key ) {
+                    wxColour* c = (wxColour *)node->Data();
+                    c->Set(red, green, blue);
+                    return;
+                }
+                node = node->Next();
+            }
+
+            // otherwise append the new colour
             self->Append(name.c_str(), new wxColour(red, green, blue));
         }
     }
@@ -1148,7 +1167,7 @@ public:
 //---------------------------------------------------------------------------
 
 
-#ifdef __WXMSW__
+#ifndef __WXGTK__
 
 %{
 #include <wx/metafile.h>