+ wxCHECK_RET( parent, _T("button without parent?") );
+
+ // set this one as the default button both for wxWindows ...
+ wxWindow *winOldDefault = parent->SetDefaultItem(this);
+
+ // ... and Windows
+ SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), FALSE);
+ SetDefaultStyle(this, TRUE);
+}
+
+// set this button as being currently default
+void wxButton::SetTmpDefault()
+{
+ wxWindow *parent = GetParent();
+
+ wxCHECK_RET( parent, _T("button without parent?") );
+
+ wxWindow *winOldDefault = parent->GetDefaultItem();
+ parent->SetTmpDefaultItem(this);
+
+ SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), FALSE);
+ SetDefaultStyle(this, TRUE);
+}
+
+// unset this button as currently default, it may still stay permanent default
+void wxButton::UnsetTmpDefault()
+{
+ wxWindow *parent = GetParent();
+
+ wxCHECK_RET( parent, _T("button without parent?") );
+
+ parent->SetTmpDefaultItem(NULL);
+
+ wxWindow *winOldDefault = parent->GetDefaultItem();
+
+ SetDefaultStyle(this, FALSE);
+ SetDefaultStyle(wxDynamicCast(winOldDefault, wxButton), TRUE);
+}
+
+/* static */
+void
+wxButton::SetDefaultStyle(wxButton *btn, bool on)
+{
+ // we may be called with NULL pointer -- simpler to do the check here than
+ // in the caller which does wxDynamicCast()
+ if ( !btn )
+ return;
+
+ // first, let DefDlgProc() know about the new default button
+ if ( on )