X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4cdf71be825e114978731ceb33ae0d418f3018a6..bcf324bebe65cd7ee49c139533ceea52dceb4b91:/src/gtk/button.cpp diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index bee9497fbc..086159189a 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -100,6 +100,7 @@ bool wxButton::Create(wxWindow *parent, } m_widget = gtk_button_new_with_mnemonic(""); + g_object_ref(m_widget); float x_alignment = 0.5; if (HasFlag(wxBU_LEFT)) @@ -215,11 +216,18 @@ void wxButton::SetLabel( const wxString &lbl ) bool wxButton::Enable( bool enable ) { + bool isEnabled = IsEnabled(); + if ( !wxControl::Enable( enable ) ) return false; gtk_widget_set_sensitive(GTK_BIN(m_widget)->child, enable); + if (!isEnabled && enable) + { + GTKFixSensitivity(); + } + return true; } @@ -241,9 +249,11 @@ void wxButton::DoApplyWidgetStyle(GtkRcStyle *style) GtkWidget *box = GTK_BIN(child)->child; if ( GTK_IS_BOX(box) ) { - GList *items = gtk_container_get_children(GTK_CONTAINER(box)); - for ( GList *item = items; item; item = item->next ) - gtk_widget_modify_style(GTK_WIDGET(item->data), style); + for (GList* item = GTK_BOX(box)->children; item; item = item->next) + { + GtkBoxChild* boxChild = static_cast(item->data); + gtk_widget_modify_style(boxChild->widget, style); + } } } }