X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0a67a93b17c37c018f60e662645ee2a44ba4e58e..bb356c9ea78919fbc01e19c36bb925c80abb68a4:/src/mac/carbon/button.cpp diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index c67c470acf..072ba01720 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -13,6 +13,8 @@ #pragma implementation "button.h" #endif +#include "wx/defs.h" + #include "wx/button.h" #include "wx/panel.h" @@ -20,7 +22,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) #endif -#include +#include "wx/mac/uma.h" // Button @@ -35,7 +37,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ; - m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1, + m_macControl = ::NewControl( parent->MacGetRootWindow() , &bounds , title , false , 0 , 0 , 1, kControlPushButtonProc , (long) this ) ; wxASSERT_MSG( m_macControl != NULL , "No valid mac control" ) ; @@ -48,39 +50,26 @@ void wxButton::SetDefault() { wxWindow *parent = GetParent(); wxButton *btnOldDefault = NULL; - wxPanel *panel = wxDynamicCast(parent, wxPanel); - if ( panel ) + if ( parent ) { - btnOldDefault = panel->GetDefaultItem(); - panel->SetDefaultItem(this); + btnOldDefault = wxDynamicCast(parent->GetDefaultItem(), + wxButton); + parent->SetDefaultItem(this); } -#ifdef __UNIX__ Boolean inData; if ( btnOldDefault && btnOldDefault->m_macControl ) { inData = 0; - UMASetControlData( btnOldDefault->m_macControl , kControlButtonPart , + ::SetControlData( btnOldDefault->m_macControl , kControlButtonPart , kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ; } if ( m_macControl ) { inData = 1; - UMASetControlData( m_macControl , kControlButtonPart , + ::SetControlData( 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 } wxSize wxButton::DoGetBestSize() const @@ -118,8 +107,11 @@ void wxButton::Command (wxCommandEvent & event) void wxButton::MacHandleControlClick( ControlHandle control , SInt16 controlpart ) { + if ( controlpart != kControlNoPart ) + { wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, m_windowId ); event.SetEventObject(this); ProcessCommand(event); + } }