X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f96aa4d9eb296b3dfc468a351ce013bf92fab983..c9f8e0e22e0cb2a82233e9076da7414315df062d:/src/gtk/button.cpp diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index f2a516ec65..8338f5bcff 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/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 ///////////////////////////////////////////////////////////////////////////// @@ -45,14 +45,20 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton * IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl) -wxButton::wxButton(void) +wxButton::wxButton() { } +wxButton::~wxButton() +{ + if (m_clientData) delete m_clientData; +} + bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos, const wxSize &size, long style, const wxValidator& validator, const wxString &name ) { + m_clientData = (wxClientData*) NULL; m_needParent = TRUE; wxSize newSize = size; @@ -71,9 +77,14 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this ); + m_parent->AddChild( this ); + + (m_parent->m_insertCallback)( m_parent, this ); + PostCreation(); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -106,30 +117,11 @@ void wxButton::Enable( bool enable ) gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); } -void wxButton::SetFont( const wxFont &font ) -{ - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetFont( font ); - - gtk_widget_set_style( GTK_BUTTON(m_widget)->child, - gtk_style_ref( - gtk_widget_get_style( m_widget ) ) ); -} - -void wxButton::SetBackgroundColour( const wxColour &colour ) +void wxButton::ApplyWidgetStyle() { - return; - - wxCHECK_RET( m_widget != NULL, "invalid button" ); - - wxControl::SetBackgroundColour( colour ); - - if (!m_backgroundColour.Ok()) return; - - gtk_widget_set_style( GTK_BUTTON(m_widget)->child, - gtk_style_ref( - gtk_widget_get_style( m_widget ) ) ); + SetWidgetStyle(); + gtk_widget_set_style( m_widget, m_widgetStyle ); + gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); }