+ //
+ // Set this one as the default button both for wxWindows and Windows
+ //
+ wxWindow* pWinOldDefault = pParent->SetDefaultItem(this);
+
+ SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton)
+ ,FALSE
+ );
+ SetDefaultStyle( this
+ ,TRUE
+ );
+} // end of wxButton::SetDefault
+
+void wxButton::SetTmpDefault()
+{
+ wxWindow* pParent = GetParent();
+
+ wxCHECK_RET( pParent, _T("button without parent?") );
+
+ wxWindow* pWinOldDefault = pParent->GetDefaultItem();
+
+ pParent->SetTmpDefaultItem(this);
+ SetDefaultStyle( wxDynamicCast(pWinOldDefault, wxButton)
+ ,FALSE
+ );
+ SetDefaultStyle( this
+ ,TRUE
+ );
+} // end of wxButton::SetTmpDefault
+
+void wxButton::UnsetTmpDefault()
+{
+ wxWindow* pParent = GetParent();
+
+ wxCHECK_RET( pParent, _T("button without parent?") );
+
+ pParent->SetTmpDefaultItem(NULL);
+
+ wxWindow* pWinOldDefault = pParent->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)