fixing best size to really include only 5 lines

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28330 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-07-20 14:53:57 +00:00
parent 70aaa701b4
commit 7246375492

View File

@@ -629,30 +629,35 @@ wxSize wxTextCtrl::DoGetBestSize() const
int hText; int hText;
// these are the numbers from the HIG, we reduce them by the borders
// first
switch( m_windowVariant ) switch( m_windowVariant )
{ {
case wxWINDOW_VARIANT_NORMAL : case wxWINDOW_VARIANT_NORMAL :
hText = 22 ; hText = 22 - 6 ;
break ; break ;
case wxWINDOW_VARIANT_SMALL : case wxWINDOW_VARIANT_SMALL :
hText = 19 ; hText = 19 - 6 ;
break ; break ;
case wxWINDOW_VARIANT_MINI : case wxWINDOW_VARIANT_MINI :
hText= 15 ; hText= 15 - 6 ;
break ; break ;
default : default :
hText = 22 ; hText = 22 - 6;
break ; break ;
} }
if ( HasFlag(wxNO_BORDER) ) // as the above numbers have some free space around the text
hText -= 6 ; // we get 5 lines like this anyway
if ( m_windowStyle & wxTE_MULTILINE ) if ( m_windowStyle & wxTE_MULTILINE )
{ {
hText *= 5 ; hText *= 5 ;
} }
if ( !HasFlag(wxNO_BORDER) )
hText += 6 ;
return wxSize(wText, hText); return wxSize(wText, hText);
} }