+wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const
+{
+ int cHeight = GetCharHeight();
+
+ // We are interested in the difference of sizes between the whole control
+ // and its child part. I.e. arrow, separators, etc.
+ wxSize tsize(xlen, 0);
+
+ // FIXME-VC6: Only VC6 needs this guard, see WINVER definition in
+ // include/wx/msw/wrapwin.h
+#if defined(WINVER) && WINVER >= 0x0500
+ WinStruct<COMBOBOXINFO> info;
+ if ( MSWGetComboBoxInfo(&info) )
+ {
+ tsize.x += info.rcItem.left + info.rcButton.right - info.rcItem.right
+ + info.rcItem.left + 3; // right and extra margins
+ }
+ else // Just use some rough approximation.
+#endif // WINVER >= 0x0500
+ {
+ tsize.x += 4*cHeight;
+ }
+
+ // set height on our own
+ if( HasFlag( wxCB_SIMPLE ) )
+ tsize.y = SetHeightSimpleComboBox(GetCount());
+ else
+ tsize.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cHeight);
+
+ // Perhaps the user wants something different from CharHeight
+ if ( ylen > 0 )
+ tsize.IncBy(0, ylen - cHeight);
+
+ return tsize;
+}
+