X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ec376c8fd9ff813392030426acd2317c6fa6527e..d6f2a8911e509fd9e61f881cc881a97f5aa05ae8:/src/generic/clrpickerg.cpp diff --git a/src/generic/clrpickerg.cpp b/src/generic/clrpickerg.cpp index c6fc40bb4b..717b1811ae 100644 --- a/src/generic/clrpickerg.cpp +++ b/src/generic/clrpickerg.cpp @@ -24,11 +24,10 @@ #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) @@ -73,10 +70,11 @@ bool wxGenericColourButton::Create( wxWindow *parent, wxWindowID id, void wxGenericColourButton::InitColourData() { ms_data.SetChooseFull(true); - for (int i = 0; i < 16; i++) + unsigned char grey = 0; + for (int i = 0; i < 16; i++, grey += 16) { // fill with grey tones the custom colors palette - wxColour colour(i*16, i*16, i*16); + wxColour colour(grey, grey, grey); ms_data.SetCustomColour(i, colour); } } @@ -119,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