+ //
+ // Set this one as the default button both for wxWidgets and Windows
+ //
+ wxWindow* pWinOldDefault = tlw->SetDefaultItem(this);
+
+ SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), false);
+ SetDefaultStyle( this, true );
+} // end of wxButton::SetDefault
+
+void wxButton::SetTmpDefault()
+{
+ wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+
+ wxCHECK_RET( tlw, _T("button without top level window?") );
+
+ wxWindow* pWinOldDefault = tlw->GetDefaultItem();
+
+ tlw->SetTmpDefaultItem(this);
+ SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), false);
+ SetDefaultStyle( this, true );
+} // end of wxButton::SetTmpDefault
+
+void wxButton::UnsetTmpDefault()
+{
+ wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
+
+ wxCHECK_RET( tlw, _T("button without top level window?") );
+
+ tlw->SetTmpDefaultItem(NULL);
+
+ wxWindow* pWinOldDefault = tlw->GetDefaultItem();
+
+ SetDefaultStyle( this, false );
+ SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton), true );
+} // end of wxButton::UnsetTmpDefault
+
+void wxButton::SetDefaultStyle(
+ wxButton* pBtn
+, bool bOn
+)
+{
+ long lStyle;
+ //
+ // We may be called with NULL pointer -- simpler to do the check here than
+ // in the caller which does wxDynamicCast()
+ //
+ if (!pBtn)
+ return;
+
+ //
+ // First, let DefDlgProc() know about the new default button
+ //
+ if (bOn)