X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..c1296b82d491fbe836d56ce6dd4911cdc5dfae99:/src/gtk/control.cpp?ds=sidebyside diff --git a/src/gtk/control.cpp b/src/gtk/control.cpp index 7f5b15bf08..5adb0823c6 100644 --- a/src/gtk/control.cpp +++ b/src/gtk/control.cpp @@ -4,7 +4,7 @@ // Author: Robert Roebling // Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart and Vadim Zeitlin -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) @@ -66,6 +66,7 @@ void wxControl::SetLabel( const wxString &label ) } m_label << *pc; } + InvalidateBestSize(); } wxString wxControl::GetLabel() const @@ -85,13 +86,23 @@ wxSize wxControl::DoGetBestSize() const (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request ) (m_widget, &req ); - return wxSize(req.width, req.height); + wxSize best(req.width, req.height); + CacheBestSize(best); + return best; } void wxControl::PostCreation(const wxSize& size) { wxWindow::PostCreation(); + + // NB: GetBestSize needs to know the style, otherwise it will assume + // default font and if the user uses a different font, determined + // best size will be different (typically, smaller) than the desired + // size. This call ensure that a style is available at the time + // GetBestSize is called. + gtk_widget_ensure_style(m_widget); + InheritAttributes(); ApplyWidgetStyle(); SetInitialBestSize(size); @@ -193,7 +204,7 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* widget, if ( style && style->font_desc ) { wxNativeFontInfo info; - info.description = style->font_desc; + info.description = pango_font_description_copy(style->font_desc); attr.font = wxFont(info); } else @@ -259,6 +270,5 @@ wxControl::GetDefaultAttributesFromGTKWidget(GtkWidget* (*widget_new)(GtkAdjustm return attr; } - #endif // wxUSE_CONTROLS