X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/008881c3f0ccbbc6d2b73fd9151c85ea243f88b1..0aaa804e7019b8187e2d35dffba133b43af79533:/src/msw/stattext.cpp diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index 124d9e471d..36ee627375 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -123,6 +123,9 @@ WXDWORD wxStaticText::MSWGetStyle(long style, WXDWORD *exstyle) const else msStyle |= SS_LEFT; + // this style is necessary to receive mouse events + msStyle |= SS_NOTIFY; + return msStyle; } @@ -132,7 +135,7 @@ wxSize wxStaticText::DoGetBestSize() const wxFont font(GetFont()); if (!font.Ok()) font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); - + dc.SetFont(font); wxCoord widthTextMax, heightTextTotal; @@ -143,7 +146,40 @@ wxSize wxStaticText::DoGetBestSize() const widthTextMax += 2; #endif // __WXWINCE__ - return wxSize(widthTextMax, heightTextTotal); + // border takes extra space + // + // TODO: this is probably not wxStaticText-specific and should be moved + wxCoord border; + switch ( GetBorder() ) + { + case wxBORDER_STATIC: + case wxBORDER_SIMPLE: + border = 1; + break; + + case wxBORDER_SUNKEN: + border = 2; + break; + + case wxBORDER_RAISED: + case wxBORDER_DOUBLE: + border = 3; + break; + + default: + wxFAIL_MSG( _T("unknown border style") ); + // fall through + + case wxBORDER_NONE: + border = 0; + } + + widthTextMax += 2*border; + heightTextTotal += 2*border; + + wxSize best(widthTextMax, heightTextTotal); + CacheBestSize(best); + return best; } void wxStaticText::DoSetSize(int x, int y, int w, int h, int sizeFlags)