- wxWindow *parent = GetParent();
- wxButton *btnOldDefault = NULL;
- wxPanel *panel = wxDynamicCast(parent, wxPanel);
- if (panel)
- panel->SetDefaultItem(this);
+ wxWindow* pParent = GetParent();
+
+ wxCHECK_RET( pParent, _T("button without parent?") );
+
+ //
+ // Set this one as the default button both for wxWidgets 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();