X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0150a5b8b9fec7f1db67b732be4b041844fd61b3..b77b87881bae2e6306366d79e7fe160334b3d4a2:/src/mac/carbon/button.cpp diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index d85d8bf7be..52bd329993 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////////////////// // Name: button.cpp // Purpose: wxButton -// Author: AUTHOR +// Author: Stefan Csomor // Modified by: -// Created: ??/??/98 +// Created: 1998-01-01 // RCS-ID: $Id$ -// Copyright: (c) AUTHOR -// Licence: wxWindows licence +// Copyright: (c) Stefan Csomor +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -25,8 +25,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) #include "wx/mac/uma.h" // Button -static const int kMacOSXHorizontalBorder = 1 ; -static const int kMacOSXVerticalBorder = 1 ; +static const int kMacOSXHorizontalBorder = 2 ; +static const int kMacOSXVerticalBorder = 4 ; + +wxButtonBase::wxButtonBase() +{ +} bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, @@ -34,23 +38,26 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxValidator& validator, const wxString& name) { - Rect bounds ; - Str255 title ; + if ( !wxButtonBase::Create(parent, id, pos, size, style, validator, name) ) + return false; + + Rect bounds ; + Str255 title ; if ( UMAHasAquaLayout() ) { m_macHorizontalBorder = kMacOSXHorizontalBorder; m_macVerticalBorder = kMacOSXVerticalBorder; } - - 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() ; - + + 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 , wxT("No valid mac control") ) ; + + MacPostControlCreate() ; + return TRUE; } @@ -65,19 +72,19 @@ void wxButton::SetDefault() 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) ) ; - } + 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 @@ -85,7 +92,7 @@ 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 ; @@ -94,7 +101,7 @@ wxSize wxButton::DoGetBestSize() const wxSize wxButton::GetDefaultSize() { int wBtn = 70 ; - int hBtn = 20 ; + int hBtn = 20 ; if ( UMAHasAquaLayout() ) { @@ -117,7 +124,7 @@ void wxButton::Command (wxCommandEvent & event) ProcessCommand (event); } -void wxButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart ) +void wxButton::MacHandleControlClick( WXWidget WXUNUSED(control) , wxInt16 controlpart , bool WXUNUSED(mouseStillDown) ) { if ( controlpart != kControlNoPart ) {