Stop using GDK functions for parsing colours names

This shouldn't be necessary now as they use the same CSS colour names
that we use too by default and like this switching to "Traditional"
colour names also changes wxGTK behaviour to use wxMSW colour values.
This commit is contained in:
Vadim Zeitlin
2024-12-16 01:26:36 +01:00
parent 027b8a2600
commit 55be0ed986
3 changed files with 7 additions and 24 deletions
-2
View File
@@ -49,8 +49,6 @@ protected:
virtual void
InitRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
virtual bool FromString(const wxString& str) override;
wxDECLARE_DYNAMIC_CLASS(wxColour);
};
+7 -1
View File
@@ -974,7 +974,13 @@ public:
wxTheColourDatabase->UseScheme(wxColourDatabase::Traditional);
@endcode
during the application initialization.
during the application initialization. Please note that in the previous
versions wxGTK already used CSS colour values, unlike all the other
ports, so @c Traditional is not actually backwards compatible for
wxGTK, but does make the colour values consistent across all platforms
and the same as had been used by wxMSW and wxOSX before. In other
words, to obtain 100% compatibility with the previous versions, the
UseScheme() call above should be made for all ports except wxGTK.
Note that the colour names defined only by wxWidgets, which notably
includes all colour variants with spaces in their names, are still
-21
View File
@@ -253,24 +253,3 @@ wxColour::operator const GdkRGBA*() const
return c;
}
#endif
bool wxColour::FromString(const wxString& str)
{
#ifdef __WXGTK3__
GdkRGBA gdkRGBA;
if (gdk_rgba_parse(&gdkRGBA, str.utf8_str()))
{
*this = wxColour(gdkRGBA);
return true;
}
#else
GdkColor colGDK;
if ( gdk_color_parse( str.utf8_str(), &colGDK ) )
{
*this = wxColour(colGDK);
return true;
}
#endif
return wxColourBase::FromString(str);
}