mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-08-17 00:47:34 +08:00
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:
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user