+wxSize wxButton::OldGetBestSize() const
+{
+ Dimension xmargin, ymargin, highlight, shadow, defThickness;
+
+ XtVaGetValues( (Widget)m_mainWidget,
+ XmNmarginWidth, &xmargin,
+ XmNmarginHeight, &ymargin,
+ XmNhighlightThickness, &highlight,
+ XmNshadowThickness, &shadow,
+ XmNdefaultButtonShadowThickness, &defThickness,
+ NULL );
+
+ int x = 0; int y = 0;
+ GetTextExtent( GetLabel(), &x, &y );
+
+ int margin = highlight * 2 +
+ ( defThickness ? ( ( shadow + defThickness ) * 4 ) : ( shadow * 2 ) );
+
+ wxSize best( x + xmargin * 2 + margin,
+ y + ymargin * 2 + margin );
+
+ // all buttons have at least the standard size unless the user explicitly
+ // wants them to be of smaller size and used wxBU_EXACTFIT style when
+ // creating the button
+ if( !HasFlag( wxBU_EXACTFIT ) )
+ {
+ wxSize def = GetDefaultSize();
+ int margin = highlight * 2 +
+ ( defThickness ? ( shadow * 4 + defThickness * 4 ) : 0 );
+ def.x += margin;
+ def.y += margin;
+
+ if( def.x > best.x )
+ best.x = def.x;
+ if( def.y > best.y )
+ best.y = def.y;
+ }
+
+ return best;
+}
+
+void wxButton::Command (wxCommandEvent & event)
+{
+ ProcessCommand (event);
+}
+
+void wxButtonCallback (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
+{
+ if (!wxGetWindowFromTable(w))
+ // Widget has been deleted!
+ return;
+
+ wxButton *item = (wxButton *) clientData;
+ wxCommandEvent event (wxEVT_COMMAND_BUTTON_CLICKED, item->GetId());
+ event.SetEventObject(item);
+ item->ProcessCommand (event);
+}