- Rect bounds ;
- Str255 title ;
-
- MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
-
- m_macControl = ::NewControl( parent->GetMacRootWindow() , &bounds , title , false , 0 , 0 , 1,
- kControlPushButtonProc , (long) this ) ;
- wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ;
-
- MacPostControlCreate() ;
-
+ wxString label(lbl);
+ if (label.empty() && wxIsStockID(id))
+ label = wxGetStockLabel(id);
+
+ m_macIsUserPane = FALSE ;
+
+ if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) )
+ return false;
+
+ m_label = label ;
+
+ Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ m_peer = new wxMacControl(this) ;
+ if ( id == wxID_HELP )
+ {
+ ControlButtonContentInfo info ;
+ info.contentType = kControlContentIconRef ;
+ GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &info.u.iconRef);
+ verify_noerr ( CreateRoundButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , kControlRoundButtonNormalSize ,
+ &info , m_peer->GetControlRefAddr() ) );
+ }
+ else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
+ {
+#if TARGET_API_MAC_OSX
+ //Button height is static in Mac, can't be changed, so we need to force it here
+ if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL || GetWindowVariant() == wxWINDOW_VARIANT_LARGE )
+ {
+ bounds.bottom = bounds.top + 20 ;
+ m_maxHeight = 20 ;
+ }
+ else if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL )
+ {
+ bounds.bottom = bounds.top + 17 ;
+ m_maxHeight = 17 ;
+ }
+ else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI )
+ {
+ bounds.bottom = bounds.top + 15 ;
+ m_maxHeight = 15 ;
+ }
+#endif
+ verify_noerr ( CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") , m_peer->GetControlRefAddr() ) );
+ }
+ else
+ {
+ ControlButtonContentInfo info ;
+ info.contentType = kControlNoContent ;
+ verify_noerr(CreateBevelButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds,CFSTR(""),
+ kControlBevelButtonLargeBevel , kControlBehaviorPushbutton , &info , 0 , 0 , 0 , m_peer->GetControlRefAddr() ) );
+ }
+
+ wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
+
+ MacPostControlCreate(pos,size) ;
+