diff --git a/include/wx/generic/clrpickerg.h b/include/wx/generic/clrpickerg.h index dfb67c8fa9..17dc568551 100644 --- a/include/wx/generic/clrpickerg.h +++ b/include/wx/generic/clrpickerg.h @@ -71,6 +71,8 @@ public: protected: + wxSize DoGetBestSize() const; + void UpdateColour(); // the colour data shown in wxColourPickerCtrlGeneric diff --git a/src/common/clrpickercmn.cpp b/src/common/clrpickercmn.cpp index 75295088d8..03c2f5caaa 100644 --- a/src/common/clrpickercmn.cpp +++ b/src/common/clrpickercmn.cpp @@ -59,7 +59,8 @@ bool wxColourPickerCtrl::Create( wxWindow *parent, wxWindowID id, // we are not interested to the ID of our picker as we connect // to its "changed" event dynamically... - m_picker = new wxColourPickerWidget(this, wxID_ANY, col, wxPoint(40,0), wxSize(30,-1), + m_picker = new wxColourPickerWidget(this, wxID_ANY, col, + wxDefaultPosition, wxDefaultSize, GetPickerStyle(style)); // complete sizer creation diff --git a/src/generic/clrpickerg.cpp b/src/generic/clrpickerg.cpp index 497bfa0a01..717b1811ae 100644 --- a/src/generic/clrpickerg.cpp +++ b/src/generic/clrpickerg.cpp @@ -117,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