+ wxString label1(wxStripMenuCodes(label));
+
+ XmString text = XmStringCreateSimple ((char*) (const char*) label1);
+ Widget parentWidget = (Widget) parent->GetClientWidget();
+
+ XmFontList fontList = (XmFontList) m_font.GetFontList(1.0, XtDisplay(parentWidget));
+
+ /*
+ * Patch Note (important)
+ * There is no major reason to put a defaultButtonThickness here.
+ * Not requesting it give the ability to put wxButton with a spacing
+ * as small as requested. However, if some button become a DefaultButton,
+ * other buttons are no more aligned -- This is why we set
+ * defaultButtonThickness of ALL buttons belonging to the same wxPanel,
+ * in the ::SetDefaultButton method.
+ */
+ m_mainWidget = (WXWidget) XtVaCreateManagedWidget ("button",
+ xmPushButtonWidgetClass,
+ parentWidget,
+ XmNfontList, fontList,
+ XmNlabelString, text,
+ // XmNdefaultButtonShadowThickness, 1, // See comment for wxButton::SetDefault
+ NULL);
+
+ XmStringFree (text);
+
+ XtAddCallback ((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
+ (XtPointer) this);
+
+ SetCanAddEventHandler(TRUE);
+
+ int x = 0; int y = 0;
+ wxFont new_font( parent->GetFont() );
+ GetTextExtent( label1, &x, &y, (int*)NULL, (int*)NULL, &new_font );
+
+ wxSize newSize = size;
+ if (newSize.x == -1) newSize.x = 30+x;
+ if (newSize.y == -1) newSize.y = 27+y;
+ SetSize( newSize.x, newSize.y );
+
+ AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, newSize.x, newSize.y);
+
+ ChangeBackgroundColour();
+
+ return TRUE;
+}
+
+void wxButton::SetDefault()
+{
+ wxWindow *parent = GetParent();
+ if ( parent )
+ parent->SetDefaultItem(this);