- wxWindow *parent = (wxWindow *)GetParent();
- if (parent)
- parent->SetDefaultItem(this);
-
- // TODO: make button the default
+ wxWindow *parent = GetParent();
+ wxButton *btnOldDefault = NULL;
+ wxPanel *panel = wxDynamicCast(parent, wxPanel);
+ if ( panel )
+ {
+ btnOldDefault = wxDynamicCast(panel->GetDefaultItem(),
+ wxButton);
+ panel->SetDefaultItem(this);
+ }
+
+ Boolean inData;
+ if ( btnOldDefault && btnOldDefault->m_macControl )
+ {
+ inData = 0;
+ ::SetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+ }
+ if ( m_macControl )
+ {
+ inData = 1;
+ ::SetControlData( m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+ }