X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf82560a388abc8433f6ab34b12ef8e11aa1a7f4..2ccd2adc16c3678645a0af616f91a88e1649c8d5:/src/generic/grideditors.cpp diff --git a/src/generic/grideditors.cpp b/src/generic/grideditors.cpp index 835ca10e71..6af6ad1462 100644 --- a/src/generic/grideditors.cpp +++ b/src/generic/grideditors.cpp @@ -1414,6 +1414,29 @@ void wxGridCellChoiceEditor::Create(wxWindow* parent, wxGridCellEditor::Create(parent, id, evtHandler); } +void wxGridCellChoiceEditor::SetSize(const wxRect& rect) +{ + wxASSERT_MSG(m_control, + wxT("The wxGridCellChoiceEditor must be created first!")); + + // Check that the height is not too small to fit the combobox. + wxRect rectTallEnough = rect; + const wxSize bestSize = m_control->GetBestSize(); + const wxCoord diffY = bestSize.GetHeight() - rectTallEnough.GetHeight(); + if ( diffY > 0 ) + { + // Do make it tall enough. + rectTallEnough.height += diffY; + + // Also centre the effective rectangle vertically with respect to the + // original one. + rectTallEnough.y -= diffY/2; + } + //else: The rectangle provided is already tall enough. + + wxGridCellEditor::SetSize(rectTallEnough); +} + void wxGridCellChoiceEditor::PaintBackground(const wxRect& rectCell, wxGridCellAttr * attr) {