X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c7d6d88330dac6c5c5b4b2ed94ec91b6a46066a1..ba763a45d85d8b70326da65895b7753f86fc3ea3:/src/gtk1/bmpbuttn.cpp diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp index dda2040146..34f5bab890 100644 --- a/src/gtk1/bmpbuttn.cpp +++ b/src/gtk1/bmpbuttn.cpp @@ -149,13 +149,6 @@ bool wxBitmapButton::Create( wxWindow *parent, if (m_bmpNormal.Ok()) { - wxSize newSize = size; - int border = (style & wxNO_BORDER) ? 4 : 10; - if (newSize.x == -1) - newSize.x = m_bmpNormal.GetWidth()+border; - if (newSize.y == -1) - newSize.y = m_bmpNormal.GetHeight()+border; - SetSize( newSize.x, newSize.y ); OnSetBitmap(); } @@ -173,10 +166,7 @@ bool wxBitmapButton::Create( wxWindow *parent, m_parent->DoAddChild( this ); - PostCreation(); - InheritAttributes(); - - Show( TRUE ); + PostCreation(size); return TRUE; } @@ -203,18 +193,20 @@ wxString wxBitmapButton::GetLabel() const return wxControl::GetLabel(); } -void wxBitmapButton::ApplyWidgetStyle() +void wxBitmapButton::DoApplyWidgetStyle(GtkRcStyle *style) { if ( !BUTTON_CHILD(m_widget) ) return; - wxButton::ApplyWidgetStyle(); + wxButton::DoApplyWidgetStyle(style); } void wxBitmapButton::OnSetBitmap() { wxCHECK_RET( m_widget != NULL, wxT("invalid bitmap button") ); + InvalidateBestSize(); + wxBitmap the_one; if (!m_isEnabled) the_one = m_bmpDisabled; @@ -258,6 +250,20 @@ 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; + } + CacheBestSize(best); + return best; +} + bool wxBitmapButton::Enable( bool enable ) { if ( !wxWindow::Enable(enable) )