- 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 = panel->GetDefaultItem();
+ panel->SetDefaultItem(this);
+ }
+
+#ifdef __UNIX__
+ Boolean inData;
+ if ( btnOldDefault && btnOldDefault->m_macControl )
+ {
+ inData = 0;
+ UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+ }
+ if ( m_macControl )
+ {
+ inData = 1;
+ UMASetControlData( m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+ }
+#else
+ if ( btnOldDefault && btnOldDefault->m_macControl )
+ {
+ UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)0) ) ;
+ }
+ if ( m_macControl )
+ {
+ UMASetControlData( m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
+ }
+#endif