]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed wxSystemColourProperty::ValueToString(). It now once again properly formats...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 19 Oct 2008 11:16:29 +0000 (11:16 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 19 Oct 2008 11:16:29 +0000 (11:16 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/advprops.cpp

index 7a58087922456c1a1b6f77108f8b71f81ad8ad1f..4a18197dc44742191765926acec9e01a807bbf74 100644 (file)
@@ -1001,11 +1001,29 @@ wxString wxSystemColourProperty::ColourToString( const wxColour& col, int index
 }
 
 wxString wxSystemColourProperty::ValueToString( wxVariant& value,
-                                                int WXUNUSED(argFlags) ) const
+                                                int argFlags ) const
 {
     wxColourPropertyValue val = GetVal(&value);
 
-    return ColourToString(val.m_colour, m_choices.Index(val.m_type));
+    int index;
+
+    if ( argFlags & wxPG_VALUE_IS_CURRENT )
+    {
+        // GetIndex() only works reliably if wxPG_VALUE_IS_CURRENT flag is set,
+        // but we should use it whenever possible.
+        index = GetIndex();
+
+        // If custom colour was selected, use invalid index, so that
+        // ColourToString() will return properly formatted colour text.
+        if ( index == GetCustomColourIndex() )
+            index = wxNOT_FOUND;
+    }
+    else
+    {
+        index = m_choices.Index(val.m_type);
+    }
+
+    return ColourToString(val.m_colour, index);
 }