+
+void wxButton::DoApplyWidgetStyle(GtkRcStyle *style)
+{
+ gtk_widget_modify_style(m_widget, style);
+ GtkWidget *child = GTK_BIN(m_widget)->child;
+ gtk_widget_modify_style(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(child)->child;
+ if ( GTK_IS_BOX(box) )
+ {
+ for (GList* item = GTK_BOX(box)->children; item; item = item->next)
+ {
+ GtkBoxChild* boxChild = static_cast<GtkBoxChild*>(item->data);
+ gtk_widget_modify_style(boxChild->widget, 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 (otherwsie 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);
+ if ( isDefault )
+ {
+ // temporarily unset default flag
+ GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_DEFAULT );
+ }
+
+ wxSize ret( wxControl::DoGetBestSize() );
+
+ if ( isDefault )
+ {
+ // set it back again
+ GTK_WIDGET_SET_FLAGS( m_widget, GTK_CAN_DEFAULT );
+ }
+
+ 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