X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4dcaf11a7b5189be78e52e1412febd7689a959f8..b9b32d5c4fd7156164b7c264d0f88dfe264851ba:/src/gtk1/button.cpp diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index dc7dd01c59..2bb626f031 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -92,9 +92,22 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetLabel(label); + int x = 0; int y = 0; + wxFont new_font( parent->GetFont() ); + GetTextExtent( m_label, &x, &y, (int*)NULL, (int*)NULL, &new_font ); + wxSize newSize = size; - if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() ); - if (newSize.y == -1) newSize.y = 26; + if (newSize.x == -1) + { + newSize.x = 12+x; + if (newSize.x < 80) newSize.x = 80; + } + if (newSize.y == -1) + { + newSize.y = 11+y; + if (newSize.x < 26) newSize.x = 26; + } + SetSize( newSize.x, newSize.y ); gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",