- wxControl::SetLabel( label );
- GtkBin *bin = GTK_BIN( m_widget );
- GtkLabel *g_label = GTK_LABEL( bin->child );
- gtk_label_set( g_label, GetLabel() );
-};
+ wxCHECK_RET( m_widget != NULL, wxT("invalid button") );
+
+ wxControl::SetLabel( label );
+
+#ifdef __WXGTK20__
+ wxString label2 = PrepareLabelMnemonics( label );
+ gtk_label_set_text_with_mnemonic( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( label2 ) );
+#else
+ gtk_label_set( GTK_LABEL( BUTTON_CHILD(m_widget) ), wxGTK_CONV( GetLabel() ) );
+#endif
+}
+
+bool wxButton::Enable( bool enable )
+{
+ if ( !wxControl::Enable( enable ) )
+ return FALSE;
+
+ gtk_widget_set_sensitive( BUTTON_CHILD(m_widget), enable );
+
+ return TRUE;
+}
+
+bool wxButton::IsOwnGtkWindow( GdkWindow *window )
+{
+#ifdef __WXGTK20__
+ return GTK_BUTTON(m_widget)->event_window;
+#else
+ return (window == m_widget->window);
+#endif
+}
+
+void wxButton::ApplyWidgetStyle()
+{
+ SetWidgetStyle();
+ gtk_widget_set_style( m_widget, m_widgetStyle );
+ gtk_widget_set_style( BUTTON_CHILD(m_widget), m_widgetStyle );
+}
+
+wxSize wxButton::DoGetBestSize() const
+{
+ wxSize ret( wxControl::DoGetBestSize() );
+
+#ifndef __WXGTK20__
+ ret.x += 10; // add a few pixels for sloppy (but common) themes
+#endif
+
+ if (!HasFlag(wxBU_EXACTFIT))
+ {
+ if (ret.x < 80) ret.x = 80;
+ }
+
+ return ret;
+}
+
+#endif // wxUSE_BUTTON