Implement wxSpinCtrl::GetSizeFromTextSize for wxOSX/Cocoa

The value is calculated based on size of wxTextCtrl
This commit is contained in:
wangqr
2020-05-19 00:22:01 -04:00
parent dad9a02a40
commit a06fb27f21

View File

@@ -278,6 +278,10 @@ wxSize wxSpinCtrlGenericBase::DoGetBestSize() const
wxSize wxSpinCtrlGenericBase::DoGetSizeFromTextSize(int xlen, int ylen) const
{
#ifdef __WXOSX__
wxSize sizeBtn = m_spinButton->GetBestSize(), sizeText = m_textCtrl->GetSizeFromTextSize(xlen, ylen);
return wxSize(sizeBtn.GetWidth() + sizeText.GetWidth() + MARGIN, wxMax(sizeBtn.GetHeight(), sizeText.GetHeight()));
#else
wxSize sizeBtn = m_spinButton->GetBestSize();
wxSize totalS( m_textCtrl->GetBestSize() );
@@ -293,6 +297,7 @@ wxSize wxSpinCtrlGenericBase::DoGetSizeFromTextSize(int xlen, int ylen) const
tsize.IncBy(0, ylen - GetCharHeight());
return tsize;
#endif
}
void wxSpinCtrlGenericBase::DoMoveWindow(int x, int y, int width, int height)