X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/acfd422afac254f4356904275656c0c15685fa1e..837904f2627957e99283378ccd41c2e3fc7a4a5e:/src/gtk/button.cpp diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 1347e6ddae..140e4380ef 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -41,11 +41,12 @@ extern bool g_blockEventsOnDrag; static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button ) { - if (g_isIdle) wxapp_install_idle_handler(); + if (g_isIdle) + wxapp_install_idle_handler(); - if (!button->HasVMT()) return; + if (!button->m_hasVMT) return; if (g_blockEventsOnDrag) return; - + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); event.SetEventObject(button); button->GetEventHandler()->ProcessEvent(event); @@ -80,7 +81,13 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetValidator( validator ); - m_widget = gtk_button_new_with_label( m_label.mbc_str() ); + m_widget = gtk_button_new_with_label( "" ); + +#if (GTK_MINOR_VERSION > 0) + if (style & wxNO_BORDER) + gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE ); +#endif + SetLabel(label); if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() ); @@ -90,9 +97,7 @@ 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 ); + m_parent->DoAddChild( this ); PostCreation(); @@ -122,13 +127,14 @@ void wxButton::SetLabel( const wxString &label ) gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() ); } -void wxButton::Enable( bool enable ) +bool wxButton::Enable( bool enable ) { - wxCHECK_RET( m_widget != NULL, _T("invalid button") ); - - wxControl::Enable( enable ); + if ( !wxControl::Enable( enable ) ) + return FALSE; gtk_widget_set_sensitive( GTK_BUTTON(m_widget)->child, enable ); + + return TRUE; } void wxButton::ApplyWidgetStyle()