]> git.saurik.com Git - wxWidgets.git/blob - src/osx/cocoa/anybutton.mm
add wrappers to avoid compiling code which will never be used
[wxWidgets.git] / src / osx / cocoa / anybutton.mm
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 /////////////////////////////////////////////////////////////////////////////
10
11 #include "wx/wxprec.h"
12
13 #ifndef WX_PRECOMP
14 #include "wx/object.h"
15 #endif
16
17 #include "wx/button.h"
18
19 #include "wx/osx/private.h"
20
21 wxSize wxAnyButton::DoGetBestSize() const
22 {
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 ) ;
28
29 wxRect r ;
30 GetPeer()->GetBestRect(&r);
31
32 wxSize sz = r.GetSize();
33 sz.x = sz.x + MacGetLeftBorderSize() +
34 MacGetRightBorderSize();
35 sz.y = sz.y + MacGetTopBorderSize() +
36 MacGetBottomBorderSize();
37
38 const int wBtnStd = GetDefaultSize().x;
39
40 if ( (sz.x < wBtnStd) && !HasFlag(wxBU_EXACTFIT) )
41 sz.x = wBtnStd;
42
43 return sz ;
44 }
45
46 wxSize wxAnyButton::GetDefaultSize()
47 {
48 return wxSize(84, 20);
49 }