git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27628 
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
 \func{}{wxColourDialog}{\param{wxWindow* }{parent}, \param{wxColourData* }{data = NULL}}
 
 Constructor. Pass a parent window, and optionally a pointer to a block of colour
 \func{}{wxColourDialog}{\param{wxWindow* }{parent}, \param{wxColourData* }{data = NULL}}
 
 Constructor. Pass a parent window, and optionally a pointer to a block of colour
-data, which will be copied to the colour dialog's colour data.
+data, which will be copied to the colour dialog's colour data. Custom
+colours from colour data object will be be used in dialog's colour palette.
+Invalid entries in custom colours list will be ignored on some platforms (GTK)
+or replaced with white colour on platforms where custom colours palette has
+fixed size (MSW).
 
 
 \func{}{wxColourData}{\void}
 
 
 \func{}{wxColourData}{\void}
 
-Constructor. Initializes the custom colours to white, the {\it data colour} setting
+Constructor. Initializes the custom colours to {\tt wxNullColour},
+the {\it data colour} setting
 to black, and the {\it choose full} setting to true.
 
 
 to black, and the {\it choose full} setting to true.
 
 
 Gets the {\it i}th custom colour associated with the colour dialog. {\it i} should
 be an integer between 0 and 15.
 
 Gets the {\it i}th custom colour associated with the colour dialog. {\it i} should
 be an integer between 0 and 15.
 
-The default custom colours are all white.
+The default custom colours are invalid colours.
 
 
 \membersection{wxColourData::SetChooseFull}\label{wxcolourdatasetchoosefull}
 
 
 \membersection{wxColourData::SetChooseFull}\label{wxcolourdatasetchoosefull}
 Sets the {\it i}th custom colour for the colour dialog. {\it i} should
 be an integer between 0 and 15.
 
 Sets the {\it i}th custom colour for the colour dialog. {\it i} should
 be an integer between 0 and 15.
 
-The default custom colours are all white.
+The default custom colours are invalid colours.
 
 
 \membersection{wxColourData::operator $=$}\label{wxcolourdataassign}
 
 
 \membersection{wxColourData::operator $=$}\label{wxcolourdataassign}
 
 
 wxColourData::wxColourData()
 {
 
 wxColourData::wxColourData()
 {
-    int i;
-    for (i = 0; i < 16; i++)
-        m_custColours[i].Set(255, 255, 255);
-
-    m_chooseFull = FALSE;
+    // m_custColours are wxNullColours initially
 }
 
 wxColourData::wxColourData(const wxColourData& data)
 }
 
 wxColourData::wxColourData(const wxColourData& data)
 
 void wxColourData::SetCustomColour(int i, const wxColour& colour)
 {
 
 void wxColourData::SetCustomColour(int i, const wxColour& colour)
 {
-    if (i > 15 || i < 0)
-        return;
+    wxCHECK_RET( (i >= 0 && i < 16), _T("custom colour index out of range") );
 
     m_custColours[i] = colour;
 }
 
 wxColour wxColourData::GetCustomColour(int i)
 {
 
     m_custColours[i] = colour;
 }
 
 wxColour wxColourData::GetCustomColour(int i)
 {
-    if (i > 15 || i < 0)
-        return wxColour(0,0,0);
+    wxCHECK_MSG( (i >= 0 && i < 16), wxColour(0,0,0),
+                 _T("custom colour index out of range") );
 
     return m_custColours[i];
 }
 
     return m_custColours[i];
 }
 
 
     int i;
     for (i = 0; i < 16; i++)
 
     int i;
     for (i = 0; i < 16; i++)
-      custColours[i] = wxColourToRGB(m_colourData.m_custColours[i]);
+    {
+        if (m_colourData.m_custColours[i].Ok())
+            custColours[i] = wxColourToRGB(m_colourData.m_custColours[i]);
+        else
+            custColours[i] = RGB(255,255,255);
+    }
 
     chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR);
     if ( m_parent )
 
     chooseColorStruct.lStructSize = sizeof(CHOOSECOLOR);
     if ( m_parent )