X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd0b170911637899ac3c126367ee5821f357c185..342751763793b5cdad252d731aac0618d0674e5b:/src/msw/combobox.cpp diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index d4ec3f017a..8d6d7eada7 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -72,7 +72,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& name) { SetName(name); +#if wxUSE_VALIDATORS SetValidator(validator); +#endif // wxUSE_VALIDATORS if (parent) parent->AddChild(this); // SetBackgroundColour(parent->GetBackgroundColour()) ; @@ -325,11 +327,31 @@ void wxComboBox::SetSelection(long from, long to) #endif } -void wxComboBox::DoSetSize(int x, int y, - int width, int height, - int sizeFlags) +void wxComboBox::DoMoveWindow(int x, int y, int width, int height) { - wxControl::DoSetSize(x, y, width, height, sizeFlags); + int cx, cy; + wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + + int n = GetCount(); + if ( !n ) + n = 10; + + height = n * EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); + + wxControl::DoMoveWindow(x, y, width, height); +} + +wxSize wxComboBox::DoGetBestSize() const +{ + // the choice calculates the horz size correctly, but not the vertical + // component: correct it + wxSize size = wxChoice::DoGetBestSize(); + + int cx, cy; + wxGetCharSize(GetHWND(), &cx, &cy, &GetFont()); + size.y = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy); + + return size; } #endif