]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/colourcmn.cpp
Don't use "Cancel" button in the about dialog of the listctrl sample.
[wxWidgets.git] / src / common / colourcmn.cpp
index 965fbdcff07422f07f22ad001503807b331db824..70e4a1d9caeb53103d03062a05822ab92b547333 100644 (file)
@@ -128,7 +128,7 @@ bool wxColourBase::FromString(const wxString& str)
             // passed as first argument: if it is a wide string, then %c
             // expects "wchar_t *" matching parameter under MSW for example.
             if ( sscanf(str.c_str() + 4,
-                        formatStr,
+                        formatStr.mb_str(),
                         &red, &green, &blue, alphaPtr) != 4 )
                 return false;
 
@@ -177,13 +177,13 @@ bool wxColourBase::FromString(const wxString& str)
         // because this place can be called from constructor
         // and 'this' could not be available yet
         wxColour clr = wxTheColourDatabase->Find(str);
-        if (clr.Ok())
+        if (clr.IsOk())
             Set((unsigned char)clr.Red(),
                 (unsigned char)clr.Green(),
                 (unsigned char)clr.Blue());
     }
 
-    if (Ok())
+    if (IsOk())
         return true;
 
     wxLogDebug(wxT("wxColour::Set - couldn't set to colour string '%s'"), str);
@@ -273,6 +273,16 @@ void wxColourBase::MakeDisabled(unsigned char* r, unsigned char* g, unsigned cha
     *b = AlphaBlend(*b, brightness, 0.4);
 }
 
+wxColour& wxColourBase::MakeDisabled(unsigned char brightness)
+{
+    unsigned char r = Red(),
+                  g = Green(),
+                  b = Blue();
+    MakeDisabled(&r, &g, &b, brightness);
+    Set(r, g, b, Alpha());
+    return static_cast<wxColour&>(*this);
+}
+
 // AlphaBlend is used by ChangeLightness and MakeDisabled
 
 // static