implement wxBitmapButton::DoGetBestSize

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26237 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-03-16 21:58:27 +00:00
parent cc3dd6fce9
commit 178a12204b
4 changed files with 34 additions and 6 deletions

View File

@@ -150,11 +150,11 @@ bool wxBitmapButton::Create( wxWindow *parent,
if (m_bmpNormal.Ok())
{
wxSize newSize = size;
int border = (style & wxNO_BORDER) ? 4 : 10;
wxSize bestSize = DoGetBestSize();
if (newSize.x == -1)
newSize.x = m_bmpNormal.GetWidth()+border;
newSize.x = bestSize.x;
if (newSize.y == -1)
newSize.y = m_bmpNormal.GetHeight()+border;
newSize.y = bestSize.y;
SetSize( newSize.x, newSize.y );
OnSetBitmap();
}
@@ -258,6 +258,19 @@ void wxBitmapButton::OnSetBitmap()
}
}
wxSize wxBitmapButton::DoGetBestSize() const
{
wxSize best;
if (m_bmpNormal.Ok())
{
int border = HasFlag(wxNO_BORDER) ? 4 : 10;
best.x = m_bmpNormal.GetWidth()+border;
best.y = m_bmpNormal.GetHeight()+border;
}
return best;
}
bool wxBitmapButton::Enable( bool enable )
{
if ( !wxWindow::Enable(enable) )