]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/choiccmn.cpp
Fix ribbon documentation warnings.
[wxWidgets.git] / src / common / choiccmn.cpp
index dc925335a268a8e1c4fafc11e8bbe466b19c0679..6ac940b42447b8fb0651d262a634bae949bc86ae 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Vadim Zeitlin
 // Modified by:
 // Created:     26.07.99
-// RCS-ID:      $Id$
 // Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -28,6 +27,8 @@
 
 #include "wx/choice.h"
 
+#include "wx/private/textmeasure.h"
+
 #ifndef WX_PRECOMP
 #endif
 
@@ -68,7 +69,7 @@ wxEND_FLAGS( wxChoiceStyle )
 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxChoice, wxControl, "wx/choice.h")
 
 wxBEGIN_PROPERTIES_TABLE(wxChoice)
-wxEVENT_PROPERTY( Select, wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEvent )
+wxEVENT_PROPERTY( Select, wxEVT_CHOICE, wxCommandEvent )
 
 wxPROPERTY( Font, wxFont, SetFont, GetFont , wxEMPTY_PARAMETER_VALUE, \
            0 /*flags*/, wxT("Helpstring"), wxT("group"))
@@ -103,6 +104,21 @@ wxChoiceBase::~wxChoiceBase()
     // this destructor is required for Darwin
 }
 
+wxSize wxChoiceBase::DoGetBestSize() const
+{
+    // a reasonable width for an empty choice list
+    wxSize best(80, -1);
+
+    const unsigned int nItems = GetCount();
+    if ( nItems > 0 )
+    {
+        wxTextMeasure txm(this);
+        best.x = txm.GetLargestStringExtent(GetStrings()).x;
+    }
+
+    return best;
+}
+
 // ----------------------------------------------------------------------------
 // misc
 // ----------------------------------------------------------------------------