]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/clrpickerg.cpp
wxchar.h doesn't have to be C file anymore, it's C++
[wxWidgets.git] / src / generic / clrpickerg.cpp
index e0db6bbb012be62eb19d0452f7939f1621de44de..717b1811ae0700abe188fd2eedc487f06d30b7f7 100644 (file)
     #pragma hdrstop
 #endif
 
-#ifndef WX_PRECOMP
-    #include "wx/window.h"
-#endif //WX_PRECOMP
+#if wxUSE_COLOURPICKERCTRL
 
 #include "wx/clrpicker.h"
+
 #include "wx/colordlg.h"
 
 
@@ -36,8 +35,6 @@
 // implementation
 // ============================================================================
 
-#if wxUSE_COLOURPICKERCTRL
-
 wxColourData wxGenericColourButton::ms_data;
 IMPLEMENT_DYNAMIC_CLASS(wxGenericColourButton, wxButton)
 
@@ -120,4 +117,16 @@ void wxGenericColourButton::UpdateColour()
         SetLabel(m_colour.GetAsString(wxC2S_HTML_SYNTAX));
 }
 
+wxSize wxGenericColourButton::DoGetBestSize() const
+{
+    wxSize sz(wxButton::DoGetBestSize());
+    if ( HasFlag(wxCLRP_SHOW_LABEL) )
+        return sz;
+
+    // if we have no label, then make this button a square
+    // (like e.g. native GTK version of this control)
+    sz.SetWidth(sz.GetHeight());
+    return sz;
+}
+
 #endif      // wxUSE_COLOURPICKERCTRL