1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/anybutton.mm
3 // Purpose: wxAnyButton
4 // Author: Stefan Csomor
5 // Created: 1998-01-01 (extracted from button.mm)
6 // RCS-ID: $Id: anybutton.mm 67681 2011-05-03 16:29:04Z DS $
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
13 #include "wx/button.h"
18 #include "wx/osx/private.h"
20 wxSize wxAnyButton::DoGetBestSize() const
22 // We only use help button bezel if we don't have any (non standard) label
23 // to display in the button. Otherwise even wxID_HELP buttons look like
24 // normal push buttons.
25 if ( GetId() == wxID_HELP && GetLabel().empty() )
26 return wxSize( 23 , 23 ) ;
29 GetPeer()->GetBestRect(&r);
31 wxSize sz = r.GetSize();
32 sz.x = sz.x + MacGetLeftBorderSize() +
33 MacGetRightBorderSize();
34 sz.y = sz.y + MacGetTopBorderSize() +
35 MacGetBottomBorderSize();
37 const int wBtnStd = GetDefaultSize().x;
39 if ( (sz.x < wBtnStd) && !HasFlag(wxBU_EXACTFIT) )
45 wxSize wxAnyButton::GetDefaultSize()
47 return wxSize(84, 20);