+#endif // wxUSE_MARKUP
+
+void wxButton::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+ GTKApplyStyle(m_widget, style);
+ GtkWidget* child = gtk_bin_get_child(GTK_BIN(m_widget));
+ GTKApplyStyle(child, style);
+
+ // for buttons with images, the path to the label is (at least in 2.12)
+ // GtkButton -> GtkAlignment -> GtkHBox -> GtkLabel
+ if ( GTK_IS_ALIGNMENT(child) )
+ {
+ GtkWidget* box = gtk_bin_get_child(GTK_BIN(child));
+ if ( GTK_IS_BOX(box) )
+ {
+ wxGtkList list(gtk_container_get_children(GTK_CONTAINER(box)));
+ for (GList* item = list; item; item = item->next)
+ {
+ GTKApplyStyle(GTK_WIDGET(item->data), style);
+ }
+ }
+ }
+}
+
+wxSize wxButton::DoGetBestSize() const
+{
+ // the default button in wxGTK is bigger than the other ones because of an
+ // extra border around it, but we don't want to take it into account in
+ // our size calculations (otherwise the result is visually ugly), so
+ // always return the size of non default button from here
+ const bool isDefault = gtk_widget_has_default(m_widget) != 0;
+ if ( isDefault )
+ {
+ // temporarily unset default flag
+ gtk_widget_set_can_default(m_widget, FALSE);
+ }
+
+ wxSize ret( wxAnyButton::DoGetBestSize() );
+
+ if ( isDefault )
+ {
+ // set it back again
+ gtk_widget_set_can_default(m_widget, TRUE);
+ }
+
+ if (!HasFlag(wxBU_EXACTFIT))
+ {
+ wxSize defaultSize = GetDefaultSize();
+ if (ret.x < defaultSize.x)
+ ret.x = defaultSize.x;
+ if (ret.y < defaultSize.y)
+ ret.y = defaultSize.y;
+ }
+
+ CacheBestSize(ret);
+ return ret;
+}
+
+// static
+wxVisualAttributes
+wxButton::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+ return GetDefaultAttributesFromGTKWidget(gtk_button_new());
+}
+
+#endif // wxUSE_BUTTON