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:
@@ -194,36 +194,43 @@ bool wxTextCtrl::AcceptsFocus() const
|
|||||||
|
|
||||||
wxSize wxTextCtrl::DoGetBestSize() const
|
wxSize wxTextCtrl::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
|
int wText = -1;
|
||||||
|
int hText = -1;
|
||||||
|
|
||||||
if (GetTextPeer())
|
if (GetTextPeer())
|
||||||
{
|
{
|
||||||
wxSize size = GetTextPeer()->GetBestSize();
|
wxSize size = GetTextPeer()->GetBestSize();
|
||||||
if (size.x > 0 && size.y > 0)
|
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 ;
|
|
||||||
|
|
||||||
switch ( m_windowVariant )
|
|
||||||
{
|
{
|
||||||
case wxWINDOW_VARIANT_NORMAL :
|
// these are the numbers from the HIG:
|
||||||
hText = 22 - 6 ;
|
// we reduce them by the borders first
|
||||||
break ;
|
wText = 100 ;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_SMALL :
|
switch ( m_windowVariant )
|
||||||
hText = 19 - 6 ;
|
{
|
||||||
break ;
|
case wxWINDOW_VARIANT_NORMAL :
|
||||||
|
hText = 22 - 6 ;
|
||||||
|
break ;
|
||||||
|
|
||||||
case wxWINDOW_VARIANT_MINI :
|
case wxWINDOW_VARIANT_SMALL :
|
||||||
hText = 15 - 6 ;
|
hText = 19 - 6 ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
case wxWINDOW_VARIANT_MINI :
|
||||||
hText = 22 - 6;
|
hText = 15 - 6 ;
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
|
default :
|
||||||
|
hText = 22 - 6;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// as the above numbers have some free space around the text
|
// as the above numbers have some free space around the text
|
||||||
|
Reference in New Issue
Block a user