+bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& lbl,
+ const wxPoint& pos,
+ const wxSize& size, long style,
+ const wxValidator& validator,
+ const wxString& name)
+{
+ wxString label(lbl);
+ if (label.empty() && wxIsStockID(id))
+ label = wxGetStockLabel(id);
+
+ if( !CreateControl( parent, id, pos, size, style, validator, name ) )
+ return false;
+
+ wxString label1(wxStripMenuCodes(label));
+ wxXmString text( label1 );
+
+ Widget parentWidget = (Widget) parent->GetClientWidget();
+
+ /*
+ * 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,
+ wxFont::GetFontTag(), m_font.GetFontType(XtDisplay(parentWidget)),
+ XmNlabelString, text(),
+ XmNrecomputeSize, False,
+ // See comment for wxButton::SetDefault
+ // XmNdefaultButtonShadowThickness, 1,
+ NULL);
+
+ XtAddCallback ((Widget) m_mainWidget,
+ XmNactivateCallback, (XtCallbackProc) wxButtonCallback,
+ (XtPointer) this);
+
+ wxSize best = GetBestSize();
+ if( size.x != -1 ) best.x = size.x;
+ if( size.y != -1 ) best.y = size.y;
+
+ AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
+ pos.x, pos.y, best.x, best.y);
+
+ ChangeBackgroundColour();
+
+ return true;