X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fdaf613add176525ed8b6cafaf278dfd80f85074..0888ccc71f062fcf31845a04cce3cf1dfe799e05:/src/mac/carbon/button.cpp?ds=sidebyside diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 53c0861dbe..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 , false , 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); + } }