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"
14 #include "wx/object.h"
17 #include "wx/button.h"
19 #include "wx/osx/private.h"
21 wxSize wxAnyButton::DoGetBestSize() const
23 // We only use help button bezel if we don't have any (non standard) label
24 // to display in the button. Otherwise even wxID_HELP buttons look like
25 // normal push buttons.
26 if ( GetId() == wxID_HELP && GetLabel().empty() )
27 return wxSize( 23 , 23 ) ;
30 GetPeer()->GetBestRect(&r);
32 wxSize sz = r.GetSize();
33 sz.x = sz.x + MacGetLeftBorderSize() +
34 MacGetRightBorderSize();
35 sz.y = sz.y + MacGetTopBorderSize() +
36 MacGetBottomBorderSize();
38 const int wBtnStd = GetDefaultSize().x;
40 if ( (sz.x < wBtnStd) && !HasFlag(wxBU_EXACTFIT) )
46 wxSize wxAnyButton::GetDefaultSize()
48 return wxSize(84, 20);