X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/01111366c9b4ea40eee7f4b13ddfe6f6b9f886db..e1dc4cc6872ce44134a881feeb0ede2b8b91af55:/src/gtk1/button.cpp diff --git a/src/gtk1/button.cpp b/src/gtk1/button.cpp index b0278860ac..249465f366 100644 --- a/src/gtk1/button.cpp +++ b/src/gtk1/button.cpp @@ -2,7 +2,7 @@ // Name: button.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -72,6 +72,9 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this ); PostCreation(); + + SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -88,43 +91,26 @@ void wxButton::SetDefault(void) void wxButton::SetLabel( const wxString &label ) { + wxCHECK_RET( m_widget != NULL, "invalid button" ); + wxControl::SetLabel( label ); - GtkButton *bin = GTK_BUTTON( m_widget ); - GtkLabel *g_label = GTK_LABEL( bin->child ); - gtk_label_set( g_label, GetLabel() ); + + gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() ); } void wxButton::Enable( bool enable ) { + wxCHECK_RET( m_widget != NULL, "invalid button" ); + wxControl::Enable( enable ); - GtkButton *bin = GTK_BUTTON( m_widget ); - GtkWidget *label = bin->child; - gtk_widget_set_sensitive( label, enable ); + + gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxButton::SetFont( const wxFont &font ) +void wxButton::ApplyWidgetStyle() { - 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 ); + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); + gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } +