]>
Commit | Line | Data |
---|---|---|
b4354db1 VZ |
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 | #include "wx/button.h" | |
14 | ||
15 | #ifndef WX_PRECOMP | |
16 | #endif | |
17 | ||
18 | #include "wx/osx/private.h" | |
19 | ||
20 | wxSize wxAnyButton::DoGetBestSize() const | |
21 | { | |
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 ) ; | |
27 | ||
28 | wxRect r ; | |
29 | GetPeer()->GetBestRect(&r); | |
30 | ||
31 | wxSize sz = r.GetSize(); | |
32 | sz.x = sz.x + MacGetLeftBorderSize() + | |
33 | MacGetRightBorderSize(); | |
34 | sz.y = sz.y + MacGetTopBorderSize() + | |
35 | MacGetBottomBorderSize(); | |
36 | ||
37 | const int wBtnStd = GetDefaultSize().x; | |
38 | ||
39 | if ( (sz.x < wBtnStd) && !HasFlag(wxBU_EXACTFIT) ) | |
40 | sz.x = wBtnStd; | |
41 | ||
42 | return sz ; | |
43 | } | |
44 | ||
45 | wxSize wxAnyButton::GetDefaultSize() | |
46 | { | |
47 | return wxSize(84, 20); | |
48 | } |