+ ::WinSetPresParam( m_hWnd
+ ,PP_FOREGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+ lColor = (LONG)m_backgroundColour.GetPixel();
+
+ ::WinSetPresParam( m_hWnd
+ ,PP_BACKGROUNDCOLOR
+ ,sizeof(LONG)
+ ,(PVOID)&lColor
+ );
+
+ SubclassWin(m_hWnd);
+ SetFont(*wxSMALL_FONT);
+ SetXComp(0);
+ SetYComp(0);
+ SetSize( nX, nY, nWidth, nHeight );
+
+ return true;
+} // end of wxStaticText::Create
+
+wxSize wxStaticText::DoGetBestSize() const
+{
+ wxString sText(wxGetWindowText(GetHWND()));
+ int nWidthTextMax = 0;
+ int nWidthLine = 0;
+ int nHeightTextTotal = 0;
+ int nHeightLineDefault = 0;
+ int nHeightLine = 0;
+ wxString sCurLine;
+ bool bLastWasTilde = false;
+
+ for (const wxChar *pc = sText; ; pc++)
+ {
+ if ( *pc == wxT('\n') || *pc == wxT('\0') )
+ {
+ if (!sCurLine )
+ {
+ //
+ // We can't use GetTextExtent - it will return 0 for both width
+ // and height and an empty line should count in height
+ // calculation
+ //
+ if (!nHeightLineDefault)
+ nHeightLineDefault = nHeightLine;
+ if (!nHeightLineDefault)
+ GetTextExtent(_T("W"), NULL, &nHeightLineDefault);
+ nHeightTextTotal += nHeightLineDefault;
+ }
+ else
+ {
+ GetTextExtent( sCurLine
+ ,&nWidthLine
+ ,&nHeightLine
+ );
+ if (nWidthLine > nWidthTextMax)
+ nWidthTextMax = nWidthLine;
+ nHeightTextTotal += nHeightLine;
+ }
+
+ if ( *pc == wxT('\n') )
+ {
+ sCurLine.Empty();