+wxSize wxRadioBox::DoGetBestSize() const
+{
+ int charWidth, charHeight;
+ int maxWidth, maxHeight;
+ int eachWidth, eachHeight;
+ int totWidth, totHeight;
+
+ wxFont font = GetParent()->GetFont();
+ GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+ &charWidth, &charHeight, NULL, NULL, &font);
+
+ charWidth /= 52;
+
+ maxWidth = -1;
+ maxHeight = -1;
+
+ for (int i = 0 ; i < m_noItems; i++)
+ {
+ GetTextExtent(GetString(i), &eachWidth, &eachHeight,NULL, NULL, &font);
+ eachWidth = (int)(eachWidth + RADIO_SIZE) ;
+ eachHeight = (int)((3 * eachHeight) / 2);
+ if (maxWidth < eachWidth) maxWidth = eachWidth;
+ if (maxHeight < eachHeight) maxHeight = eachHeight;
+ }
+
+ totHeight = GetRowCount() * (maxHeight ) ;
+ totWidth = GetColumnCount() * (maxWidth + charWidth) ;
+
+ wxSize sz = DoGetSizeFromClientSize( wxSize( totWidth , totHeight ) ) ;
+ totWidth = sz.x ;
+ totHeight = sz.y ;
+
+ // handle radio box title as well
+ GetTextExtent(GetTitle(), &eachWidth, NULL);
+ eachWidth = (int)(eachWidth + RADIO_SIZE) + 3 * charWidth ;
+ if (totWidth < eachWidth)
+ totWidth = eachWidth;
+
+ return wxSize(totWidth, totHeight);
+}