+ height = h + r.bottom - r.top;
+ }
+ }
+
+ wxControl::DoSetSize(x, y, width, height, sizeFlags);
+
+ // If we're storing a pending size, make sure we store
+ // the original size for reporting back to the app.
+ if (m_pendingSize != wxDefaultSize)
+ m_pendingSize = wxSize(width, heightOrig);
+
+ // This solution works on XP, but causes choice/combobox lists to be
+ // too short on W2K and earlier.
+#if 0
+ int widthCurrent, heightCurrent;
+ DoGetSize(&widthCurrent, &heightCurrent);
+
+ // the height which we must pass to Windows should be the total height of
+ // the control including the drop down list while the height given to us
+ // is, of course, just the height of the permanently visible part of it
+ if ( height != wxDefaultCoord && height != heightCurrent )
+ {
+ // don't make the drop down list too tall, arbitrarily limit it to 40
+ // items max and also don't leave it empty
+ unsigned int nItems = GetCount();
+ if ( !nItems )
+ nItems = 9;
+ else if ( nItems > 24 )
+ nItems = 24;
+
+ // add space for the drop down list
+ const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0);
+ height += hItem*(nItems + 1);
+ }
+ else // keep the same height as now
+ {
+ // normally wxWindow::DoSetSize() checks if we set the same size as the
+ // window already has and does nothing in this case, but for us the
+ // check fails as the size we pass to it includes the dropdown while
+ // the size returned by our GetSize() does not, so test if the size
+ // didn't really change ourselves here
+ if ( width == wxDefaultCoord || width == widthCurrent )
+ {
+ // size doesn't change, what about position?
+ int xCurrent, yCurrent;
+ DoGetPosition(&xCurrent, &yCurrent);
+ const bool defMeansUnchanged = !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE);
+ if ( ((x == wxDefaultCoord && defMeansUnchanged) || x == xCurrent)
+ &&
+ ((y == wxDefaultCoord && defMeansUnchanged) || y == yCurrent) )
+ {
+ // nothing changes, nothing to do
+ return;
+ }
+ }
+
+ // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses
+ // wxGetWindowRect() to determine the current height of the combobox,
+ // and then again sets the combobox's height to that value. Unfortunately,
+ // wxGetWindowRect doesn't include the dropdown list's height (at least
+ // on Win2K), so this would result in a combobox with dropdown height of
+ // 1 pixel. We have to determine the default height ourselves and call
+ // wxControl with that value instead.
+ //
+ // Also notice that sometimes CB_GETDROPPEDCONTROLRECT seems to return
+ // wildly incorrect values (~32000) which looks like a bug in it, just
+ // ignore them in this case
+ RECT r;
+ if ( ::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r)
+ && r.bottom < 30000 )
+ {
+ height = heightCurrent + r.bottom - r.top;