- wxWindow *parent = (wxWindow *)GetParent();
- if (parent)
- parent->SetDefaultItem(this);
-
- if ( m_macControl )
- {
- UMASetControlData( m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)((Boolean)1) ) ;
- }
+ wxWindow *parent = GetParent();
+ wxButton *btnOldDefault = NULL;
+ if ( parent )
+ {
+ btnOldDefault = wxDynamicCast(parent->GetDefaultItem(),
+ wxButton);
+ parent->SetDefaultItem(this);
+ }
+
+ Boolean inData;
+ if ( btnOldDefault && btnOldDefault->m_macControl )
+ {
+ inData = 0;
+ ::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+ }
+ if ( (ControlHandle) m_macControl )
+ {
+ inData = 1;
+ ::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
+ kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
+ }
+}
+
+wxSize wxButton::DoGetBestSize() const
+{
+ wxSize sz = GetDefaultSize() ;
+
+ int wBtn = m_label.Length() * 8 + 12 + 2 * kMacOSXHorizontalBorder ;
+
+ if (wBtn > sz.x) sz.x = wBtn;
+
+ return sz ;
+}
+
+wxSize wxButton::GetDefaultSize()
+{
+ int wBtn = 70 ;
+ int hBtn = 20 ;
+
+ if ( UMAHasAquaLayout() )
+ {
+ wBtn += 2 * kMacOSXHorizontalBorder ;
+ hBtn += 2 * kMacOSXVerticalBorder ;
+ }
+
+ return wxSize(wBtn, hBtn);