Added symptomatic fix to wrong height in wxStaticText.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -194,9 +194,12 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
|
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
|
||||||
|
|
||||||
wxString curLine;
|
wxString curLine;
|
||||||
for ( const wxChar *pc = m_label; ; pc++ ) {
|
for ( const wxChar *pc = m_label; ; pc++ )
|
||||||
if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
|
{
|
||||||
if ( !curLine ) {
|
if ( *pc == wxT('\n') || *pc == wxT('\0') )
|
||||||
|
{
|
||||||
|
if ( !curLine )
|
||||||
|
{
|
||||||
// we can't use GetTextExtent - it will return 0 for both width
|
// we can't use GetTextExtent - it will return 0 for both width
|
||||||
// and height and an empty line should count in height
|
// and height and an empty line should count in height
|
||||||
// calculation
|
// calculation
|
||||||
@@ -206,12 +209,17 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
GetTextExtent(_T("W"), NULL, &heightLineDefault);
|
GetTextExtent(_T("W"), NULL, &heightLineDefault);
|
||||||
|
|
||||||
heightTextTotal += heightLineDefault;
|
heightTextTotal += heightLineDefault;
|
||||||
|
|
||||||
|
heightTextTotal++; // FIXME: why is this necessary?
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
GetTextExtent(curLine, &widthLine, &heightLine);
|
GetTextExtent(curLine, &widthLine, &heightLine);
|
||||||
if ( widthLine > widthTextMax )
|
if ( widthLine > widthTextMax )
|
||||||
widthTextMax = widthLine;
|
widthTextMax = widthLine;
|
||||||
heightTextTotal += heightLine;
|
heightTextTotal += heightLine;
|
||||||
|
|
||||||
|
heightTextTotal++; // FIXME: why is this necessary?
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( *pc == wxT('\n') ) {
|
if ( *pc == wxT('\n') ) {
|
||||||
|
@@ -194,9 +194,12 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
|
heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
|
||||||
|
|
||||||
wxString curLine;
|
wxString curLine;
|
||||||
for ( const wxChar *pc = m_label; ; pc++ ) {
|
for ( const wxChar *pc = m_label; ; pc++ )
|
||||||
if ( *pc == wxT('\n') || *pc == wxT('\0') ) {
|
{
|
||||||
if ( !curLine ) {
|
if ( *pc == wxT('\n') || *pc == wxT('\0') )
|
||||||
|
{
|
||||||
|
if ( !curLine )
|
||||||
|
{
|
||||||
// we can't use GetTextExtent - it will return 0 for both width
|
// we can't use GetTextExtent - it will return 0 for both width
|
||||||
// and height and an empty line should count in height
|
// and height and an empty line should count in height
|
||||||
// calculation
|
// calculation
|
||||||
@@ -206,12 +209,17 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
GetTextExtent(_T("W"), NULL, &heightLineDefault);
|
GetTextExtent(_T("W"), NULL, &heightLineDefault);
|
||||||
|
|
||||||
heightTextTotal += heightLineDefault;
|
heightTextTotal += heightLineDefault;
|
||||||
|
|
||||||
|
heightTextTotal++; // FIXME: why is this necessary?
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
GetTextExtent(curLine, &widthLine, &heightLine);
|
GetTextExtent(curLine, &widthLine, &heightLine);
|
||||||
if ( widthLine > widthTextMax )
|
if ( widthLine > widthTextMax )
|
||||||
widthTextMax = widthLine;
|
widthTextMax = widthLine;
|
||||||
heightTextTotal += heightLine;
|
heightTextTotal += heightLine;
|
||||||
|
|
||||||
|
heightTextTotal++; // FIXME: why is this necessary?
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( *pc == wxT('\n') ) {
|
if ( *pc == wxT('\n') ) {
|
||||||
|
Reference in New Issue
Block a user