]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/colrdlgg.cpp
wxTaskBarIcon::OnXXX virtual methods are deprecated, document it
[wxWidgets.git] / src / generic / colrdlgg.cpp
index 648fec1d4efcd7363d418ad3e9a0ecb3df712f93..83cae5f72b9bba0a4a53ca32b28cf2b678a61c9f 100644 (file)
@@ -9,7 +9,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "colrdlgg.h"
 #endif
 
@@ -20,7 +20,7 @@
     #pragma hdrstop
 #endif
 
-#if wxUSE_COLOURDLG
+#if wxUSE_COLOURDLG && !defined(__WXGTK20__)
 
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
@@ -143,9 +143,8 @@ void wxGenericColourDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
 
 bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data)
 {
-    if ( !wxDialog::Create(parent, -1, wxT("Colour"),
-                           wxPoint(0, 0), wxSize(900, 900),
-                           wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL) )
+    if ( !wxDialog::Create(parent, -1, _("Choose colour"),
+                           wxPoint(0, 0), wxSize(900, 900)) )
         return FALSE;
 
     dialogParent = parent;
@@ -304,16 +303,20 @@ void wxGenericColourDialog::InitializeColours(void)
 
     for (i = 0; i < WXSIZEOF(wxColourDialogNames); i++)
     {
-        wxColour *col = wxTheColourDatabase->FindColour(wxColourDialogNames[i]);
-        if (col)
-            standardColours[i].Set(col->Red(), col->Green(), col->Blue());
+        wxColour col = wxTheColourDatabase->Find(wxColourDialogNames[i]);
+        if (col.Ok())
+            standardColours[i].Set(col.Red(), col.Green(), col.Blue());
         else
             standardColours[i].Set(0, 0, 0);
     }
 
-    for (i = 0; i < 16; i++)
+    for (i = 0; i < WXSIZEOF(customColours); i++)
     {
-        customColours[i] = colourData.GetCustomColour(i);
+        wxColour c = colourData.GetCustomColour(i);
+        if (c.Ok())
+            customColours[i] = colourData.GetCustomColour(i);
+        else
+            customColours[i] = wxColour(255, 255, 255);
     }
 
     wxColour curr = colourData.GetColour();
@@ -333,13 +336,12 @@ void wxGenericColourDialog::InitializeColours(void)
         }
         if ( !initColourFound )
         {
-            for ( i = 0; i < 16; i++ )
+            for ( i = 0; i < WXSIZEOF(customColours); i++ )
             {
                 if ( customColours[i] == curr )
                 {
                     whichKind = 2;
                     colourSelection = i;
-                    initColourFound = TRUE;
                     break;
                 }
             }
@@ -566,5 +568,5 @@ void wxGenericColourDialog::OnBlueSlider(wxCommandEvent& WXUNUSED(event))
   PaintCustomColour(dc);
 }
 
-#endif // wxUSE_COLOURDLG
+#endif // wxUSE_COLOURDLG && !defined(__WXGTK20__)