X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e1e955e14c1ce17f97fb559923ded1b1d0cdd6b8..520e470fdd0daef09c77938db642e4583933c90d:/src/gtk1/button.cpp?ds=inline diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index 1bd096b084..034e229f18 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -103,3 +103,29 @@ void wxButton::Enable( bool enable ) gtk_widget_set_sensitive( label, enable ); } +void wxButton::SetFont( const wxFont &font ) +{ + if (((wxFont*)&font)->Ok()) + m_font = font; + else + m_font = *wxSWISS_FONT; + + GtkButton *bin = GTK_BUTTON( m_widget ); + GtkWidget *label = bin->child; + + GtkStyle *style = (GtkStyle*) NULL; + if (!m_hasOwnStyle) + { + m_hasOwnStyle = TRUE; + style = gtk_style_copy( gtk_widget_get_style( label ) ); + } + else + { + style = gtk_widget_get_style( label ); + } + + gdk_font_unref( style->font ); + style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); + + gtk_widget_set_style( label, style ); +}