]> git.saurik.com Git - wxWidgets.git/commitdiff
[ 1528248 ] Fix to the width of the wxGenericColourButton
authorWłodzimierz Skiba <abx@abx.art.pl>
Tue, 25 Jul 2006 11:41:53 +0000 (11:41 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Tue, 25 Jul 2006 11:41:53 +0000 (11:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40322 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/clrpickerg.h
src/common/clrpickercmn.cpp
src/generic/clrpickerg.cpp

index dfb67c8fa9d914321088855cab85b5669ddb2069..17dc568551bf8a55723ff0d920ec88aa4ddac46a 100644 (file)
@@ -71,6 +71,8 @@ public:
 
 protected:
 
+    wxSize DoGetBestSize() const;
+
     void UpdateColour();
 
     // the colour data shown in wxColourPickerCtrlGeneric
index 75295088d8db4670743eca1af90f609c52dcb3cc..03c2f5caaabe4c2da4e1ff719541a9cd1e94b239 100644 (file)
@@ -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
index 497bfa0a017e38cf74f9026be5d5f61bdef93d4d..717b1811ae0700abe188fd2eedc487f06d30b7f7 100644 (file)
@@ -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