Check for existing colour names when adding to wxTheColourDatabase
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user