From 7246375492ba068a7ef0006ce6d57ecf786fffeb Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 20 Jul 2004 14:53:57 +0000 Subject: [PATCH] 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 --- src/mac/carbon/textctrl.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 645667a69b..73b7aa5dc0 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -629,30 +629,35 @@ wxSize wxTextCtrl::DoGetBestSize() const int hText; + // these are the numbers from the HIG, we reduce them by the borders + // first + switch( m_windowVariant ) { case wxWINDOW_VARIANT_NORMAL : - hText = 22 ; + hText = 22 - 6 ; break ; case wxWINDOW_VARIANT_SMALL : - hText = 19 ; + hText = 19 - 6 ; break ; case wxWINDOW_VARIANT_MINI : - hText= 15 ; + hText= 15 - 6 ; break ; default : - hText = 22 ; + hText = 22 - 6; break ; } - if ( HasFlag(wxNO_BORDER) ) - hText -= 6 ; - + // as the above numbers have some free space around the text + // we get 5 lines like this anyway if ( m_windowStyle & wxTE_MULTILINE ) { hText *= 5 ; } + if ( !HasFlag(wxNO_BORDER) ) + hText += 6 ; + return wxSize(wText, hText); } -- 2.45.2