]>
Commit | Line | Data |
---|---|---|
e9576ca5 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: statbox.cpp | |
3 | // Purpose: wxStaticBox | |
a31a5f85 | 4 | // Author: Stefan Csomor |
e9576ca5 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
e9576ca5 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
65571936 | 9 | // Licence: wxWindows licence |
e9576ca5 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
3d1a4878 | 12 | #include "wx/wxprec.h" |
d8c736e5 | 13 | |
179e085f RN |
14 | #if wxUSE_STATBOX |
15 | ||
e9576ca5 | 16 | #include "wx/statbox.h" |
519cb848 | 17 | #include "wx/mac/uma.h" |
e9576ca5 | 18 | |
e9576ca5 | 19 | IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl) |
e9576ca5 | 20 | |
43524b15 DS |
21 | |
22 | bool wxStaticBox::Create( wxWindow *parent, | |
23 | wxWindowID id, | |
24 | const wxString& label, | |
25 | const wxPoint& pos, | |
26 | const wxSize& size, | |
27 | long style, | |
28 | const wxString& name ) | |
e9576ca5 | 29 | { |
43524b15 | 30 | m_macIsUserPane = false; |
5dd070c2 | 31 | |
43524b15 | 32 | if ( !wxControl::Create( parent, id, pos, size, style, wxDefaultValidator, name ) ) |
b45ed7a2 VZ |
33 | return false; |
34 | ||
43524b15 | 35 | m_label = label; |
facd6764 | 36 | |
43524b15 | 37 | Rect bounds = wxMacGetBoundsForControl( this, pos, size ); |
5dd070c2 | 38 | |
43524b15 DS |
39 | m_peer = new wxMacControl( this ); |
40 | OSStatus err = CreateGroupBoxControl( | |
41 | MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), | |
42 | true /*primary*/, m_peer->GetControlRefAddr() ); | |
43 | verify_noerr( err ); | |
4c37f124 | 44 | |
43524b15 | 45 | MacPostControlCreate( pos, size ); |
5dd070c2 | 46 | |
43524b15 | 47 | return true; |
e9576ca5 | 48 | } |
179e085f | 49 | |
5dd070c2 VZ |
50 | void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const |
51 | { | |
52 | static int extraTop = -1; // Uninitted | |
53 | static int other = 5; | |
54 | ||
55 | if ( extraTop == -1 ) | |
56 | { | |
43524b15 DS |
57 | // The minimal border used for the top. |
58 | // Later on, the staticbox's font height is added to this. | |
5dd070c2 VZ |
59 | extraTop = 0; |
60 | ||
43524b15 | 61 | if ( UMAGetSystemVersion() >= 0x1030 ) // Panther |
5dd070c2 VZ |
62 | { |
63 | // As indicated by the HIG, Panther needs an extra border of 11 | |
64 | // pixels (otherwise overlapping occurs at the top). The "other" | |
65 | // border has to be 11. | |
66 | extraTop = 11; | |
67 | other = 11; | |
68 | } | |
5dd070c2 VZ |
69 | } |
70 | ||
b1f87262 | 71 | *borderTop = extraTop + GetCharHeight(); |
5dd070c2 VZ |
72 | *borderOther = other; |
73 | } | |
74 | ||
75 | #endif // wxUSE_STATBOX | |
76 |