Adding Borders and Multi-Line calculations also when native best size is available

Otherwise wxTE_MULTILINE are getting a tiny one-line minimal size, and the border as to be added as well.
This commit is contained in:
Stefan Csomor
2017-09-06 09:54:35 +02:00
parent d24ffcf749
commit 51e7994cff

View File

@@ -194,15 +194,21 @@ bool wxTextCtrl::AcceptsFocus() const
wxSize wxTextCtrl::DoGetBestSize() const
{
int wText = -1;
int hText = -1;
if (GetTextPeer())
{
wxSize size = GetTextPeer()->GetBestSize();
if (size.x > 0 && size.y > 0)
return size;
{
hText = size.y;
wText = size.x;
}
}
int wText, hText;
if ( hText == - 1)
{
// these are the numbers from the HIG:
// we reduce them by the borders first
wText = 100 ;
@@ -225,6 +231,7 @@ wxSize wxTextCtrl::DoGetBestSize() const
hText = 22 - 6;
break ;
}
}
// as the above numbers have some free space around the text
// we get 5 lines like this anyway