]>
Commit | Line | Data |
---|---|---|
e53b3d16 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/osx/statbox_osx.cpp | |
3 | // Purpose: wxStaticBox | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id: statbox.cpp 54129 2008-06-11 19:30:52Z SC $ | |
8 | // Copyright: (c) Stefan Csomor | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/wxprec.h" | |
13 | ||
14 | #if wxUSE_STATBOX | |
15 | ||
16 | #include "wx/statbox.h" | |
17 | #include "wx/osx/private.h" | |
18 | ||
19 | IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) | |
20 | ||
21 | bool wxStaticBox::Create( wxWindow *parent, | |
22 | wxWindowID id, | |
23 | const wxString& label, | |
24 | const wxPoint& pos, | |
25 | const wxSize& size, | |
26 | long style, | |
27 | const wxString& name ) | |
28 | { | |
29 | m_macIsUserPane = false; | |
30 | ||
31 | if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) | |
32 | return false; | |
33 | ||
34 | m_labelOrig = m_label = label; | |
35 | ||
36 | m_peer = wxWidgetImpl::CreateGroupBox( this, parent, id, label, pos, size, style, GetExtraStyle() ); | |
37 | ||
38 | MacPostControlCreate( pos, size ); | |
39 | ||
40 | return true; | |
41 | } | |
42 | ||
43 | void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const | |
44 | { | |
45 | static int extraTop = -1; // Uninitted | |
46 | static int other = 5; | |
47 | ||
48 | if ( extraTop == -1 ) | |
49 | { | |
50 | // The minimal border used for the top. | |
51 | // Later on, the staticbox's font height is added to this. | |
52 | extraTop = 0; | |
53 | ||
54 | // As indicated by the HIG, Panther needs an extra border of 11 | |
55 | // pixels (otherwise overlapping occurs at the top). The "other" | |
56 | // border has to be 11. | |
57 | extraTop = 11; | |
58 | other = 11; | |
59 | } | |
60 | ||
61 | *borderTop = extraTop; | |
62 | if ( !m_label.empty() ) | |
63 | *borderTop += GetCharHeight(); | |
64 | ||
65 | *borderOther = other; | |
66 | } | |
67 | ||
bbd8f8af SC |
68 | bool wxStaticBox::SetFont(const wxFont& font) |
69 | { | |
70 | bool retval = wxWindowBase::SetFont( font ); | |
71 | ||
72 | // dont' update the native control, it has its own small font | |
73 | ||
74 | return retval; | |
75 | } | |
76 | ||
e53b3d16 SC |
77 | #endif // wxUSE_STATBOX |
78 |