take border into account in best size calculations
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -33,6 +33,7 @@ wxMSW:
|
|||||||
- Handle absence of wxListCtrl column image better (Zbigniew Zag<61>rski)
|
- Handle absence of wxListCtrl column image better (Zbigniew Zag<61>rski)
|
||||||
- Fixed asynchronous playback of large sound files in wxSound
|
- Fixed asynchronous playback of large sound files in wxSound
|
||||||
- Added wxDynamicLibrary::GetSymbolAorW()
|
- Added wxDynamicLibrary::GetSymbolAorW()
|
||||||
|
- Fixed default size of wxStaticText controls with border being too small
|
||||||
|
|
||||||
wxWinCE:
|
wxWinCE:
|
||||||
|
|
||||||
|
@@ -132,7 +132,7 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
wxFont font(GetFont());
|
wxFont font(GetFont());
|
||||||
if (!font.Ok())
|
if (!font.Ok())
|
||||||
font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||||
|
|
||||||
dc.SetFont(font);
|
dc.SetFont(font);
|
||||||
|
|
||||||
wxCoord widthTextMax, heightTextTotal;
|
wxCoord widthTextMax, heightTextTotal;
|
||||||
@@ -143,6 +143,37 @@ wxSize wxStaticText::DoGetBestSize() const
|
|||||||
widthTextMax += 2;
|
widthTextMax += 2;
|
||||||
#endif // __WXWINCE__
|
#endif // __WXWINCE__
|
||||||
|
|
||||||
|
// 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);
|
wxSize best(widthTextMax, heightTextTotal);
|
||||||
CacheBestSize(best);
|
CacheBestSize(best);
|
||||||
return best;
|
return best;
|
||||||
|
Reference in New Issue
Block a user