- Rect bounds ;
- Str255 title ;
-
- MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
-
- m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
- kControlPushButtonProc , (long) this ) ;
- wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
-
- MacPostControlCreate() ;
-
+ 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() ;
+ if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND)
+ {
+ 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) ;
+