-/*
-#if wxUSE_CTL3D
- if ( m_useCtl3D )
- {
- HBRUSH hbrush = Ctl3dCtlColorEx(message, wParam, lParam);
-
- if (hbrush != (HBRUSH) 0)
- return hbrush;
- else
- return (HBRUSH)MSWDefWindowProc(message, wParam, lParam);
- }
-#endif
-*/
-
- if (GetParent()->GetTransparentBackground())
- SetBkMode((HDC) pDC, TRANSPARENT);
- else
- SetBkMode((HDC) pDC, OPAQUE);
+ wxString text(wxGetWindowText(GetHWND()));
+
+ int widthTextMax = 0, widthLine,
+ heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
+
+ bool lastWasAmpersand = FALSE;
+
+ wxString curLine;
+ for ( const wxChar *pc = text; ; pc++ )
+ {
+ if ( *pc == wxT('\n') || *pc == wxT('\0') )
+ {
+ if ( !curLine )
+ {
+ // we can't use GetTextExtent - it will return 0 for both width
+ // and height and an empty line should count in height
+ // calculation
+ if ( !heightLineDefault )
+ heightLineDefault = heightLine;
+ if ( !heightLineDefault )
+ GetTextExtent(_T("W"), NULL, &heightLineDefault);
+
+ heightTextTotal += heightLineDefault;
+ }
+ else
+ {
+ GetTextExtent(curLine, &widthLine, &heightLine);
+ if ( widthLine > widthTextMax )
+ widthTextMax = widthLine;
+ heightTextTotal += heightLine;
+ }
+
+ if ( *pc == wxT('\n') )
+ {
+ curLine.Empty();
+ }
+ else
+ {
+ // the end of string
+ break;
+ }
+ }
+ else
+ {
+ // we shouldn't take into account the '&' which just introduces the
+ // mnemonic characters and so are not shown on the screen -- except
+ // when it is preceded by another '&' in which case it stands for a
+ // literal ampersand
+ if ( *pc == _T('&') )
+ {
+ if ( !lastWasAmpersand )
+ {
+ lastWasAmpersand = TRUE;
+
+ // skip the statement adding pc to curLine below
+ continue;
+ }
+
+ // it is a literal ampersand
+ lastWasAmpersand = FALSE;
+ }
+
+ curLine += *pc;
+ }
+ }
+
+ return wxSize(widthTextMax, heightTextTotal);
+}