wxStatusBarGeneric::DoGetBestSize

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-04-07 21:48:24 +00:00
parent b3fcfa4d89
commit 595a949307
2 changed files with 20 additions and 0 deletions

View File

@@ -109,6 +109,24 @@ bool wxStatusBarGeneric::Create(wxWindow *parent,
return TRUE;
}
wxSize wxStatusBarGeneric::DoGetBestSize() const
{
int width, height;
// best width is the width of the parent
GetParent()->GetClientSize(&width, NULL);
// best height is as calculated above in Create
wxClientDC dc((wxWindow*)this);
dc.SetFont(GetFont());
wxCoord y;
dc.GetTextExtent(_T("X"), NULL, &y );
height = (int)( (11*y)/10 + 2*GetBorderY());
return wxSize(width, height);
}
void wxStatusBarGeneric::SetFieldsCount(int number, const int *widths)
{
wxASSERT_MSG( number >= 0, _T("negative number of fields in wxStatusBar?") );